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]

Re: adding fast bitops to egcs?



  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


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