On Mon, 2012-01-30 at 10:46 +0100, Richard Guenther wrote:
> On Fri, Jan 27, 2012 at 5:56 PM, Peter Bergner <berg...@vnet.ibm.com> wrote:
> > This patch fixes PR16458 by using the type expression attached to a reg
> > rtx to detect its signedness and generating unsigned compares when
> > appropriate.  However, we continue to use signed compares for the
> > special case of when we compare an unsigned reg against the constant 0.
> > This is because signed and unsigned compares give the same results
> > for equality and "(unsigned)x > 0)" is equivalent to "x != 0".
> > Using a signed compare in this special case allows us to continue to
> > generate record form instructions (ie, instructions that implicitly
> > set cr0).


> > I'll note that for the moment, I have XFAILed pr16458-4.c, since this
> > test case isn't working yet, but it is due to a problem in expand not
> > attaching any type expression information on *index's reg rtx like it
> > does for *a and *b in pr16458-2.c.  We're tracking that down for 4.8.

I asked Bill to have a look at this one and he emailed the gcc mailing
list regarding the issue.  It looks like micha has a working answer:

  http://gcc.gnu.org/ml/gcc/2012-01/msg00349.html



> > This has passed bootstrap and regtesting with no regressions.
> > Ok for mainline?
> 
> This does not sound suitable for stage4.  

Since this has been around for a while, I'm fine with waiting until
stage1.


> rs6000_unsigned_reg_p
> looks suspiciously non-rs6000 specific, and if we really can rely
> on the way it is implemented should find its way to general RTL
> helper routines.

If other ports like avr can make use of it too, I have no problems
moving it somewhere else.


> The question is - do we ever coalesce signed
> and unsigned variables to the same pseudo?

What is it you are worried about?  The patch is only attempting
to emit unsigned compares for operands we know to be unsigned.
The fact that the compares are equality compares means we can
use either signed or unsigned compares.  It's just that the signed
versions don't CSE with any following non-equality unsigned compares
with the same unsigned operands.


> IIRC avr people recently have come across the same idea.

Do you have a pointer for this?


Peter



Reply via email to