mark BMI2 intrinsics as safe
Mark all BMI2 intrinsics as safe. `_mulx_u32` and `_mulx_u64` accepts a reference instead of a pointer.
This commit is contained in:
parent
cfbeb3be9c
commit
a355388e26
2 changed files with 14 additions and 14 deletions
|
|
@ -25,7 +25,7 @@ use stdarch_test::assert_instr;
|
|||
#[cfg_attr(all(test, target_arch = "x86"), assert_instr(mul))]
|
||||
#[target_feature(enable = "bmi2")]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _mulx_u32(a: u32, b: u32, hi: &mut u32) -> u32 {
|
||||
pub fn _mulx_u32(a: u32, b: u32, hi: &mut u32) -> u32 {
|
||||
let result: u64 = (a as u64) * (b as u64);
|
||||
*hi = (result >> 32) as u32;
|
||||
result as u32
|
||||
|
|
@ -38,8 +38,8 @@ pub unsafe fn _mulx_u32(a: u32, b: u32, hi: &mut u32) -> u32 {
|
|||
#[target_feature(enable = "bmi2")]
|
||||
#[cfg_attr(test, assert_instr(bzhi))]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _bzhi_u32(a: u32, index: u32) -> u32 {
|
||||
x86_bmi2_bzhi_32(a, index)
|
||||
pub fn _bzhi_u32(a: u32, index: u32) -> u32 {
|
||||
unsafe { x86_bmi2_bzhi_32(a, index) }
|
||||
}
|
||||
|
||||
/// Scatter contiguous low order bits of `a` to the result at the positions
|
||||
|
|
@ -50,8 +50,8 @@ pub unsafe fn _bzhi_u32(a: u32, index: u32) -> u32 {
|
|||
#[target_feature(enable = "bmi2")]
|
||||
#[cfg_attr(test, assert_instr(pdep))]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _pdep_u32(a: u32, mask: u32) -> u32 {
|
||||
x86_bmi2_pdep_32(a, mask)
|
||||
pub fn _pdep_u32(a: u32, mask: u32) -> u32 {
|
||||
unsafe { x86_bmi2_pdep_32(a, mask) }
|
||||
}
|
||||
|
||||
/// Gathers the bits of `x` specified by the `mask` into the contiguous low
|
||||
|
|
@ -62,8 +62,8 @@ pub unsafe fn _pdep_u32(a: u32, mask: u32) -> u32 {
|
|||
#[target_feature(enable = "bmi2")]
|
||||
#[cfg_attr(test, assert_instr(pext))]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _pext_u32(a: u32, mask: u32) -> u32 {
|
||||
x86_bmi2_pext_32(a, mask)
|
||||
pub fn _pext_u32(a: u32, mask: u32) -> u32 {
|
||||
unsafe { x86_bmi2_pext_32(a, mask) }
|
||||
}
|
||||
|
||||
unsafe extern "C" {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use stdarch_test::assert_instr;
|
|||
#[target_feature(enable = "bmi2")]
|
||||
#[cfg(not(target_arch = "x86"))] // calls an intrinsic
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _mulx_u64(a: u64, b: u64, hi: &mut u64) -> u64 {
|
||||
pub fn _mulx_u64(a: u64, b: u64, hi: &mut u64) -> u64 {
|
||||
let result: u128 = (a as u128) * (b as u128);
|
||||
*hi = (result >> 64) as u64;
|
||||
result as u64
|
||||
|
|
@ -38,8 +38,8 @@ pub unsafe fn _mulx_u64(a: u64, b: u64, hi: &mut u64) -> u64 {
|
|||
#[cfg_attr(test, assert_instr(bzhi))]
|
||||
#[cfg(not(target_arch = "x86"))]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _bzhi_u64(a: u64, index: u32) -> u64 {
|
||||
x86_bmi2_bzhi_64(a, index as u64)
|
||||
pub fn _bzhi_u64(a: u64, index: u32) -> u64 {
|
||||
unsafe { x86_bmi2_bzhi_64(a, index as u64) }
|
||||
}
|
||||
|
||||
/// Scatter contiguous low order bits of `a` to the result at the positions
|
||||
|
|
@ -51,8 +51,8 @@ pub unsafe fn _bzhi_u64(a: u64, index: u32) -> u64 {
|
|||
#[cfg_attr(test, assert_instr(pdep))]
|
||||
#[cfg(not(target_arch = "x86"))]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _pdep_u64(a: u64, mask: u64) -> u64 {
|
||||
x86_bmi2_pdep_64(a, mask)
|
||||
pub fn _pdep_u64(a: u64, mask: u64) -> u64 {
|
||||
unsafe { x86_bmi2_pdep_64(a, mask) }
|
||||
}
|
||||
|
||||
/// Gathers the bits of `x` specified by the `mask` into the contiguous low
|
||||
|
|
@ -64,8 +64,8 @@ pub unsafe fn _pdep_u64(a: u64, mask: u64) -> u64 {
|
|||
#[cfg_attr(test, assert_instr(pext))]
|
||||
#[cfg(not(target_arch = "x86"))]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _pext_u64(a: u64, mask: u64) -> u64 {
|
||||
x86_bmi2_pext_64(a, mask)
|
||||
pub fn _pext_u64(a: u64, mask: u64) -> u64 {
|
||||
unsafe { x86_bmi2_pext_64(a, mask) }
|
||||
}
|
||||
|
||||
unsafe extern "C" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue