This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: rs6000 and ffs
- From: Richard Henderson <rth at redhat dot com>
- To: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- Cc: H?kan Hjort <d95hjort at dtek dot chalmers dot se>, gcc at gcc dot gnu dot org
- Date: Tue, 21 Jan 2003 15:24:16 -0800
- Subject: Re: rs6000 and ffs
- References: <10BCDB75-0648-11D7-AA5B-00039372607E@physics.uc.edu> <200212022339.SAA29028@makai.watson.ibm.com> <20030120114128.GA8612@safelogic.se> <874r82l0bo.fsf@student.uni-tuebingen.de>
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~