make memcmp return a value of c_int_width instead of i32

This commit is contained in:
David Morrison 2021-11-10 20:14:23 -08:00
parent 8f96ef4bb5
commit aa67016624
7 changed files with 22 additions and 4 deletions

View file

@ -329,7 +329,10 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
let b_ptr = self.bitcast(b, i8p_ty);
let n = self.const_usize(layout.size().bytes());
let cmp = self.call_intrinsic("memcmp", &[a_ptr, b_ptr, n]);
self.icmp(IntPredicate::IntEQ, cmp, self.const_i32(0))
match self.cx.sess().target.arch.as_str() {
"avr" | "msp430" => self.icmp(IntPredicate::IntEQ, cmp, self.const_i16(0)),
_ => self.icmp(IntPredicate::IntEQ, cmp, self.const_i32(0)),
}
}
}