Skip to content

Run CI for i686-pc-windows-msvc #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ jobs:

# Windows targets
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
# FIXME: Disassembly not implemented for the # following targets:
# - x86_64-pc-windows-gnu:
# - i686-pc-windows-gnu:
# - i686-pc-windows-msvc:
# - aarch64-pc-windows-msvc:

include:
- target: i686-unknown-linux-gnu
Expand Down Expand Up @@ -137,6 +138,8 @@ jobs:
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: i686-pc-windows-msvc
os: windows-latest
- target: i586-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-linux-android
Expand Down
2 changes: 2 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ set -ex
RUSTFLAGS="$RUSTFLAGS -D warnings "

case ${TARGET} in
*-pc-windows-msvc)
;;
# On 32-bit use a static relocation model which avoids some extra
# instructions when dealing with static data, notably allowing some
# instruction assertion checks to pass below the 20 instruction limit. If
Expand Down
12 changes: 9 additions & 3 deletions crates/core_arch/src/x86/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,15 @@ pub unsafe fn _mm_set_ps(a: f32, b: f32, c: f32, d: f32) -> __m128 {
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_setr_ps)
#[inline]
#[target_feature(enable = "sse")]
#[cfg_attr(all(test, target_arch = "x86_64"), assert_instr(unpcklps))]
// On a 32-bit architecture it just copies the operands from the stack.
#[cfg_attr(all(test, target_arch = "x86"), assert_instr(movaps))]
#[cfg_attr(
all(test, any(target_os = "windows", target_arch = "x86_64")),
assert_instr(unpcklps)
)]
// On a 32-bit architecture on non-Windows it just copies the operands from the stack.
#[cfg_attr(
all(test, all(not(target_os = "windows"), target_arch = "x86")),
assert_instr(movaps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_setr_ps(a: f32, b: f32, c: f32, d: f32) -> __m128 {
__m128(a, b, c, d)
Expand Down
20 changes: 16 additions & 4 deletions crates/core_arch/src/x86/sse2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2812,8 +2812,14 @@ pub unsafe fn _mm_loadu_pd(mem_addr: *const f64) -> __m128d {
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_pd)
#[inline]
#[target_feature(enable = "sse2")]
#[cfg_attr(all(test, not(target_os = "windows")), assert_instr(shufps, imm8 = 1))]
#[cfg_attr(all(test, target_os = "windows"), assert_instr(shufpd, imm8 = 1))]
#[cfg_attr(
all(test, any(not(target_os = "windows"), target_arch = "x86")),
assert_instr(shufps, imm8 = 1)
)]
#[cfg_attr(
all(test, all(target_os = "windows", target_arch = "x86_64")),
assert_instr(shufpd, imm8 = 1)
)]
#[rustc_args_required_const(2)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_shuffle_pd(a: __m128d, b: __m128d, imm8: i32) -> __m128d {
Expand All @@ -2832,8 +2838,14 @@ pub unsafe fn _mm_shuffle_pd(a: __m128d, b: __m128d, imm8: i32) -> __m128d {
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_move_sd)
#[inline]
#[target_feature(enable = "sse2")]
#[cfg_attr(all(test, not(target_os = "windows")), assert_instr(movsd))]
#[cfg_attr(all(test, target_os = "windows"), assert_instr(movlps))]
#[cfg_attr(
all(test, any(not(target_os = "windows"), target_arch = "x86")),
assert_instr(movsd)
)]
#[cfg_attr(
all(test, all(target_os = "windows", target_arch = "x86_64")),
assert_instr(movlps)
)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_move_sd(a: __m128d, b: __m128d) -> __m128d {
_mm_setr_pd(simd_extract(b, 0), simd_extract(a, 1))
Expand Down
105 changes: 57 additions & 48 deletions crates/stdarch-test/src/disassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,62 +32,71 @@ fn normalize(mut symbol: &str) -> String {
while symbol.starts_with('_') {
symbol.remove(0);
}
// Windows/x86 has a suffix such as @@4.
if let Some(idx) = symbol.find("@@") {
symbol = (&symbol[..idx]).to_string();
}
symbol
}

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

let disassembly =
if cfg!(target_arch = "x86_64") && cfg!(target_os = "windows") && cfg!(target_env = "msvc")
{
let mut cmd = cc::windows_registry::find("x86_64-pc-windows-msvc", "dumpbin.exe")
.expect("failed to find `dumpbin` tool");
let output = cmd
.arg("/DISASM")
.arg(&me)
.output()
.expect("failed to execute dumpbin");
println!(
"{}\n{}",
output.status,
String::from_utf8_lossy(&output.stderr)
);
assert!(output.status.success());
// Windows does not return valid UTF-8 output:
String::from_utf8_lossy(Vec::leak(output.stdout))
} else if cfg!(target_os = "windows") {
panic!("disassembly unimplemented")
} else if cfg!(target_os = "macos") {
let output = Command::new("otool")
.arg("-vt")
.arg(&me)
.output()
.expect("failed to execute otool");
println!(
"{}\n{}",
output.status,
String::from_utf8_lossy(&output.stderr)
);
assert!(output.status.success());

String::from_utf8_lossy(Vec::leak(output.stdout))
let disassembly = if cfg!(target_os = "windows") && cfg!(target_env = "msvc") {
let target = if cfg!(target_arch = "x86_64") {
"x86_64-pc-windows-msvc"
} else if cfg!(target_arch = "x86") {
"i686-pc-windows-msvc"
} else {
let objdump = env::var("OBJDUMP").unwrap_or_else(|_| "objdump".to_string());
let output = Command::new(objdump.clone())
.arg("--disassemble")
.arg(&me)
.output()
.unwrap_or_else(|_| panic!("failed to execute objdump. OBJDUMP={}", objdump));
println!(
"{}\n{}",
output.status,
String::from_utf8_lossy(&output.stderr)
);
assert!(output.status.success());

String::from_utf8_lossy(Vec::leak(output.stdout))
panic!("disassembly unimplemented")
};
let mut cmd = cc::windows_registry::find(target, "dumpbin.exe")
.expect("failed to find `dumpbin` tool");
let output = cmd
.arg("/DISASM")
.arg(&me)
.output()
.expect("failed to execute dumpbin");
println!(
"{}\n{}",
output.status,
String::from_utf8_lossy(&output.stderr)
);
assert!(output.status.success());
// Windows does not return valid UTF-8 output:
String::from_utf8_lossy(Vec::leak(output.stdout))
} else if cfg!(target_os = "windows") {
panic!("disassembly unimplemented")
} else if cfg!(target_os = "macos") {
let output = Command::new("otool")
.arg("-vt")
.arg(&me)
.output()
.expect("failed to execute otool");
println!(
"{}\n{}",
output.status,
String::from_utf8_lossy(&output.stderr)
);
assert!(output.status.success());

String::from_utf8_lossy(Vec::leak(output.stdout))
} else {
let objdump = env::var("OBJDUMP").unwrap_or_else(|_| "objdump".to_string());
let output = Command::new(objdump.clone())
.arg("--disassemble")
.arg(&me)
.output()
.unwrap_or_else(|_| panic!("failed to execute objdump. OBJDUMP={}", objdump));
println!(
"{}\n{}",
output.status,
String::from_utf8_lossy(&output.stderr)
);
assert!(output.status.success());

String::from_utf8_lossy(Vec::leak(output.stdout))
};

parse(&disassembly)
}
Expand Down