Skip to content

Commit 3573dd1

Browse files
authored
Run CI for i686-pc-windows-msvc (#934)
1 parent 9142a8a commit 3573dd1

File tree

5 files changed

+88
-56
lines changed

5 files changed

+88
-56
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ jobs:
9696

9797
# Windows targets
9898
- x86_64-pc-windows-msvc
99+
- i686-pc-windows-msvc
99100
# FIXME: Disassembly not implemented for the # following targets:
100101
# - x86_64-pc-windows-gnu:
101102
# - i686-pc-windows-gnu:
102-
# - i686-pc-windows-msvc:
103+
# - aarch64-pc-windows-msvc:
103104

104105
include:
105106
- target: i686-unknown-linux-gnu
@@ -137,6 +138,8 @@ jobs:
137138
os: macos-latest
138139
- target: x86_64-pc-windows-msvc
139140
os: windows-latest
141+
- target: i686-pc-windows-msvc
142+
os: windows-latest
140143
- target: i586-unknown-linux-gnu
141144
os: ubuntu-latest
142145
- target: x86_64-linux-android

ci/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ set -ex
1313
RUSTFLAGS="$RUSTFLAGS -D warnings "
1414

1515
case ${TARGET} in
16+
*-pc-windows-msvc)
17+
;;
1618
# On 32-bit use a static relocation model which avoids some extra
1719
# instructions when dealing with static data, notably allowing some
1820
# instruction assertion checks to pass below the 20 instruction limit. If

