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:
Maybe Waffle
2022-05-11 17:52:00 +04:00
parent 48853a361a
commit 10270f4b44
8 changed files with 65 additions and 1 deletions

View File

@@ -71,6 +71,7 @@ fn get_simple_intrinsic<'ll>(
sym::nearbyintf64 => "llvm.nearbyint.f64",
sym::roundf32 => "llvm.round.f32",
sym::roundf64 => "llvm.round.f64",
sym::ptr_mask => "llvm.ptrmask",
_ => return None,
};
Some(cx.get_intrinsic(llvm_name))