Fix ptr_mask impl in cg gcc

This commit is contained in:
Maybe Waffle 2022-05-13 17:08:44 +04:00 committed by Antoni Boucher
parent a7f6e7ebaf
commit 5eedd541a9

View File

@ -320,7 +320,17 @@ fn codegen_intrinsic_call(&mut self, instance: Instance<'tcx>, fn_abi: &FnAbi<'t
return;
}
sym::ptr_mask => self.and(args[0].immediate(), args[1].immediate()),
sym::ptr_mask => {
let usize_type = self.context.new_type::<usize>();
let void_ptr_type = self.context.new_type::<*const ()>();
let ptr = args[0].immediate();
let mask = args[1].immediate();
let addr = self.bitcast(ptr, usize_type);
let masked = self.and(addr, mask);
self.bitcast(masked, void_ptr_type)
},
_ if name_str.starts_with("simd_") => {
match generic_simd_intrinsic(self, name, callee_ty, args, ret_ty, llret_ty, span) {