[Bug rtl-optimization/65056] Missed optimization (x86): Redundant test/compare after arithmetic operations

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Aug 27 05:48:04 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 8+ gets rid of the compare for andq and GCC produces:
.L11:
        movq    %r8, %rcx
        andq    (%rdi,%rdx,8), %rcx
        movq    %r9, %r8
        jne     .L10
.L3:
        subq    $1, %rdx
        cmpq    $-1, %rdx
        jne     .L11

This was fixed by r8-3869.

GCC 10+ gets rid of the compare for the subq and GCC produces:
.L11:
        andq    (%rdi,%rax,8), %rdx
        movq    %rdx, %rcx
        movq    $-1, %rdx
        jne     .L10
.L3:
        subq    $1, %rax
        jnb     .L11

There was a lot of carry improvements for GCC 10 and that fixed that one.


More information about the Gcc-bugs mailing list