This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: rs6000 geu/ltu patterns
On Mon, Mar 08, 2004 at 04:22:33PM -0500, David Edelsohn wrote:
> I guess in the short-run, if GCC does generate those comparisons,
> we need your proposed patch as an optimization. We really don't want GCC
> to generate the actual comparison, assuming GCC generates something
> stupid if zero is rejected.
For the testcase in PR 14478, rejecting zero in reg_or_neg_short_operand
generates (-m32 -O1):
foo:
cmpwi 0,3,0
beq- 0,.L6
.L4:
addi 4,4,1
slwi. 3,3,1
bne+ 0,.L4
.L6:
li 3,0
subfc 3,3,4
li 3,0
adde 3,3,3
blr
That looks like correct code to me, but inferior to that generated
with my patch:
foo:
cmpwi 0,3,0
beq- 0,.L6
.L4:
addi 4,4,1
slwi. 3,3,1
bne+ 0,.L4
.L6:
li 3,1
blr
--
Alan Modra
IBM OzLabs - Linux Technology Centre