Skip to content

Commit 993c8d9

Browse files
committed
make x86-64 asm more consistent
1 parent 373a0de commit 993c8d9

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

ci/run.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ case ${TARGET} in
3333
# Some x86_64 targets enable by default more features beyond SSE2,
3434
# which cause some instruction assertion checks to fail.
3535
x86_64-*)
36-
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=-sse3"
36+
# We want frame pointers to be consistent across targets. On the ios_macabi target
37+
# we cannot turn them off, so let's turn them on everywhere.
38+
# If we ever turn these off, a bunch of `limit(...)` clauses should be reduced to
39+
# avoid tests becoming less strict!
40+
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=-sse3 -Cforce-frame-pointers=on"
3741
;;
3842
#Unoptimized build uses fast-isel which breaks with msa
3943
mips-* | mipsel-*)

crates/core_arch/src/x86/avx2.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,7 +2321,7 @@ pub const fn _mm256_or_si256(a: __m256i, b: __m256i) -> __m256i {
23212321
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_packs_epi16)
23222322
#[inline]
23232323
#[target_feature(enable = "avx2")]
2324-
#[cfg_attr(test, assert_instr(vpacksswb, limit(2)))]
2324+
#[cfg_attr(test, assert_instr(vpacksswb, limit(5)))]
23252325
#[stable(feature = "simd_x86", since = "1.27.0")]
23262326
pub fn _mm256_packs_epi16(a: __m256i, b: __m256i) -> __m256i {
23272327
unsafe { transmute(packsswb(a.as_i16x16(), b.as_i16x16())) }
@@ -2333,7 +2333,7 @@ pub fn _mm256_packs_epi16(a: __m256i, b: __m256i) -> __m256i {
23332333
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_packs_epi32)
23342334
#[inline]
23352335
#[target_feature(enable = "avx2")]
2336-
#[cfg_attr(test, assert_instr(vpackssdw, limit(2)))]
2336+
#[cfg_attr(test, assert_instr(vpackssdw, limit(5)))]
23372337
#[stable(feature = "simd_x86", since = "1.27.0")]
23382338
pub fn _mm256_packs_epi32(a: __m256i, b: __m256i) -> __m256i {
23392339
unsafe { transmute(packssdw(a.as_i32x8(), b.as_i32x8())) }
@@ -2345,7 +2345,7 @@ pub fn _mm256_packs_epi32(a: __m256i, b: __m256i) -> __m256i {
23452345
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_packus_epi16)
23462346
#[inline]
23472347
#[target_feature(enable = "avx2")]
2348-
#[cfg_attr(test, assert_instr(vpackuswb, limit(2)))]
2348+
#[cfg_attr(test, assert_instr(vpackuswb, limit(5)))]
23492349
#[stable(feature = "simd_x86", since = "1.27.0")]
23502350
pub fn _mm256_packus_epi16(a: __m256i, b: __m256i) -> __m256i {
23512351
unsafe { transmute(packuswb(a.as_i16x16(), b.as_i16x16())) }
@@ -2357,7 +2357,7 @@ pub fn _mm256_packus_epi16(a: __m256i, b: __m256i) -> __m256i {
23572357
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_packus_epi32)
23582358
#[inline]
23592359
#[target_feature(enable = "avx2")]
2360-
#[cfg_attr(test, assert_instr(vpackusdw, limit(2)))]
2360+
#[cfg_attr(test, assert_instr(vpackusdw, limit(5)))]
23612361
#[stable(feature = "simd_x86", since = "1.27.0")]
23622362
pub fn _mm256_packus_epi32(a: __m256i, b: __m256i) -> __m256i {
23632363
unsafe { transmute(packusdw(a.as_i32x8(), b.as_i32x8())) }

crates/core_arch/src/x86/sse2.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ pub const fn _mm_move_epi64(a: __m128i) -> __m128i {
14961496
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_packs_epi16)
14971497
#[inline]
14981498
#[target_feature(enable = "sse2")]
1499-
#[cfg_attr(test, assert_instr(packsswb, limit(2), not(pminsw), not(pmaxsw)))]
1499+
#[cfg_attr(test, assert_instr(packsswb, limit(5), not(pminsw), not(pmaxsw)))]
15001500
#[stable(feature = "simd_x86", since = "1.27.0")]
15011501
pub fn _mm_packs_epi16(a: __m128i, b: __m128i) -> __m128i {
15021502
unsafe { transmute(packsswb(a.as_i16x8(), b.as_i16x8())) }
@@ -1508,7 +1508,7 @@ pub fn _mm_packs_epi16(a: __m128i, b: __m128i) -> __m128i {
15081508
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_packs_epi32)
15091509
#[inline]
15101510
#[target_feature(enable = "sse2")]
1511-
#[cfg_attr(test, assert_instr(packssdw, limit(2)))]
1511+
#[cfg_attr(test, assert_instr(packssdw, limit(5)))]
15121512
#[stable(feature = "simd_x86", since = "1.27.0")]
15131513
pub fn _mm_packs_epi32(a: __m128i, b: __m128i) -> __m128i {
15141514
unsafe { transmute(packssdw(a.as_i32x4(), b.as_i32x4())) }
@@ -1520,7 +1520,7 @@ pub fn _mm_packs_epi32(a: __m128i, b: __m128i) -> __m128i {
15201520
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_packus_epi16)
15211521
#[inline]
15221522
#[target_feature(enable = "sse2")]
1523-
#[cfg_attr(test, assert_instr(packuswb, limit(2), not(pminsw), not(pmaxsw)))]
1523+
#[cfg_attr(test, assert_instr(packuswb, limit(5), not(pminsw), not(pmaxsw)))]
15241524
#[stable(feature = "simd_x86", since = "1.27.0")]
15251525
pub fn _mm_packus_epi16(a: __m128i, b: __m128i) -> __m128i {
15261526
unsafe { transmute(packuswb(a.as_i16x8(), b.as_i16x8())) }

crates/core_arch/src/x86/sse41.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ pub const fn _mm_min_epu32(a: __m128i, b: __m128i) -> __m128i {
424424
/// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_packus_epi32)
425425
#[inline]
426426
#[target_feature(enable = "sse4.1")]
427-
#[cfg_attr(test, assert_instr(packusdw, limit(2)))]
427+
#[cfg_attr(test, assert_instr(packusdw, limit(5)))]
428428
#[stable(feature = "simd_x86", since = "1.27.0")]
429429
pub fn _mm_packus_epi32(a: __m128i, b: __m128i) -> __m128i {
430430
unsafe { transmute(packusdw(a.as_i32x4(), b.as_i32x4())) }

0 commit comments

Comments
 (0)