[PATCH] Fix i?86 mem += reg + comparison peephole (PR target/52086)

Uros Bizjak ubizjak@gmail.com
Thu Feb 2 09:02:00 GMT 2012


On Thu, Feb 2, 2012 at 9:15 AM, Jakub Jelinek <jakub@redhat.com> wrote:

> This peephole, as shown on the testcase, happily transforms a QImode
> memory load into a register, followed by SImode addition of that reg and
> %ebp, followed by QImode store of that back into the same memory and
> QImode comparison of that with zero into a QImode addition of the register
> to the memory with setting flags instead of clobbering them.  The problem
> with that is that for -m32 %ebp can't be used in QImode instructions.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?
>
> 2012-02-02  Jakub Jelinek  <jakub@redhat.com>
>
>        PR target/52086
>        * config/i386/i386.md (*addqi_2 peephole with SImode addition): Check
>        that operands[2] is either immediate, or q_regs_operand.
>
>        * gcc.dg/pr52086.c: New test.

OK, probably we also need to backport this fix to other release branches.

Thanks,
Uros.



More information about the Gcc-patches mailing list