-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Use LLVM intrinsics for saturating add/sub #58003
Conversation
The PR looks good, although I think I’d like a codegen test, especially for our own lowering. Alas we do not have @bors r+ |
📌 Commit 4a4186e has been approved by |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 4a4186e has been approved by |
Oh, and recalling one such similar PR, we had a fairly big perf. regression there: #56009. I wonder how this will fare... |
⌛ Testing commit 4a4186e with merge fc11513df6d91f6c2ea34c7e77844ed503e04d4d... |
💔 Test failed - status-appveyor |
@bors retry Failure looks spurious. |
Use LLVM intrinsics for saturating add/sub Use the `[su](add|sub).sat` LLVM intrinsics, if we're compiling against LLVM 8, as they should optimize and codegen better than IR based on `[su](add|sub).with.overlow`. For the fallback for LLVM < 8 I'm using the same expansion that target lowering in LLVM uses, which is not the same as Rust currently uses (in particular due to the use of selects rather than branches). Fixes #55286. Fixes #52203. Fixes #44500. r? @nagisa
☀️ Test successful - checks-travis, status-appveyor |
Tested on commit rust-lang/rust@8a0e5fa. Direct link to PR: <rust-lang/rust#58003> 💔 miri on windows: test-pass → test-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 miri on linux: test-pass → test-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).
Cool, these also should work on vector types. |
Use the
[su](add|sub).sat
LLVM intrinsics, if we're compiling against LLVM 8, as they should optimize and codegen better than IR based on[su](add|sub).with.overlow
.For the fallback for LLVM < 8 I'm using the same expansion that target lowering in LLVM uses, which is not the same as Rust currently uses (in particular due to the use of selects rather than branches).
Fixes #55286.
Fixes #52203.
Fixes #44500.
r? @nagisa