Add __builtin_clrsb, similar to clz/ctz

Bernd Schmidt bernds@codesourcery.com
Thu Jun 16 13:59:00 GMT 2011


On 06/16/2011 03:10 PM, Laurent Desnogues wrote:
> On Thu, Jun 16, 2011 at 2:44 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
>> Several processors have a "count redundant sign bits" instruction:
>>
>> * SIGNBITS on Blackfin
>> * NORM on C6X
>> * SBC, apparently, on picochip
> 
> picoChip defines __builtin_sbc.  Wouldn't that make it redundant
> with your __builtin_clrsb?

Yes. But the fact that many processors support the same operation
suggests we shouldn't add a builtin function to every backend, but
rather provide it as a general feature.

> I'm not sure I like clrsb.  The trailing 'b' looks superfluous if you
> compare to clz.  And clr looks too much like clear :-)

Well, you would say "leading zeros" but not "leading signs".  OTOH
"leading" is redundant when talking about sign bits, so maybe "crsb"? I
don't really care as long as the patch is otherwise approved :)


Bernd



More information about the Gcc-patches mailing list