-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Migrate simd-ffi
run-make
test to rmake
#128700
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
bors
merged 1 commit into
rust-lang:master
from
Oneirical:i-ffind-these-tests-quite-simdple
Aug 7, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]); | ||
} | ||
jieyouxu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// 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(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.