This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: adding fast bitops to egcs?
- To: Alfred Perlstein <bright at rush dot net>
- Subject: Re: adding fast bitops to egcs?
- From: Jeffrey A Law <law at upchuck dot cygnus dot com>
- Date: Mon, 26 Apr 1999 21:34:43 -0600
- cc: egcs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <Pine.BSF.3.96.990426182434.2095D-100000@cygnus.rush.net>you write:
> Such as:
> 1) return position of first set/unset bit from MSB to LSB or LSB to MSB
ffs, which gcc will recognize and attempt to use a hardware intrinsic to
implement.
> 2) number of bits set
True. No good pop count.
> 3) bit rotation
Easily synthesized. GCC recognizes rotate synthesis and will attempt to use
a rotate instruction if the hardware supports it.
> The reason is that the C primatives for bit ops are quite poor for scanning
> bit strings and most modern hardware supports some of these ops with a
> single fast instruction (instead of forcing the coder to use a clumsy
> for loop).
Actually, few targets have this stuff these days. I have the, err, pleasure
of looking at 2-5 new ISAs every year. ffs, pop count are rarer and rarer.
rotates are still fairly common though.
jeff