Merged
Conversation
Compiler Explorer comparison URL: https://rust.godbolt.org/z/9aE9dG8xx ```asm example::U31::checked_add::h0a14bb76814034a2: add edi, esi setb al test edi, edi setns cl not al and al, cl movzx eax, al mov edx, edi ret example::U31::saturating_add::h42559bf8f3c4f4ba: lea eax, [rdi + rsi] add edi, esi jb .LBB1_1 shr eax, 31 test al, al mov eax, 2147483647 cmove eax, edi ret .LBB1_1: mov al, 1 test al, al mov eax, 2147483647 cmove eax, edi ret example::U31::checked_mul::h6bb2dd85cef4eaf5: mov eax, edi mul esi mov edx, eax setno al test edx, edx setns cl and cl, al movzx eax, cl ret example::U31::saturating_mul::h836028ce939d6d0b: mov eax, edi mul esi seto cl cmp eax, 2147483647 mov edx, 2147483647 cmovae eax, edx test cl, cl cmovne eax, edx ret example::U31::checked_div::h07829b35455c103f: test esi, esi je .LBB4_1 mov eax, edi xor edx, edx div esi mov edx, eax mov eax, 1 ret .LBB4_1: xor eax, eax ret ``` ```asm example::U31::checked_add::h0a14bb76814034a2: xor eax, eax add edi, esi setno al mov edx, edi ret example::U31::saturating_add::h42559bf8f3c4f4ba: add edi, esi mov eax, 2147483647 cmovno eax, edi ret example::U31::checked_mul::h6bb2dd85cef4eaf5: xor eax, eax imul edi, esi setno al mov edx, edi ret example::U31::saturating_mul::h836028ce939d6d0b: imul edi, esi mov eax, 2147483647 cmovno eax, edi ret example::U31::checked_div::h07829b35455c103f: test esi, esi je .LBB4_1 mov eax, edi xor edx, edx div esi mov edx, eax mov eax, 1 ret .LBB4_1: xor eax, eax ret ```
8ad0de5 to
9854946
Compare
Member
Author
|
Cc @dodomorandi |
This file contains hidden or 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
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.
No description provided.