Add a new compare_bytes
intrinsic instead of calling memcmp
directly
This commit is contained in:
parent
7ebcd4d5de
commit
9c8ae2f153
@ -302,6 +302,20 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
sym::compare_bytes => {
|
||||
let a = args[0].immediate();
|
||||
let b = args[1].immediate();
|
||||
let n = args[2].immediate();
|
||||
|
||||
let void_ptr_type = self.context.new_type::<*const ()>();
|
||||
let a_ptr = self.bitcast(a, void_ptr_type);
|
||||
let b_ptr = self.bitcast(b, void_ptr_type);
|
||||
|
||||
let builtin = self.context.get_builtin_function("memcmp");
|
||||
let cmp = self.context.new_call(None, builtin, &[a_ptr, b_ptr, n]);
|
||||
self.sext(cmp, self.type_ix(32))
|
||||
}
|
||||
|
||||
sym::black_box => {
|
||||
args[0].val.store(self, result);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user