-
Notifications
You must be signed in to change notification settings - Fork 0
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
compiler-rt: alu: add saturated shift left for i8 #134 #140
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
c64abd4
to
ab78024
Compare
Remove the custom implementation for 128-bit inputs, as it's enough to use overflowing multiplication in the generic implementation. All tests pass. Signed-off-by: Wojciech Zmuda <[email protected]>
The test is considered passed at the very first panic that occurs. Remove the array of test cases and leave just one case, because the other cases did not participate in the test. Signed-off-by: Wojciech Zmuda <[email protected]>
ab78024
to
eb48b0b
Compare
iamrecursion
requested changes
Feb 10, 2025
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.
Looks good, but I have some very crucial asks for documentation.
wzmuda
commented
Feb 10, 2025
Implement the following polyfill: - `__llvm_ushl_sat_i8_i8` Signed-off-by: Wojciech Zmuda <[email protected]>
Sign extension is useful when dealing with signed version of polyfills so move it from a closure to a public function so it can be accessed elsewhere. Signed-off-by: Wojciech Zmuda <[email protected]>
Implement the following polyfill: - `__llvm_sshl_sat_i8_i8` Signed-off-by: Wojciech Zmuda <[email protected]>
eb48b0b
to
e9312da
Compare
iamrecursion
approved these changes
Feb 10, 2025
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.
LGTM!
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.
Summary
Implement the following polyfills:
__llvm_ushl_sat_i8_i8
__llvm_sshl_sat_i8_i8
Also do some minor refactoring:
ashr
for i8 had unnecessarily complicated negative test case, so simplify it,shl
for i128 has unnecessary complicated implementation, so simplify it,smul
.Details
I couldn't figure out how
llvm.sshl.sat.i8
actually works so I wrote this small program to generate test cases and then I figured out the logic based on them. I did the same trick for the unsigned version to validate my understanding too.Checklist
scarb fmt
.