crates/core_arch/src/x86/sse.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -957,9 +957,15 @@ pub unsafe fn _mm_set_ps(a: f32, b: f32, c: f32, d: f32) -> __m128 {
957957
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_setr_ps)
958958
#[inline]
959959
#[target_feature(enable = "sse")]
960-
#[cfg_attr(all(test, target_arch = "x86_64"), assert_instr(unpcklps))]
961-
// On a 32-bit architecture it just copies the operands from the stack.
962-
#[cfg_attr(all(test, target_arch = "x86"), assert_instr(movaps))]
960+
#[cfg_attr(
961+
all(test, any(target_os = "windows", target_arch = "x86_64")),
962+
assert_instr(unpcklps)
963+
)]
964+
// On a 32-bit architecture on non-Windows it just copies the operands from the stack.
965+
#[cfg_attr(
966+
all(test, all(not(target_os = "windows"), target_arch = "x86")),
967+
assert_instr(movaps)
968+
)]
963969
#[stable(feature = "simd_x86", since = "1.27.0")]
964970
pub unsafe fn _mm_setr_ps(a: f32, b: f32, c: f32, d: f32) -> __m128 {
965971
__m128(a, b, c, d)

crates/core_arch/src/x86/sse2.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,8 +2812,14 @@ pub unsafe fn _mm_loadu_pd(mem_addr: *const f64) -> __m128d {
28122812
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_pd)
28132813
#[inline]
28142814
#[target_feature(enable = "sse2")]
2815-
#[cfg_attr(all(test, not(target_os = "windows")), assert_instr(shufps, imm8 = 1))]
2816-
#[cfg_attr(all(test, target_os = "windows"), assert_instr(shufpd, imm8 = 1))]
2815+
#[cfg_attr(
2816+
all(test, any(not(target_os = "windows"), target_arch = "x86")),
2817+
assert_instr(shufps, imm8 = 1)
2818+
)]
2819+
#[cfg_attr(
2820+
all(test, all(target_os = "windows", target_arch = "x86_64")),
2821+
assert_instr(shufpd, imm8 = 1)
2822+
)]
28172823
#[rustc_args_required_const(2)]
28182824
#[stable(feature = "simd_x86", since = "1.27.0")]
28192825
pub unsafe fn _mm_shuffle_pd(a: __m128d, b: __m128d, imm8: i32) -> __m128d {
@@ -2832,8 +2838,14 @@ pub unsafe fn _mm_shuffle_pd(a: __m128d, b: __m128d, imm8: i32) -> __m128d {
28322838
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_move_sd)
28332839
#[inline]
28342840
#[target_feature(enable = "sse2")]
2835-
#[cfg_attr(all(test, not(target_os = "windows")), assert_instr(movsd))]
2836-
#[cfg_attr(all(test, target_os = "windows"), assert_instr(movlps))]
2841+
#[cfg_attr(
2842+
all(test, any(not(target_os = "windows"), target_arch = "x86")),
2843+
assert_instr(movsd)
2844+
)]
2845+
#[cfg_attr(
2846+
all(test, all(target_os = "windows", target_arch = "x86_64")),
2847+
assert_instr(movlps)
2848+
)]
28372849
#[stable(feature = "simd_x86", since = "1.27.0")]
28382850
pub unsafe fn _mm_move_sd(a: __m128d, b: __m128d) -> __m128d {
28392851
_mm_setr_pd(simd_extract(b, 0), simd_extract(a, 1))

crates/stdarch-test/src/disassembly.rs

Lines changed: 57 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -32,62 +32,71 @@ fn normalize(mut symbol: &str) -> String {
3232
while symbol.starts_with('_') {
3333
symbol.remove(0);
3434
}
35+
// Windows/x86 has a suffix such as @@4.
36+
if let Some(idx) = symbol.find("@@") {
37+
symbol = (&symbol[..idx]).to_string();
38+
}
3539
symbol
3640
}
3741

3842
pub(crate) fn disassemble_myself() -> HashSet<Function> {
3943
let me = env::current_exe().expect("failed to get current exe");
4044

41-
let disassembly =
42-
if cfg!(target_arch = "x86_64") && cfg!(target_os = "windows") && cfg!(target_env = "msvc")
43-
{
44-
let mut cmd = cc::windows_registry::find("x86_64-pc-windows-msvc", "dumpbin.exe")
45-
.expect("failed to find `dumpbin` tool");
46-
let output = cmd
47-
.arg("/DISASM")
48-
.arg(&me)
49-
.output()
50-
.expect("failed to execute dumpbin");
51-
println!(
52-
"{}\n{}",
53-
output.status,
54-
String::from_utf8_lossy(&output.stderr)
55-
);
56-
assert!(output.status.success());
57-
// Windows does not return valid UTF-8 output:
58-
String::from_utf8_lossy(Vec::leak(output.stdout))
59-
} else if cfg!(target_os = "windows") {
60-
panic!("disassembly unimplemented")
61-
} else if cfg!(target_os = "macos") {
62-
let output = Command::new("otool")
63-
.arg("-vt")
64-
.arg(&me)
65-
.output()
66-
.expect("failed to execute otool");
67-
println!(
68-
"{}\n{}",
69-
output.status,
70-
String::from_utf8_lossy(&output.stderr)
71-
);
72-
assert!(output.status.success());
73-
74-
String::from_utf8_lossy(Vec::leak(output.stdout))
45+
let disassembly = if cfg!(target_os = "windows") && cfg!(target_env = "msvc") {
46+
let target = if cfg!(target_arch = "x86_64") {
47+
"x86_64-pc-windows-msvc"
48+
} else if cfg!(target_arch = "x86") {
49+
"i686-pc-windows-msvc"
7550
} else {
76-
let objdump = env::var("OBJDUMP").unwrap_or_else(|_| "objdump".to_string());
77-
let output = Command::new(objdump.clone())
78-
.arg("--disassemble")
79-
.arg(&me)
80-
.output()
81-
.unwrap_or_else(|_| panic!("failed to execute objdump. OBJDUMP={}", objdump));
82-
println!(
83-
"{}\n{}",
84-
output.status,
85-
String::from_utf8_lossy(&output.stderr)
86-
);
87-
assert!(output.status.success());
88-
89-
String::from_utf8_lossy(Vec::leak(output.stdout))
51+
panic!("disassembly unimplemented")
9052
};
53+
let mut cmd = cc::windows_registry::find(target, "dumpbin.exe")
54+
.expect("failed to find `dumpbin` tool");
55+
let output = cmd
56+
.arg("/DISASM")
57+
.arg(&me)
58+
.output()
59+
.expect("failed to execute dumpbin");
60+
println!(
61+
"{}\n{}",
62+
output.status,
63+
String::from_utf8_lossy(&output.stderr)
64+
);
65+
assert!(output.status.success());
66+
// Windows does not return valid UTF-8 output:
67+
String::from_utf8_lossy(Vec::leak(output.stdout))
68+
} else if cfg!(target_os = "windows") {
69+
panic!("disassembly unimplemented")
70+
} else if cfg!(target_os = "macos") {
71+
let output = Command::new("otool")
72+
.arg("-vt")
73+
.arg(&me)
74+
.output()
75+
.expect("failed to execute otool");
76+
println!(
77+
"{}\n{}",
78+
output.status,
79+
String::from_utf8_lossy(&output.stderr)
80+
);
81+
assert!(output.status.success());
82+
83+
String::from_utf8_lossy(Vec::leak(output.stdout))
84+
} else {
85+
let objdump = env::var("OBJDUMP").unwrap_or_else(|_| "objdump".to_string());
86+
let output = Command::new(objdump.clone())
87+
.arg("--disassemble")
88+
.arg(&me)
89+
.output()
90+
.unwrap_or_else(|_| panic!("failed to execute objdump. OBJDUMP={}", objdump));
91+
println!(
92+
"{}\n{}",
93+
output.status,
94+
String::from_utf8_lossy(&output.stderr)
95+
);
96+
assert!(output.status.success());
97+
98+
String::from_utf8_lossy(Vec::leak(output.stdout))
99+
};
91100

92101
parse(&disassembly)
93102
}

0 commit comments

Comments
 (0)