Skip to content

Commit 3e9b0d1

Browse files
committed
Mark avx broadcast intrinsics as safe
1 parent 5a7342f commit 3e9b0d1

File tree

1 file changed

+7
-7
lines changed
  • crates/core_arch/src/x86

1 file changed

+7
-7
lines changed

crates/core_arch/src/x86/avx.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ pub fn _mm256_permute2f128_si256<const IMM8: i32>(a: __m256i, b: __m256i) -> __m
12581258
#[cfg_attr(test, assert_instr(vbroadcastss))]
12591259
#[stable(feature = "simd_x86", since = "1.27.0")]
12601260
#[allow(clippy::trivially_copy_pass_by_ref)]
1261-
pub unsafe fn _mm256_broadcast_ss(f: &f32) -> __m256 {
1261+
pub fn _mm256_broadcast_ss(f: &f32) -> __m256 {
12621262
_mm256_set1_ps(*f)
12631263
}
12641264

@@ -1271,7 +1271,7 @@ pub unsafe fn _mm256_broadcast_ss(f: &f32) -> __m256 {
12711271
#[cfg_attr(test, assert_instr(vbroadcastss))]
12721272
#[stable(feature = "simd_x86", since = "1.27.0")]
12731273
#[allow(clippy::trivially_copy_pass_by_ref)]
1274-
pub unsafe fn _mm_broadcast_ss(f: &f32) -> __m128 {
1274+
pub fn _mm_broadcast_ss(f: &f32) -> __m128 {
12751275
_mm_set1_ps(*f)
12761276
}
12771277

@@ -1284,7 +1284,7 @@ pub unsafe fn _mm_broadcast_ss(f: &f32) -> __m128 {
12841284
#[cfg_attr(test, assert_instr(vbroadcastsd))]
12851285
#[stable(feature = "simd_x86", since = "1.27.0")]
12861286
#[allow(clippy::trivially_copy_pass_by_ref)]
1287-
pub unsafe fn _mm256_broadcast_sd(f: &f64) -> __m256d {
1287+
pub fn _mm256_broadcast_sd(f: &f64) -> __m256d {
12881288
_mm256_set1_pd(*f)
12891289
}
12901290

@@ -1296,8 +1296,8 @@ pub unsafe fn _mm256_broadcast_sd(f: &f64) -> __m256d {
12961296
#[target_feature(enable = "avx")]
12971297
#[cfg_attr(test, assert_instr(vbroadcastf128))]
12981298
#[stable(feature = "simd_x86", since = "1.27.0")]
1299-
pub unsafe fn _mm256_broadcast_ps(a: &__m128) -> __m256 {
1300-
simd_shuffle!(*a, _mm_setzero_ps(), [0, 1, 2, 3, 0, 1, 2, 3])
1299+
pub fn _mm256_broadcast_ps(a: &__m128) -> __m256 {
1300+
unsafe { simd_shuffle!(*a, _mm_setzero_ps(), [0, 1, 2, 3, 0, 1, 2, 3]) }
13011301
}
13021302

13031303
/// Broadcasts 128 bits from memory (composed of 2 packed double-precision
@@ -1308,8 +1308,8 @@ pub unsafe fn _mm256_broadcast_ps(a: &__m128) -> __m256 {
13081308
#[target_feature(enable = "avx")]
13091309
#[cfg_attr(test, assert_instr(vbroadcastf128))]
13101310
#[stable(feature = "simd_x86", since = "1.27.0")]
1311-
pub unsafe fn _mm256_broadcast_pd(a: &__m128d) -> __m256d {
1312-
simd_shuffle!(*a, _mm_setzero_pd(), [0, 1, 0, 1])
1311+
pub fn _mm256_broadcast_pd(a: &__m128d) -> __m256d {
1312+
unsafe { simd_shuffle!(*a, _mm_setzero_pd(), [0, 1, 0, 1]) }
13131313
}
13141314

13151315
/// Copies `a` to result, then inserts 128 bits (composed of 4 packed

0 commit comments

Comments
 (0)