On Tue, Jun 06, 2023 at 11:31:42PM +0100, Roger Sayle wrote:
> 
> This patch resolves PR target/110104, a missed optimization on x86 around
> adc with memory operands.  In i386.md, there's a peephole2 after the
> pattern for *add<mode>3_cc_overflow_1 that converts the sequence
> reg = add(reg,mem); mem = reg [where the reg is dead afterwards] into
> the equivalent mem = add(mem,reg).  The equivalent peephole2 for adc
> is missing (after addcarry<mode>), and is added by this patch.
> 
> For the example code provided in the bugzilla PR:

Seems to be pretty much the same as one of the 12 define_peephole2
patterns I've posted in
https://gcc.gnu.org/pipermail/gcc-patches/2023-June/620821.html

> 2023-06-07  Roger Sayle  <ro...@nextmovesoftware.com>
> 
> gcc/ChangeLog
>         PR target/110104
>         * config/i386/i386.md (define_peephole2): Transform reg=adc(reg,mem)
>         followed by mem=reg into mem=adc(mem,reg) when applicable.
> 
> gcc/testsuite/ChangeLog
>         PR target/110104
>         * gcc.target/i386/pr110104.c: New test case.

The testcase will be useful though (but I'd go with including
the intrin header and using the intrinsic rather than builtin).

        Jakub

Reply via email to