Commit ebf178cd by Nick Clifton Committed by Nick Clifton

stormy16-lib2.c (__popcounthi2, [...]): New functions.

* config/stormy16/stormy16-lib2.c (__popcounthi2, __parityhi2, __ctzhi2,
__clzhi2): New functions.

From-SVN: r103779
parent e55a7487
005-09-02 Nick Clifton <nickc@redhat.com>
* config/stormy16/stormy16-lib2.c (__popcounthi2, __parityhi2,
__ctzhi2, __clzhi2): New functions.
2005-09-02 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/23547
......
......@@ -140,3 +140,52 @@ __lshrsi3 (USItype a, USItype b)
a >>= 1;
return a;
}
static const unsigned char __popcount_tab[] =
{
0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
};
int
__popcounthi2 (unsigned int x)
{
unsigned int ret;
ret = __popcount_tab [x & 0xff];
ret += __popcount_tab [(x >> 8) & 0xff];
return ret;
}
int
__parityhi2 (unsigned int x)
{
x ^= x >> 8;
x ^= x >> 4;
x &= 0xf;
return (0x6996 >> x) & 1;
}
int
__ctzhi2 (unsigned int x)
{
extern int __ctzsi2 (unsigned long);
unsigned long y = x;
return __ctzsi2 (y << 16) - 16;
}
int
__clzhi2 (unsigned int x)
{
extern int __clzsi2 (unsigned long);
return __clzsi2 (x) - 16;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment