[Bug target/94857] Failure to optimize load+add+store into add on memory when getting carry flag afterwards on x86

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 8 08:05:02 GMT 2020


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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:a229f9b3737062c6e853879be6683f3f3e4a6661

commit r11-197-ga229f9b3737062c6e853879be6683f3f3e4a6661
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri May 8 10:03:56 2020 +0200

    ix86: Add peephole2 for *add<mode>3_cc_overflow_1 followed by matching
memory store [PR94857]

    The following peephole2 changes:
    -       addl    (%rdi), %esi
    +       xorl    %eax, %eax
    +       addl    %esi, (%rdi)
            setc    %al
    -       movl    %esi, (%rdi)
    -       movzbl  %al, %eax
            ret
    on the testcase.  *add<mode>3_cc_overflow_1, being an add{l,q} insn, is
    commutative, so if TARGET_READ_MODIFY_WRITE we can replace
    addl (%rdi), %esi; movl %esi, (%rdi)
    with
    addl %esi, (%rdi)
    if %esi is dead after those two insns.

    2020-05-08  Jakub Jelinek  <jakub@redhat.com>

            PR target/94857
            * config/i386/i386.md (peephole2 after *add<mode>3_cc_overflow_1):
New
            define_peephole2.

            * gcc.target/i386/pr94857.c: New test.


More information about the Gcc-bugs mailing list