This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libgcc parity optimization
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 4 Feb 2003 16:44:03 -0800
- Subject: libgcc parity optimization
Suggested by Falk the other day.
r~
* libgcc2.c (__paritysi2, __paritydi2): Replace last two reduction
rounds with a "bit table" lookup.
Index: libgcc2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/libgcc2.c,v
retrieving revision 1.161
diff -c -p -d -u -r1.161 libgcc2.c
--- libgcc2.c 4 Feb 2003 21:45:40 -0000 1.161
+++ libgcc2.c 4 Feb 2003 21:49:38 -0000
@@ -664,9 +664,8 @@ __paritysi2 (USItype x)
nx ^= nx >> 16;
nx ^= nx >> 8;
nx ^= nx >> 4;
- nx ^= nx >> 2;
- nx ^= nx >> 1;
- return nx & 1;
+ nx &= 0xf;
+ return (0x6996 >> nx) & 1;
}
#endif
@@ -680,9 +679,8 @@ __paritydi2 (UDItype x)
nx ^= nx >> 16;
nx ^= nx >> 8;
nx ^= nx >> 4;
- nx ^= nx >> 2;
- nx ^= nx >> 1;
- return nx & 1;
+ nx &= 0xf;
+ return (0x6996 >> nx) & 1;
}
#endif