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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=122320

--- Comment #3 from Roger Sayle <roger at nextmovesoftware dot com> ---
The problematic code was introduced by Hongtao's solution to PR target/122320
in October 2025.  In addition to the one line fix proposed in comment #2, I
also have a larger patch that performs this optimization (for AVX512
comparisons, including floating point comparisons where it's safe) during RTL
expansion.  For the original test case, this allows the call to abort to be
eliminated at compile-time.

With just the one-line fix, with -O2 -mavx512vl we generate:

main:   movl    $-1, %eax
        cmpb    $-1, %al
        jne     .L3
        xorl    %eax, %eax
        ret
.L3:    pushq   %rbp
        movq    %rsp, %rbp
        call    abort

Performing this optimization during RTL expansion, we would generate:

main:   xorl    %eax, %eax
        ret

Reply via email to