Fix ptr_mask impl in cg gcc

This commit is contained in:
Maybe Waffle 2022-05-13 17:08:44 +04:00
parent 34d33f2299
commit 1acc3b45e3

View File

@ -309,8 +309,18 @@ 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) {
Ok(llval) => llval,