1 typedef int HItype __attribute__ ((mode (HI)));
2 typedef int SItype __attribute__ ((mode (SI)));
3 typedef unsigned int USItype __attribute__ ((mode (SI)));
5 typedef int word_type __attribute__ ((mode (__word__)));
8 udivmodsi4(USItype num, USItype den, word_type modwanted)
13 while (den < num && bit && !(den & (1L<<31)))
28 if (modwanted) return num;
35 __divsi3 (SItype a, SItype b)
52 res = udivmodsi4 (a, b, 0);
63 __modsi3 (SItype a, SItype b)
77 res = udivmodsi4 (a, b, 1);
89 __udivsi3 (SItype a, SItype b)
91 return udivmodsi4 (a, b, 0);
97 __umodsi3 (SItype a, SItype b)
99 return udivmodsi4 (a, b, 1);
103 __ashlsi3 (SItype a, SItype b)
111 for (i = (b & 0x7); i > 0; --i)
117 __ashrsi3 (SItype a, SItype b)
125 for (i = (b & 0x7); i > 0; --i)
131 __lshrsi3 (USItype a, USItype b)
139 for (i = (b & 0x7); i > 0; --i)
144 static const unsigned char __popcount_tab[] =
146 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,
147 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,
148 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,
149 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,
150 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,
151 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,
152 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,
153 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,
157 __popcounthi2 (unsigned int x)
161 ret = __popcount_tab [x & 0xff];
162 ret += __popcount_tab [(x >> 8) & 0xff];
168 __parityhi2 (unsigned int x)
173 return (0x6996 >> x) & 1;
177 __ctzhi2 (unsigned int x)
179 extern int __ctzsi2 (unsigned long);
182 return __ctzsi2 (y << 16) - 16;
186 __clzhi2 (unsigned int x)
188 extern int __clzsi2 (unsigned long);
190 return __clzsi2 (x) - 16;