diff --git a/library/stdarch/crates/core_arch/src/x86/sse42.rs b/library/stdarch/crates/core_arch/src/x86/sse42.rs index 206e9014b037..3639126c1203 100644 --- a/library/stdarch/crates/core_arch/src/x86/sse42.rs +++ b/library/stdarch/crates/core_arch/src/x86/sse42.rs @@ -73,9 +73,9 @@ pub const _SIDD_UNIT_MASK: i32 = 0b0100_0000; #[cfg_attr(test, assert_instr(pcmpistrm, IMM8 = 0))] #[rustc_legacy_const_generics(2)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_cmpistrm(a: __m128i, b: __m128i) -> __m128i { static_assert_uimm_bits!(IMM8, 8); - transmute(pcmpistrm128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8)) + unsafe { transmute(pcmpistrm128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8)) } } /// Compares packed strings with implicit lengths in `a` and `b` using the @@ -261,9 +261,9 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(pcmpistri, IMM8 = 0))] #[rustc_legacy_const_generics(2)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpistri(a: __m128i, b: __m128i) -> i32 { +pub fn _mm_cmpistri(a: __m128i, b: __m128i) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpistri128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) + unsafe { pcmpistri128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) } } /// Compares packed strings with implicit lengths in `a` and `b` using the @@ -276,9 +276,9 @@ pub unsafe fn _mm_cmpistri(a: __m128i, b: __m128i) -> i32 { #[cfg_attr(test, assert_instr(pcmpistri, IMM8 = 0))] #[rustc_legacy_const_generics(2)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpistrz(a: __m128i, b: __m128i) -> i32 { +pub fn _mm_cmpistrz(a: __m128i, b: __m128i) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpistriz128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) + unsafe { pcmpistriz128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) } } /// Compares packed strings with implicit lengths in `a` and `b` using the @@ -291,9 +291,9 @@ pub unsafe fn _mm_cmpistrz(a: __m128i, b: __m128i) -> i32 { #[cfg_attr(test, assert_instr(pcmpistri, IMM8 = 0))] #[rustc_legacy_const_generics(2)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpistrc(a: __m128i, b: __m128i) -> i32 { +pub fn _mm_cmpistrc(a: __m128i, b: __m128i) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpistric128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) + unsafe { pcmpistric128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) } } /// Compares packed strings with implicit lengths in `a` and `b` using the @@ -306,9 +306,9 @@ pub unsafe fn _mm_cmpistrc(a: __m128i, b: __m128i) -> i32 { #[cfg_attr(test, assert_instr(pcmpistri, IMM8 = 0))] #[rustc_legacy_const_generics(2)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpistrs(a: __m128i, b: __m128i) -> i32 { +pub fn _mm_cmpistrs(a: __m128i, b: __m128i) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpistris128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) + unsafe { pcmpistris128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) } } /// Compares packed strings with implicit lengths in `a` and `b` using the @@ -320,9 +320,9 @@ pub unsafe fn _mm_cmpistrs(a: __m128i, b: __m128i) -> i32 { #[cfg_attr(test, assert_instr(pcmpistri, IMM8 = 0))] #[rustc_legacy_const_generics(2)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpistro(a: __m128i, b: __m128i) -> i32 { +pub fn _mm_cmpistro(a: __m128i, b: __m128i) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpistrio128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) + unsafe { pcmpistrio128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) } } /// Compares packed strings with implicit lengths in `a` and `b` using the @@ -335,9 +335,9 @@ pub unsafe fn _mm_cmpistro(a: __m128i, b: __m128i) -> i32 { #[cfg_attr(test, assert_instr(pcmpistri, IMM8 = 0))] #[rustc_legacy_const_generics(2)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpistra(a: __m128i, b: __m128i) -> i32 { +pub fn _mm_cmpistra(a: __m128i, b: __m128i) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpistria128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) + unsafe { pcmpistria128(a.as_i8x16(), b.as_i8x16(), IMM8 as i8) } } /// Compares packed strings in `a` and `b` with lengths `la` and `lb` @@ -349,9 +349,9 @@ pub unsafe fn _mm_cmpistra(a: __m128i, b: __m128i) -> i32 { #[cfg_attr(test, assert_instr(pcmpestrm, IMM8 = 0))] #[rustc_legacy_const_generics(4)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpestrm(a: __m128i, la: i32, b: __m128i, lb: i32) -> __m128i { +pub fn _mm_cmpestrm(a: __m128i, la: i32, b: __m128i, lb: i32) -> __m128i { static_assert_uimm_bits!(IMM8, 8); - transmute(pcmpestrm128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8)) + unsafe { transmute(pcmpestrm128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8)) } } /// Compares packed strings `a` and `b` with lengths `la` and `lb` using the @@ -438,9 +438,9 @@ pub unsafe fn _mm_cmpestrm(a: __m128i, la: i32, b: __m128i, lb: #[cfg_attr(test, assert_instr(pcmpestri, IMM8 = 0))] #[rustc_legacy_const_generics(4)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpestri(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { +pub fn _mm_cmpestri(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpestri128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) + unsafe { pcmpestri128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) } } /// Compares packed strings in `a` and `b` with lengths `la` and `lb` @@ -453,9 +453,9 @@ pub unsafe fn _mm_cmpestri(a: __m128i, la: i32, b: __m128i, lb: #[cfg_attr(test, assert_instr(pcmpestri, IMM8 = 0))] #[rustc_legacy_const_generics(4)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpestrz(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { +pub fn _mm_cmpestrz(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpestriz128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) + unsafe { pcmpestriz128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) } } /// Compares packed strings in `a` and `b` with lengths `la` and `lb` @@ -468,9 +468,9 @@ pub unsafe fn _mm_cmpestrz(a: __m128i, la: i32, b: __m128i, lb: #[cfg_attr(test, assert_instr(pcmpestri, IMM8 = 0))] #[rustc_legacy_const_generics(4)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpestrc(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { +pub fn _mm_cmpestrc(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpestric128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) + unsafe { pcmpestric128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) } } /// Compares packed strings in `a` and `b` with lengths `la` and `lb` @@ -483,9 +483,9 @@ pub unsafe fn _mm_cmpestrc(a: __m128i, la: i32, b: __m128i, lb: #[cfg_attr(test, assert_instr(pcmpestri, IMM8 = 0))] #[rustc_legacy_const_generics(4)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpestrs(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { +pub fn _mm_cmpestrs(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpestris128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) + unsafe { pcmpestris128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) } } /// Compares packed strings in `a` and `b` with lengths `la` and `lb` @@ -498,9 +498,9 @@ pub unsafe fn _mm_cmpestrs(a: __m128i, la: i32, b: __m128i, lb: #[cfg_attr(test, assert_instr(pcmpestri, IMM8 = 0))] #[rustc_legacy_const_generics(4)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpestro(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { +pub fn _mm_cmpestro(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpestrio128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) + unsafe { pcmpestrio128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) } } /// Compares packed strings in `a` and `b` with lengths `la` and `lb` @@ -514,9 +514,9 @@ pub unsafe fn _mm_cmpestro(a: __m128i, la: i32, b: __m128i, lb: #[cfg_attr(test, assert_instr(pcmpestri, IMM8 = 0))] #[rustc_legacy_const_generics(4)] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpestra(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { +pub fn _mm_cmpestra(a: __m128i, la: i32, b: __m128i, lb: i32) -> i32 { static_assert_uimm_bits!(IMM8, 8); - pcmpestria128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) + unsafe { pcmpestria128(a.as_i8x16(), la, b.as_i8x16(), lb, IMM8 as i8) } } /// Starting with the initial value in `crc`, return the accumulated @@ -527,8 +527,8 @@ pub unsafe fn _mm_cmpestra(a: __m128i, la: i32, b: __m128i, lb: #[target_feature(enable = "sse4.2")] #[cfg_attr(test, assert_instr(crc32))] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_crc32_u8(crc: u32, v: u8) -> u32 { - crc32_32_8(crc, v) +pub fn _mm_crc32_u8(crc: u32, v: u8) -> u32 { + unsafe { crc32_32_8(crc, v) } } /// Starting with the initial value in `crc`, return the accumulated @@ -539,8 +539,8 @@ pub unsafe fn _mm_crc32_u8(crc: u32, v: u8) -> u32 { #[target_feature(enable = "sse4.2")] #[cfg_attr(test, assert_instr(crc32))] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_crc32_u16(crc: u32, v: u16) -> u32 { - crc32_32_16(crc, v) +pub fn _mm_crc32_u16(crc: u32, v: u16) -> u32 { + unsafe { crc32_32_16(crc, v) } } /// Starting with the initial value in `crc`, return the accumulated @@ -551,8 +551,8 @@ pub unsafe fn _mm_crc32_u16(crc: u32, v: u16) -> u32 { #[target_feature(enable = "sse4.2")] #[cfg_attr(test, assert_instr(crc32))] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_crc32_u32(crc: u32, v: u32) -> u32 { - crc32_32_32(crc, v) +pub fn _mm_crc32_u32(crc: u32, v: u32) -> u32 { + unsafe { crc32_32_32(crc, v) } } /// Compares packed 64-bit integers in `a` and `b` for greater-than, @@ -563,8 +563,8 @@ pub unsafe fn _mm_crc32_u32(crc: u32, v: u32) -> u32 { #[target_feature(enable = "sse4.2")] #[cfg_attr(test, assert_instr(pcmpgtq))] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_cmpgt_epi64(a: __m128i, b: __m128i) -> __m128i { - transmute(simd_gt::<_, i64x2>(a.as_i64x2(), b.as_i64x2())) +pub fn _mm_cmpgt_epi64(a: __m128i, b: __m128i) -> __m128i { + unsafe { transmute(simd_gt::<_, i64x2>(a.as_i64x2(), b.as_i64x2())) } } #[allow(improper_ctypes)] diff --git a/library/stdarch/crates/core_arch/src/x86_64/sse42.rs b/library/stdarch/crates/core_arch/src/x86_64/sse42.rs index 6c3111b71980..64a23b2b1921 100644 --- a/library/stdarch/crates/core_arch/src/x86_64/sse42.rs +++ b/library/stdarch/crates/core_arch/src/x86_64/sse42.rs @@ -17,8 +17,8 @@ unsafe extern "C" { #[target_feature(enable = "sse4.2")] #[cfg_attr(test, assert_instr(crc32))] #[stable(feature = "simd_x86", since = "1.27.0")] -pub unsafe fn _mm_crc32_u64(crc: u64, v: u64) -> u64 { - crc32_64_64(crc, v) +pub fn _mm_crc32_u64(crc: u64, v: u64) -> u64 { + unsafe { crc32_64_64(crc, v) } } #[cfg(test)]