Skip to content

Commit 6225631

Browse files
authored
Force the use of sysv64 calling convention in x86_64 disassembly tests (rust-lang#1187)
This ensures that results are consistent across windows/linux tests.
1 parent 74275ae commit 6225631

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

crates/assert-instr-macro/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ pub fn assert_instr(
114114
// Use an ABI on Windows that passes SIMD values in registers, like what
115115
// happens on Unix (I think?) by default.
116116
let abi = if cfg!(windows) {
117-
syn::LitStr::new("vectorcall", proc_macro2::Span::call_site())
117+
let target = std::env::var("TARGET").unwrap();
118+
if target.contains("x86_64") {
119+
syn::LitStr::new("sysv64", proc_macro2::Span::call_site())
120+
} else {
121+
syn::LitStr::new("vectorcall", proc_macro2::Span::call_site())
122+
}
118123
} else {
119124
syn::LitStr::new("C", proc_macro2::Span::call_site())
120125
};

crates/core_arch/src/x86/sse2.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,14 +2642,7 @@ pub unsafe fn _mm_loadu_pd(mem_addr: *const f64) -> __m128d {
26422642
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_pd)
26432643
#[inline]
26442644
#[target_feature(enable = "sse2")]
2645-
#[cfg_attr(
2646-
all(test, any(not(target_os = "windows"), target_arch = "x86")),
2647-
cfg_attr(test, assert_instr(shufps, MASK = 2)) // FIXME shufpd expected
2648-
)]
2649-
#[cfg_attr(
2650-
all(test, all(target_os = "windows", target_arch = "x86_64")),
2651-
cfg_attr(test, assert_instr(shufpd, MASK = 1))
2652-
)]
2645+
#[cfg_attr(test, assert_instr(shufps, MASK = 2))]
26532646
#[rustc_legacy_const_generics(2)]
26542647
#[stable(feature = "simd_x86", since = "1.27.0")]
26552648
pub unsafe fn _mm_shuffle_pd<const MASK: i32>(a: __m128d, b: __m128d) -> __m128d {
@@ -2664,14 +2657,7 @@ pub unsafe fn _mm_shuffle_pd<const MASK: i32>(a: __m128d, b: __m128d) -> __m128d
26642657
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_move_sd)
26652658
#[inline]
26662659
#[target_feature(enable = "sse2")]
2667-
#[cfg_attr(
2668-
all(test, any(not(target_os = "windows"), target_arch = "x86")),
2669-
assert_instr(movsd)
2670-
)]
2671-
#[cfg_attr(
2672-
all(test, all(target_os = "windows", target_arch = "x86_64")),
2673-
assert_instr(movlps)
2674-
)]
2660+
#[cfg_attr(test, assert_instr(movsd))]
26752661
#[stable(feature = "simd_x86", since = "1.27.0")]
26762662
pub unsafe fn _mm_move_sd(a: __m128d, b: __m128d) -> __m128d {
26772663
_mm_setr_pd(simd_extract(b, 0), simd_extract(a, 1))

0 commit comments

Comments
 (0)