This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Sign extension elimination


On Tue, Feb 28, 2006 at 11:20:08AM +0200, Leehod Baruch wrote:
> >
> > This patch is very limited. It doesn't work on the simple testcase
> > in
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17387
> >
> > Basically, we have
> >
> > set reg1 xxx
> > use reg1
> > set reg2 zero_extend:reg1
> >
> > It can be optimized to
> >
> > set subreg:reg2 xxx
> > use subreg:reg2
> >
> > But the above patch failed.
> >
> >
> > H.J.
> 
> First of all, thank you for testing the patch.
> I've looked into your testcase on bugzilla.
> 
> At the end of the RTL code you posted was this instruction:
> 
> (insn:HI 18 16 21 2 (set (reg:DI 79 [ t ])
>         (zero_extend:DI (reg/v:SI 73 [ t ]))) 111 {zero_extendsidi2_rex64}
> (nil)
>     (expr_list:REG_DEAD (reg/v:SI 73 [ t ])
>         (nil)))
> 
> You say that this extension is redundant, but in order to
> see if it could be eliminated by this patch, I need to see
> the uses of reg 79.
> 
> But, even if the uses of reg 79 allow the elimination of the extension,
> the patch in its current state won't eliminate it because
> the extension of reg 73 into reg 79 is not adjacent to the definition
> of reg 73 (the is an extra use of reg 73 between them).
> 
> One of the FIXMEs in the patch refers to this, I think that fixing it
> will be quite easy and maybe it will help in this case.
> The reason that it was not implemented yet is that this is not a
> typical redundant extension that we eliminate.
> The pattern in your code was not observed on PowerPC.
> 
> Leehod.

This pattern is very common on x86-64. Grigory, Denis, can you work
with Leehod to fix it?

Thanks.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]