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: rs6000 and ffs


On Tue, Jan 21, 2003 at 09:22:51PM +0100, Falk Hueffner wrote:
> So how about these 8 builtins:
> 
> int __builtin_popcntsi()  (population count)
> int __builtin_popparsi()  (population parity)
> int __builtin_leadzsi()   (count leading zeros)
> int __builtin_trailzsi()  (count trailing zeros)
> int __builtin_popcntdi()  (64 bit variations)

First, I think these should follow the "", "l", "ll"
suffixing that abs, ffs etc use at the source level.

Second, I think names like "popcount" and "popparity"
are better.  We're not saving enough characters off 
the abbreviation to sacrafice the clarity.  The name
count_leading_zeros is already in use in longlong.h,
but I think those are just a bit too long.  In those
cases I prefer "clz" and "ctz".

> I could try to make a patch that implements them from libgcc,
> analogous to __builtin_ffs, and architecture specific optimizations
> could be added later...

Sure.  You'll need new tree codes, new rtx codes.  You'll
want to modify both constant folding routines.  For libgcc,
you'll want to start with the generic implementations in 
longlong.h.  Modifying longlong.h to use the builtins can
come later, along with using the arch-specific longlong.h 
bits to populate the backends.


r~


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