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: Bit twiddling builtins


> On Tue, Feb 04, 2003 at 10:22:33AM +0000, Richard Earnshaw wrote:
> > My personal opinion is that the "user-visible" function __builtin_clz(x) 
> > should be well-defined for all values of x, with x=0 resulting in the 
> > answer MODE_SIZE(x).  That means that the *default* expansion of the 
> > builtin would have to be
> > 
> > 	if (x == 0)
> > 		(set (result) (const_int MODE_SIZE))
> > 	else
> > 		(set (result) (clz:M x))
> 
> I think this would be a mistake.  I think more often than not the
> context in which this gets used the programmer will already know
> that the value is non-zero, but that won't necessarily be apparent
> to the compiler.
> 
> I would be willing to attempt to recognize this pattern *in source*
> and replace with just clz, as appropriate.

This is really getting away from my original concern.  Can someone making 
use of the __builtin_clz builtin for ARM on gcc 3.2 get the same behaviour 
now that we have the generic builtin of the same name without having to 
change their source.  If not, then I don't think we can rename the builtin 
in this way.

R.


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