Add pointer masking convenience functions
This commit adds the following functions all of which have a signature `pointer, usize -> pointer`: - `<*mut T>::mask` - `<*const T>::mask` - `intrinsics::ptr_mask` These functions are equivalent to `.map_addr(|a| a & mask)` but they utilize `llvm.ptrmask` llvm intrinsic. *masks your pointers*
This commit is contained in:
parent
48853a361a
commit
10270f4b44
8 changed files with 65 additions and 1 deletions
|
@ -540,6 +540,13 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
|||
ret.write_cvalue(fx, CValue::by_val(res, base.layout()));
|
||||
}
|
||||
|
||||
sym::ptr_mask => {
|
||||
intrinsic_args!(fx, args => (ptr, mask); intrinsic);
|
||||
let ptr_val = ptr.load_scalar(fx);
|
||||
|
||||
fx.bcx.ins().band(ptr_val, mask);
|
||||
}
|
||||
|
||||
sym::transmute => {
|
||||
intrinsic_args!(fx, args => (from); intrinsic);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue