-
Notifications
You must be signed in to change notification settings - Fork 272
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
Reimplement some x86 intrinsics without arch-specific LLVM intrinsics #1463
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
…e_unaligned` instead of LLVM intrinsics
…r}` instead of LLVM intrinsics
…r}` instead of LLVM intrinsics
…hl` instead of LLVM intrinsics
…hl` instead of LLVM intrinsics
…hr` instead of LLVM intrinsics
…hr` instead of LLVM intrinsics
…hr` instead of LLVM intrinsics
…hr` instead of LLVM intrinsics
…shl` instead of LLVM intrinsics
…shr` instead of LLVM intrinsics
…shr` instead of LLVM intrinsics
r? @Amanieu (rustbot has picked a reviewer for you, use r? to override) |
Amanieu
reviewed
Aug 29, 2023
crates/core_arch/src/x86/sse2.rs
Outdated
@@ -732,7 +752,11 @@ pub unsafe fn _mm_srl_epi32(a: __m128i, count: __m128i) -> __m128i { | |||
#[stable(feature = "simd_x86", since = "1.27.0")] | |||
pub unsafe fn _mm_srli_epi64<const IMM8: i32>(a: __m128i) -> __m128i { | |||
static_assert_uimm_bits!(IMM8, 8); | |||
transmute(psrliq(a.as_i64x2(), IMM8)) | |||
if IMM8 >= 32 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be 64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 6, 2023
…dtwco,bjorn3 Update stdarch submodule and remove special handling in cranelift codegen for some AVX and SSE2 LLVM intrinsics rust-lang/stdarch#1463 reimplemented some x86 intrinsics to avoid using some x86-specific LLVM intrinsics: * Store unaligned (`_mm*_storeu_*`) use `<*mut _>::write_unaligned` instead of `llvm.x86.*.storeu.*`. * Shift by immediate (`_mm*_s{ll,rl,ra}i_epi*`) use `if` (srl, sll) or `min` (sra) to simulate the behaviour when the RHS is out of range. RHS is constant, so the `if`/`min` will be optimized away. This PR updates the stdarch submodule to pull these changes and removes special handling for those LLVM intrinsics from cranelift codegen. I left gcc codegen untouched because there are some autogenerated lists.
bjorn3
pushed a commit
to rust-lang/rustc_codegen_cranelift
that referenced
this pull request
Sep 7, 2023
Those were removed from stdarch in rust-lang/stdarch#1463 (`<*mut _>::write_unaligned` is used instead)
bjorn3
pushed a commit
to rust-lang/rustc_codegen_cranelift
that referenced
this pull request
Sep 7, 2023
…ediate intrinsics Those were removed from stdarch in rust-lang/stdarch#1463 (`simd_shl` and `simd_shr` are used instead)
bjorn3
pushed a commit
to rust-lang/rustc_codegen_cranelift
that referenced
this pull request
Sep 7, 2023
Update stdarch submodule and remove special handling in cranelift codegen for some AVX and SSE2 LLVM intrinsics rust-lang/stdarch#1463 reimplemented some x86 intrinsics to avoid using some x86-specific LLVM intrinsics: * Store unaligned (`_mm*_storeu_*`) use `<*mut _>::write_unaligned` instead of `llvm.x86.*.storeu.*`. * Shift by immediate (`_mm*_s{ll,rl,ra}i_epi*`) use `if` (srl, sll) or `min` (sra) to simulate the behaviour when the RHS is out of range. RHS is constant, so the `if`/`min` will be optimized away. This PR updates the stdarch submodule to pull these changes and removes special handling for those LLVM intrinsics from cranelift codegen. I left gcc codegen untouched because there are some autogenerated lists.
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.
Reimplements some x86 without using arch-specific LLVM intrinsics:
_mm*_storeu_*
): Use<*mut _>::write_unaligned
instead ofllvm.x86.*.storeu.*
._mm*_s{ll,rl,ra}i_epi*
): Useif
(srl, sll) ormin
(sra) to simulate the behaviour when the RHS is out of range. RHS is constant, so theif
/min
will be optimized away.The advantages are: