-
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
Implement rotate using funnel shift on LLVM >= 7 #55650
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
FWIW the codegen on everything but x86 is abysmal with this intrinsic. It might be prudent to wait a little until intrinsic codegen is fixed in other backends. I’ll look at how hard is it to make a patch for ARM/PPC backends in LLVM… r? @nagisa |
@nagisa Is that still the case? There were some changes in August to lower to ROTL/ROTR (if legal) during selectiondag construction (llvm-mirror/llvm@8fe02fa, llvm-mirror/llvm@3d464de). |
Ah, I was looking at the wrong thing. The targets I was looking at do not support byte-size rotate, and I was looking at exactly that. |
@bors r+ |
📌 Commit 0fb2367c0fd57c9cbc3cee065e1a6f687585c4d5 has been approved by |
@bors r- r=me after the constant evaluation code is adjusted to calculate the rotation directly instead of emulating the rotation algorithm. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore.
@bors r=nagisa |
📌 Commit 4c40ff6 has been approved by |
Implement rotate using funnel shift on LLVM >= 7 Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore. Fixes rust-lang#52457.
Implement rotate using funnel shift on LLVM >= 7 Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore. Fixes #52457.
☀️ Test successful - status-appveyor, status-travis |
Implement the rotate_left and rotate_right operations using
llvm.fshl and llvm.fshr if they are available (LLVM >= 7).
Originally I wanted to expose the funnel_shift_left and
funnel_shift_right intrinsics and implement rotate_left and
rotate_right on top of them. However, emulation of funnel
shifts requires emitting a conditional to check for zero shift
amount, which is not necessary for rotates. I was uncomfortable
doing that here, as I don't want to rely on LLVM to optimize
away that conditional (and for variable rotates, I'm not sure it
can). We should revisit that question when we raise our minimum
version requirement to LLVM 7 and don't need emulation code
anymore.
Fixes #52457.