-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Improve the support for SIMD vectors in FFI #21233
Merged
Merged
Conversation
This file contains 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 seems to work on x86-64, but I am not able to test on other platforms. cc rust-lang#20043
Unlike the intrinics in C, this types the SSE values base on integer size. This matches the LLVM intrinsics which have concrete vector types (`<4 x i32>` etc.), and is no loss of expressivity: if one is using a C function that really takes an untyped integral SSE value, just give it whatever Rust type makes most sense.
This seems to match what clang does on arm, but I cannot do any experimentation with mips, but it matches how the LLVM intrinsics are defined in any case...
r? @Aatch (rust_highfive has picked a reviewer for you, use r? to override) |
This just compiles a test using SIMD in FFI (mostly importing LLVM intrinsics) for almost all rustc's supported platforms, but not linking it or running it, so there's absolutely no guarantee that this is correct.
I don't know if this handling of SIMD types is correct for the C ABI on all platforms, so lets add an even finer feature gate than just the `simd` one. The `simd` one can be used with (relatively) little risk of complete nonsense, the reason for it is that it is likely that things will change. Using the types in FFI with an incorrect ABI will at best give absolute nonsense results, but possibly cause serious breakage too, so this is a step up in badness, hence a new feature gate.
bors
added a commit
that referenced
this pull request
Jan 17, 2015
This stops the compiler ICEing on the use of SIMD types in FFI signatures. It emits correct code for LLVM intrinsics, but I am quite unsure about the ABI handling in general so I've added a new feature gate `simd_ffi` to try to ensure people don't use it without realising there's a non-trivial risk of codegen brokenness. Closes #20043.
This was referenced Apr 20, 2015
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this pull request
Apr 24, 2015
As part of the audit for rust-lang#22820 the following duplicate feature gate tests were removed: * `box_patterns` * `simd_ffi` These tests for `box_patterns` and `simd_ffi` were added in rust-lang#23578, however there were existing tests in rust-lang#20723 and rust-lang#21233 respectively. r? @nrc
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this pull request
Apr 24, 2015
As part of the audit for rust-lang#22820 the following duplicate feature gate tests were removed: * `box_patterns` * `simd_ffi` These tests for `box_patterns` and `simd_ffi` were added in rust-lang#23578, however there were existing tests in rust-lang#20723 and rust-lang#21233 respectively. r? @nrc
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this pull request
Apr 25, 2015
As part of the audit for rust-lang#22820 the following duplicate feature gate tests were removed: * `box_patterns` * `simd_ffi` These tests for `box_patterns` and `simd_ffi` were added in rust-lang#23578, however there were existing tests in rust-lang#20723 and rust-lang#21233 respectively. r? @nrc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This stops the compiler ICEing on the use of SIMD types in FFI signatures. It emits correct code for LLVM intrinsics, but I am quite unsure about the ABI handling in general so I've added a new feature gate
simd_ffi
to try to ensure people don't use it without realising there's a non-trivial risk of codegen brokenness.Closes #20043.