Skip to content

Commit

Permalink
Rollup merge of rust-lang#128700 - Oneirical:i-ffind-these-tests-quit…
Browse files Browse the repository at this point in the history
…e-simdple, r=jieyouxu

Migrate `simd-ffi` `run-make` test to rmake

Part of rust-lang#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
  • Loading branch information
tgross35 authored Aug 7, 2024
2 parents fc593bf + 1054054 commit 76169ec
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 48 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ run-make/pgo-indirect-call-promotion/Makefile
run-make/remap-path-prefix-dwarf/Makefile
run-make/reproducible-build/Makefile
run-make/rlib-format-packed-bundled-libs/Makefile
run-make/simd-ffi/Makefile
run-make/split-debuginfo/Makefile
run-make/staticlib-dylib-linkage/Makefile
run-make/symbol-mangling-hashed/Makefile
Expand Down
47 changes: 0 additions & 47 deletions tests/run-make/simd-ffi/Makefile

This file was deleted.

63 changes: 63 additions & 0 deletions tests/run-make/simd-ffi/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Using SIMD types in a program with foreign-function interfaces used to result in an ICE
// (internal compiler error). Since this was fixed in #21233, it should be checked that
// compilation of SIMD and FFI together should be successful on all the most common
// architectures.
// Note that this test does not check linking or binary execution.
// See https://github.com/rust-lang/rust/pull/21233

use run_make_support::{llvm_components_contain, rustc};

fn main() {
let mut targets = Vec::new();
// arm-specific targets.
if llvm_components_contain("arm") {
targets.append(&mut vec![
"arm-linux-androideabi".to_owned(),
"arm-unknown-linux-gnueabihf".to_owned(),
"arm-unknown-linux-gnueabi".to_owned(),
]);
}
let mut x86_archs = Vec::new();
if llvm_components_contain("x86") {
x86_archs.append(&mut vec!["i686", "x86_64"]);
}
// Linux has all x86 targets, plus aarch64 and mips.
let mut extra_targets = x86_archs.clone();
if llvm_components_contain("aarch64") {
extra_targets.push("aarch64");
}
if llvm_components_contain("mips") {
extra_targets.append(&mut vec!["mips", "mipsel"]);
}

for target in extra_targets {
let linux = format!("{target}-unknown-linux-gnu");
targets.push(linux);
}

// Windows and Darwin (OSX) only receive x86 targets.
let extra_targets = x86_archs.clone();
for target in extra_targets {
let windows = format!("{target}-pc-windows-gnu");
let darwin = format!("{target}-apple-darwin");
targets.push(windows);
targets.push(darwin);
}

for target in targets {
// compile the rust file to the given target, but only to asm and IR
// form, to avoid having to have an appropriate linker.
//
// we need some features because the integer SIMD instructions are not
// enabled by-default for i686 and ARM; these features will be invalid
// on some platforms, but LLVM just prints a warning so that's fine for
// now.
rustc()
.target(&target)
.emit("llvm-ir,asm")
.input("simd.rs")
.arg("-Ctarget-feature=+neon,+sse")
.arg(&format!("-Cextra-filename=-{target}"))
.run();
}
}

0 comments on commit 76169ec

Please sign in to comment.