https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116815

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #5)
> Created attachment 62666 [details]
> x86 patch in testing

The pr116815-6.c testcase from Dhruv's patch ("[PATCH v4] [aarch64] Make better
use of overflowing operations in max/min(a, add/sub(a, b)) [PR116815]") at [1]
compiles on x86_64 (gcc -O2) to:

umaxadd:
        addl    %edi, %esi      # 18    [c=4 l=2]  addsi3_cc_overflow_1/0
        movl    %edi, %eax      # 21    [c=4 l=2]  *movsi_internal/0
        cmovnc  %esi, %eax      # 19    [c=4 l=3]  *movsicc_noc/0
        ret             # 25    [c=0 l=1]  simple_return_internal

umaxsub:
        movl    %edi, %eax      # 21    [c=4 l=2]  *movsi_internal/0
        subl    %esi, %eax      # 18    [c=4 l=2]  *subsi_3/0
        cmovnb  %edi, %eax      # 19    [c=4 l=3]  *movsicc_noc/1
        ret             # 25    [c=0 l=1]  simple_return_internal

uminadd:
        addl    %edi, %esi      # 18    [c=4 l=2]  addsi3_cc_overflow_1/0
        movl    %edi, %eax      # 21    [c=4 l=2]  *movsi_internal/0
        cmovc   %esi, %eax      # 19    [c=4 l=3]  *movsicc_noc/0
        ret             # 25    [c=0 l=1]  simple_return_internal

uminsub:
        movl    %edi, %eax      # 21    [c=4 l=2]  *movsi_internal/0
        subl    %esi, %eax      # 18    [c=4 l=2]  *subsi_3/0
        cmovb   %edi, %eax      # 19    [c=4 l=3]  *movsicc_noc/1
        ret             # 25    [c=0 l=1]  simple_return_internal

[1] https://gcc.gnu.org/pipermail/gcc-patches/2025-August/692789.html

Reply via email to