gcc.target/i386/lea-3.c fails on ia32 with PIE enabled by default.
There are two reasons for that:
- setting up the PIC register requires one addl instruction, and the
testcase wants none
- the expected lea-combining peephole doesn't get applied for two
reasons:
-- the second insn of the pair that could be turned into a single lea
doesn't clobber CC, but the existing peephole2 requires an add with
such a clobber
-- the first and second insns set different regs, and the existing
peephole2 requires them to be the same
Add extra peephole2s for when the second insn doesn't clobber CC, and
for when the first set reg is different, but it dies at the second
insn.
Adjust lea-3.c to run with -fno-PIE, and add lea-4.c with -fPIE.
The last of the newly-added peephole2s, that enables lea-4.c to pass,
also hits during an i686-linux-gnu bootstrap (without PIE enabled),
while building shared libraries for the target. I haven't been able
to exercise the other 2, but I haven't tried very hard, and I see no
why they couldn't possibly hit, so I left them in.
for gcc/ChangeLog
* config/i386/i386.md (lea peephole2): Add 3 new variants.
for gcc/testsuite/ChangeLog
* gcc.target/i386/lea-3.c: Add -fno-PIE.
* gcc.target/i386/lea-4.c: New, with -fPIE.