On Thu, Jun 16, 2011 at 2:44 PM, Bernd Schmidt <ber...@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?

> and probably others. For example, for a value of 0 or -1, it returns 31,
> while e.g. an input 0xc0000000 produces 1.

FWIW, ARM AdvSIMD has vcls.

> Other compilers tend to define builtin functions called "norm" for this,
> and the operation is used in some DSP benchmarks. The patch below adds a
> __builtin_clrsb family of functions, similar to __builtin_clz. I'm open
> to suggestions about the name; I don't particularly like "norm" but
> maybe that's what users expect.

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


Laurent

Reply via email to