This is the mail archive of the gcc@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: RFC: using clz for comparing to zero on the tree level.


> > In the case I mainly was considering was x==0||y==0, where on PPC (and 
> > mostly likely on ARM) the asm with clz would be shorter and faster,

> On the ARM, that can be done as
> 
>	cmp	x, #0
>	cmpne	y, #0
>	moveq	out, #1
>	movne	out, #0


Or even, extending Olly Bett's suggestion:

	rsbs	out, x, #1
	rsbccs	out, y, #1
	movcc	out, #0

Which is certainly shorter than can be done with CLZ.

Note, in this case OUT must not overlap Y, but it may overlap X (but we 
can do the comparison of Y before that of X if that is the case).

R.


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