Skip to content

Commit

Permalink
clang-cl: use /arch:SSE2 for x86 target arch (#1425)
Browse files Browse the repository at this point in the history
- Official Rust Windows targets require `SSE2` as part of baseline
  target features.
    - `i586` Windows target without SSE2 is in process of being removed,
      so wasn't changed in this commit.
- STL is built with `/arch:SSE2` and no longer `/arch:IA32` since
  <microsoft/STL#4741>.

This was noticed in rust-lang/rust CI for `i686-pc-windows-msvc`, where
`rustc_llvm` builds failed because `__m128i` wasn't available, and we
suspected it was due to `/arch:IA32`.
  • Loading branch information
jieyouxu authored Feb 27, 2025
1 parent 8ea5e95 commit 9131f33
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2224,7 +2224,16 @@ impl Build {
cmd.push_cc_arg("-m64".into());
} else if target.arch == "x86" {
cmd.push_cc_arg("-m32".into());
cmd.push_cc_arg("-arch:IA32".into());
// See
// <https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170>.
//
// NOTE: Rust officially supported Windows targets all require SSE2 as part
// of baseline target features.
//
// NOTE: The same applies for STL. See: -
// <https://github.com/microsoft/STL/issues/3922>, and -
// <https://github.com/microsoft/STL/pull/4741>.
cmd.push_cc_arg("-arch:SSE2".into());
} else {
cmd.push_cc_arg(format!("--target={}", target.llvm_target).into());
}
Expand Down

0 comments on commit 9131f33

Please sign in to comment.