Fix CI errors due to alignment issues in msvc

This commit is contained in:
sayantn 2025-04-28 12:02:27 +05:30 committed by Amanieu d'Antras
parent 7db430fb80
commit caf463ae41
4 changed files with 142 additions and 35 deletions

View file

@ -1425,7 +1425,10 @@ pub fn _mm256_insert_epi32<const INDEX: i32>(a: __m256i, i: i32) -> __m256i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_load_pd)
#[inline]
#[target_feature(enable = "avx")]
#[cfg_attr(test, assert_instr(vmovap))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovap)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm256_load_pd(mem_addr: *const f64) -> __m256d {
@ -1440,7 +1443,10 @@ pub unsafe fn _mm256_load_pd(mem_addr: *const f64) -> __m256d {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_store_pd)
#[inline]
#[target_feature(enable = "avx")]
#[cfg_attr(test, assert_instr(vmovap))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovap)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm256_store_pd(mem_addr: *mut f64, a: __m256d) {
@ -1455,7 +1461,10 @@ pub unsafe fn _mm256_store_pd(mem_addr: *mut f64, a: __m256d) {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_load_ps)
#[inline]
#[target_feature(enable = "avx")]
#[cfg_attr(test, assert_instr(vmovaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm256_load_ps(mem_addr: *const f32) -> __m256 {
@ -1470,7 +1479,10 @@ pub unsafe fn _mm256_load_ps(mem_addr: *const f32) -> __m256 {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_store_ps)
#[inline]
#[target_feature(enable = "avx")]
#[cfg_attr(test, assert_instr(vmovaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm256_store_ps(mem_addr: *mut f32, a: __m256) {
@ -1548,7 +1560,10 @@ pub unsafe fn _mm256_storeu_ps(mem_addr: *mut f32, a: __m256) {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_load_si256)
#[inline]
#[target_feature(enable = "avx")]
#[cfg_attr(test, assert_instr(vmovaps))] // FIXME vmovdqa expected
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] // FIXME vmovdqa expected
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_load_si256(mem_addr: *const __m256i) -> __m256i {
*mem_addr
@ -1561,7 +1576,10 @@ pub unsafe fn _mm256_load_si256(mem_addr: *const __m256i) -> __m256i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_store_si256)
#[inline]
#[target_feature(enable = "avx")]
#[cfg_attr(test, assert_instr(vmovaps))] // FIXME vmovdqa expected
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] // FIXME vmovdqa expected
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_store_si256(mem_addr: *mut __m256i, a: __m256i) {
*mem_addr = a;

View file

@ -34468,7 +34468,10 @@ pub unsafe fn _mm512_storeu_ps(mem_addr: *mut f32, a: __m512) {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa32
pub unsafe fn _mm512_load_si512(mem_addr: *const __m512i) -> __m512i {
ptr::read(mem_addr)
}
@ -34479,7 +34482,10 @@ pub unsafe fn _mm512_load_si512(mem_addr: *const __m512i) -> __m512i {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa32
pub unsafe fn _mm512_store_si512(mem_addr: *mut __m512i, a: __m512i) {
ptr::write(mem_addr, a);
}
@ -34490,7 +34496,10 @@ pub unsafe fn _mm512_store_si512(mem_addr: *mut __m512i, a: __m512i) {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa32
pub unsafe fn _mm512_load_epi32(mem_addr: *const i32) -> __m512i {
ptr::read(mem_addr as *const __m512i)
}
@ -34501,7 +34510,10 @@ pub unsafe fn _mm512_load_epi32(mem_addr: *const i32) -> __m512i {
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa32
pub unsafe fn _mm256_load_epi32(mem_addr: *const i32) -> __m256i {
ptr::read(mem_addr as *const __m256i)
}
@ -34512,7 +34524,10 @@ pub unsafe fn _mm256_load_epi32(mem_addr: *const i32) -> __m256i {
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa32
pub unsafe fn _mm_load_epi32(mem_addr: *const i32) -> __m128i {
ptr::read(mem_addr as *const __m128i)
}
@ -34523,7 +34538,10 @@ pub unsafe fn _mm_load_epi32(mem_addr: *const i32) -> __m128i {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa32
pub unsafe fn _mm512_store_epi32(mem_addr: *mut i32, a: __m512i) {
ptr::write(mem_addr as *mut __m512i, a);
}
@ -34534,7 +34552,10 @@ pub unsafe fn _mm512_store_epi32(mem_addr: *mut i32, a: __m512i) {
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa32
pub unsafe fn _mm256_store_epi32(mem_addr: *mut i32, a: __m256i) {
ptr::write(mem_addr as *mut __m256i, a);
}
@ -34545,7 +34566,10 @@ pub unsafe fn _mm256_store_epi32(mem_addr: *mut i32, a: __m256i) {
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa32
pub unsafe fn _mm_store_epi32(mem_addr: *mut i32, a: __m128i) {
ptr::write(mem_addr as *mut __m128i, a);
}
@ -34556,7 +34580,10 @@ pub unsafe fn _mm_store_epi32(mem_addr: *mut i32, a: __m128i) {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa64
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa64
pub unsafe fn _mm512_load_epi64(mem_addr: *const i64) -> __m512i {
ptr::read(mem_addr as *const __m512i)
}
@ -34567,7 +34594,10 @@ pub unsafe fn _mm512_load_epi64(mem_addr: *const i64) -> __m512i {
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa64
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa64
pub unsafe fn _mm256_load_epi64(mem_addr: *const i64) -> __m256i {
ptr::read(mem_addr as *const __m256i)
}
@ -34578,7 +34608,10 @@ pub unsafe fn _mm256_load_epi64(mem_addr: *const i64) -> __m256i {
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa64
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa64
pub unsafe fn _mm_load_epi64(mem_addr: *const i64) -> __m128i {
ptr::read(mem_addr as *const __m128i)
}
@ -34589,7 +34622,10 @@ pub unsafe fn _mm_load_epi64(mem_addr: *const i64) -> __m128i {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa64
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa64
pub unsafe fn _mm512_store_epi64(mem_addr: *mut i64, a: __m512i) {
ptr::write(mem_addr as *mut __m512i, a);
}
@ -34600,7 +34636,10 @@ pub unsafe fn _mm512_store_epi64(mem_addr: *mut i64, a: __m512i) {
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa64
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa64
pub unsafe fn _mm256_store_epi64(mem_addr: *mut i64, a: __m256i) {
ptr::write(mem_addr as *mut __m256i, a);
}
@ -34611,7 +34650,10 @@ pub unsafe fn _mm256_store_epi64(mem_addr: *mut i64, a: __m256i) {
#[inline]
#[target_feature(enable = "avx512f,avx512vl")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa64
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovdqa64
pub unsafe fn _mm_store_epi64(mem_addr: *mut i64, a: __m128i) {
ptr::write(mem_addr as *mut __m128i, a);
}
@ -34622,7 +34664,10 @@ pub unsafe fn _mm_store_epi64(mem_addr: *mut i64, a: __m128i) {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)]
pub unsafe fn _mm512_load_ps(mem_addr: *const f32) -> __m512 {
ptr::read(mem_addr as *const __m512)
}
@ -34633,7 +34678,10 @@ pub unsafe fn _mm512_load_ps(mem_addr: *const f32) -> __m512 {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)]
pub unsafe fn _mm512_store_ps(mem_addr: *mut f32, a: __m512) {
ptr::write(mem_addr as *mut __m512, a);
}
@ -34644,7 +34692,10 @@ pub unsafe fn _mm512_store_ps(mem_addr: *mut f32, a: __m512) {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovapd
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovapd
pub unsafe fn _mm512_load_pd(mem_addr: *const f64) -> __m512d {
ptr::read(mem_addr as *const __m512d)
}
@ -34655,7 +34706,10 @@ pub unsafe fn _mm512_load_pd(mem_addr: *const f64) -> __m512d {
#[inline]
#[target_feature(enable = "avx512f")]
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovapd
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(vmovaps)
)] //should be vmovapd
pub unsafe fn _mm512_store_pd(mem_addr: *mut f64, a: __m512d) {
ptr::write(mem_addr as *mut __m512d, a);
}

View file

@ -1158,7 +1158,12 @@ pub unsafe fn _mm_load_ps1(p: *const f32) -> __m128 {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_ps)
#[inline]
#[target_feature(enable = "sse")]
#[cfg_attr(test, assert_instr(movaps))]
// FIXME: Rust doesn't emit alignment attributes for MSVC x86-32. Ref https://github.com/rust-lang/rust/pull/139261
// All aligned load/store intrinsics are affected
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm_load_ps(p: *const f32) -> __m128 {
@ -1213,7 +1218,10 @@ pub unsafe fn _mm_loadu_ps(p: *const f32) -> __m128 {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadr_ps)
#[inline]
#[target_feature(enable = "sse")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_loadr_ps(p: *const f32) -> __m128 {
let a = _mm_load_ps(p);
@ -1253,7 +1261,10 @@ pub unsafe fn _mm_store_ss(p: *mut f32, a: __m128) {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store1_ps)
#[inline]
#[target_feature(enable = "sse")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm_store1_ps(p: *mut f32, a: __m128) {
@ -1266,7 +1277,10 @@ pub unsafe fn _mm_store1_ps(p: *mut f32, a: __m128) {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_ps1)
#[inline]
#[target_feature(enable = "sse")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_store_ps1(p: *mut f32, a: __m128) {
_mm_store1_ps(p, a);
@ -1285,7 +1299,10 @@ pub unsafe fn _mm_store_ps1(p: *mut f32, a: __m128) {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_ps)
#[inline]
#[target_feature(enable = "sse")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm_store_ps(p: *mut f32, a: __m128) {
@ -1329,7 +1346,10 @@ pub unsafe fn _mm_storeu_ps(p: *mut f32, a: __m128) {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_storer_ps)
#[inline]
#[target_feature(enable = "sse")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm_storer_ps(p: *mut f32, a: __m128) {

View file

@ -1243,7 +1243,10 @@ pub unsafe fn _mm_loadl_epi64(mem_addr: *const __m128i) -> __m128i {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_si128)
#[inline]
#[target_feature(enable = "sse2")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_load_si128(mem_addr: *const __m128i) -> __m128i {
*mem_addr
@ -1293,7 +1296,10 @@ pub unsafe fn _mm_maskmoveu_si128(a: __m128i, mask: __m128i, mem_addr: *mut i8)
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_si128)
#[inline]
#[target_feature(enable = "sse2")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_store_si128(mem_addr: *mut __m128i, a: __m128i) {
*mem_addr = a;
@ -2535,7 +2541,10 @@ pub fn _mm_movemask_pd(a: __m128d) -> i32 {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_load_pd)
#[inline]
#[target_feature(enable = "sse2")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm_load_pd(mem_addr: *const f64) -> __m128d {
@ -2628,7 +2637,10 @@ pub unsafe fn _mm_store_sd(mem_addr: *mut f64, a: __m128d) {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_store_pd)
#[inline]
#[target_feature(enable = "sse2")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe fn _mm_store_pd(mem_addr: *mut f64, a: __m128d) {
@ -2783,7 +2795,10 @@ pub unsafe fn _mm_load_pd1(mem_addr: *const f64) -> __m128d {
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_loadr_pd)
#[inline]
#[target_feature(enable = "sse2")]
#[cfg_attr(test, assert_instr(movaps))]
#[cfg_attr(
all(test, not(all(target_arch = "x86", target_env = "msvc"))),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_loadr_pd(mem_addr: *const f64) -> __m128d {
let a = _mm_load_pd(mem_addr);