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] Move lowering of switches to bit tests to GIMPLE


On Tue, 2012-07-24 at 08:34 -0700, Richard Henderson wrote:
> On 07/21/2012 06:10 AM, Oleg Endo wrote:
> > I think on SH the cost test in lshift_cheap_p with
> > gen_rtx_ASHIFT (word_mode, const1_rtx, reg), speed_p);
> > 
> > will always 'fail', because of sh.c (shiftcosts):
> >   /* There is no pattern for constant first operand.  */
> >   if (CONST_INT_P (XEXP (x, 0)))
> >     return MAX_COST;
> > 
> > On SH3 / SH4* / SH2A there is a dynamic shift that does "reg << reg" or
> > "reg >> reg", which is not that expensive actually.  However, the
> > constant "1" must be loaded into a register first.  I'm currently trying
> > to brush up the shift code in SH a little bit and could add some things
> > to handle the "const << reg" case.
> 
> Having to load the "1" into a register is something common to all targets.
> I shouldn't think that SH should need to do anything special.  

Nope, nothing special.  Just load '1' into a reg.

> Indeed, that
> conditional that you quote above looks very wrong.  I believe you should 
> simply recurse (or let the rtx_cost driver recurse) to find the cost of
> arguments to the shift.

Thanks for the hint.  I'll try it out.  If it doesn't work I'll just
handle the case 'manually'.

Cheers,
Oleg


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