Skip to content

Commit

Permalink
Fix ptr_mask impl in cg gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin authored and antoyo committed Feb 28, 2023
1 parent a7f6e7e commit 5eedd54
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/intrinsic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,18 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
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,
Expand Down

0 comments on commit 5eedd54

Please sign in to comment.