Skip to content

Commit edc58d0

Browse files
authored
Rollup merge of #128700 - Oneirical:i-ffind-these-tests-quite-simdple, r=jieyouxu
Migrate `simd-ffi` `run-make` test to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc try-job: x86_64-mingw try-job: i686-msvc try-job: armhf-gnu try-job: test-various try-job: aarch64-apple try-job: x86_64-gnu-llvm-17
2 parents e9337da + 1054054 commit edc58d0

File tree

3 files changed

+63
-48
lines changed

3 files changed

+63
-48
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ run-make/redundant-libs/Makefile
2626
run-make/remap-path-prefix-dwarf/Makefile
2727
run-make/reproducible-build/Makefile
2828
run-make/rlib-format-packed-bundled-libs/Makefile
29-
run-make/simd-ffi/Makefile
3029
run-make/split-debuginfo/Makefile
3130
run-make/staticlib-dylib-linkage/Makefile
3231
run-make/symbol-mangling-hashed/Makefile

tests/run-make/simd-ffi/Makefile

-47
This file was deleted.

tests/run-make/simd-ffi/rmake.rs

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Using SIMD types in a program with foreign-function interfaces used to result in an ICE
2+
// (internal compiler error). Since this was fixed in #21233, it should be checked that
3+
// compilation of SIMD and FFI together should be successful on all the most common
4+
// architectures.
5+
// Note that this test does not check linking or binary execution.
6+
// See https://github.com/rust-lang/rust/pull/21233
7+
8+
use run_make_support::{llvm_components_contain, rustc};
9+
10+
fn main() {
11+
let mut targets = Vec::new();
12+
// arm-specific targets.
13+
if llvm_components_contain("arm") {
14+
targets.append(&mut vec![
15+
"arm-linux-androideabi".to_owned(),
16+
"arm-unknown-linux-gnueabihf".to_owned(),
17+
"arm-unknown-linux-gnueabi".to_owned(),
18+
]);
19+
}
20+
let mut x86_archs = Vec::new();
21+
if llvm_components_contain("x86") {
22+
x86_archs.append(&mut vec!["i686", "x86_64"]);
23+
}
24+
// Linux has all x86 targets, plus aarch64 and mips.
25+
let mut extra_targets = x86_archs.clone();
26+
if llvm_components_contain("aarch64") {
27+
extra_targets.push("aarch64");
28+
}
29+
if llvm_components_contain("mips") {
30+
extra_targets.append(&mut vec!["mips", "mipsel"]);
31+
}
32+
33+
for target in extra_targets {
34+
let linux = format!("{target}-unknown-linux-gnu");
35+
targets.push(linux);
36+
}
37+
38+
// Windows and Darwin (OSX) only receive x86 targets.
39+
let extra_targets = x86_archs.clone();
40+
for target in extra_targets {
41+
let windows = format!("{target}-pc-windows-gnu");
42+
let darwin = format!("{target}-apple-darwin");
43+
targets.push(windows);
44+
targets.push(darwin);
45+
}
46+
47+
for target in targets {
48+
// compile the rust file to the given target, but only to asm and IR
49+
// form, to avoid having to have an appropriate linker.
50+
//
51+
// we need some features because the integer SIMD instructions are not
52+
// enabled by-default for i686 and ARM; these features will be invalid
53+
// on some platforms, but LLVM just prints a warning so that's fine for
54+
// now.
55+
rustc()
56+
.target(&target)
57+
.emit("llvm-ir,asm")
58+
.input("simd.rs")
59+
.arg("-Ctarget-feature=+neon,+sse")
60+
.arg(&format!("-Cextra-filename=-{target}"))
61+
.run();
62+
}
63+
}

0 commit comments

Comments
 (0)