On Tue, Oct 4, 2011 at 1:19 AM, Uros Bizjak <ubiz...@gmail.com> wrote: > On Tue, Oct 4, 2011 at 10:06 AM, Uros Bizjak <ubiz...@gmail.com> wrote: >>>> This patch improves address combine for x32 by forcing the memory memory >>>> operand of PLUS operation into register. Tested on Linux/x86-64 with >>>> -mx32. OK for trunk? >>> >>> Does the patch fix >>> >>> FAIL: gcc.target/i386/pr45670.c scan-assembler-not lea[lq] >>> >>> on x32 ? >> >> It does. >> >> Following patch is the same, but takes into account that non-matching >> memory can only be in src2, so it avoids a bunch of unnecessary >> checks. Can you please check the effects of the patch with some >> codesize benchmark? > > OTOH, x86_64 and i686 targets can also benefit from this change. If > combine can't create more complex address (covered by lea), then it > will simply propagate memory operand back into the add insn. It looks > to me that we can't loose here, so: > > /* Improve address combine. */ > if (code == PLUS && MEM_P (src2)) > src2 = force_reg (mode, src2); > > Any opinions?
This patch should fix PR 50603 as well as gcc.target/i386/pr45670.c. I will check its code size impact on SPEC CPU 2K/2006. -- H.J.