[PATCH] adjust types of locals in libgcc's popcount helpers
Jan Beulich
JBeulich@novell.com
Fri Dec 2 12:32:00 GMT 2005
Since 64-bit targets generally can do 32-bit operations as (sometimes
even
more: x86-64) efficiently than 64-bit ones, there is no need for the
__popcount?I2 helpers to internally use variables wider than int.
Additionally
the result type of the functions is 'int' anyway, so this also avoids
a
pointless conversion when returning.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
2005-12-02 Jan Beulich <jbeulich@novell.com>
* libgcc2.c (__popcountSI2): Don't use wide type for iterator
and
result.
(__popcountDI2): Likewise.
---
/home/jbeulich/src/gcc/trunk/2005-12-01/gcc/libgcc2.c 2005-12-01
10:48:55.000000000 +0100
+++ 2005-12-01/gcc/libgcc2.c 2005-12-02 08:49:14.000000000 +0100
@@ -744,7 +744,7 @@ const UQItype __popcount_tab[256] =
int
__popcountSI2 (UWtype x)
{
- UWtype i, ret = 0;
+ int i, ret = 0;
for (i = 0; i < W_TYPE_SIZE; i += 8)
ret += __popcount_tab[(x >> i) & 0xff];
@@ -758,7 +758,7 @@ __popcountSI2 (UWtype x)
int
__popcountDI2 (UDWtype x)
{
- UWtype i, ret = 0;
+ int i, ret = 0;
for (i = 0; i < 2*W_TYPE_SIZE; i += 8)
ret += __popcount_tab[(x >> i) & 0xff];
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gcc-trunk-libgcc-popcount-types.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051202/95d54e68/attachment.ksh>
More information about the Gcc-patches
mailing list