diff --git a/compiler-rt/lib/builtins/README.txt b/compiler-rt/lib/builtins/README.txt --- a/compiler-rt/lib/builtins/README.txt +++ b/compiler-rt/lib/builtins/README.txt @@ -20,13 +20,18 @@ http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc +Please note that the libgcc specification explicitly mentions actual types of +arguments and returned values being expressed with machine modes. +In some cases particular types such as "int", "unsigned", "long long", etc. +may be specified just as examples there. + Here is a synopsis of the contents of this library: -typedef int si_int; -typedef unsigned su_int; +typedef int32_t si_int; +typedef uint32_t su_int; -typedef long long di_int; -typedef unsigned long long du_int; +typedef int64_t di_int; +typedef uint64_t du_int; // Integral bit manipulation @@ -38,24 +43,24 @@ di_int __lshrdi3(di_int a, si_int b); // a >> b logical (zero fill) ti_int __lshrti3(ti_int a, si_int b); // a >> b logical (zero fill) -si_int __clzsi2(si_int a); // count leading zeros -si_int __clzdi2(di_int a); // count leading zeros -si_int __clzti2(ti_int a); // count leading zeros -si_int __ctzsi2(si_int a); // count trailing zeros -si_int __ctzdi2(di_int a); // count trailing zeros -si_int __ctzti2(ti_int a); // count trailing zeros +int __clzsi2(si_int a); // count leading zeros +int __clzdi2(di_int a); // count leading zeros +int __clzti2(ti_int a); // count leading zeros +int __ctzsi2(si_int a); // count trailing zeros +int __ctzdi2(di_int a); // count trailing zeros +int __ctzti2(ti_int a); // count trailing zeros -si_int __ffssi2(si_int a); // find least significant 1 bit -si_int __ffsdi2(di_int a); // find least significant 1 bit -si_int __ffsti2(ti_int a); // find least significant 1 bit +int __ffssi2(si_int a); // find least significant 1 bit +int __ffsdi2(di_int a); // find least significant 1 bit +int __ffsti2(ti_int a); // find least significant 1 bit -si_int __paritysi2(si_int a); // bit parity -si_int __paritydi2(di_int a); // bit parity -si_int __parityti2(ti_int a); // bit parity +int __paritysi2(si_int a); // bit parity +int __paritydi2(di_int a); // bit parity +int __parityti2(ti_int a); // bit parity -si_int __popcountsi2(si_int a); // bit population -si_int __popcountdi2(di_int a); // bit population -si_int __popcountti2(ti_int a); // bit population +int __popcountsi2(si_int a); // bit population +int __popcountdi2(di_int a); // bit population +int __popcountti2(ti_int a); // bit population uint32_t __bswapsi2(uint32_t a); // a byteswapped uint64_t __bswapdi2(uint64_t a); // a byteswapped @@ -169,10 +174,10 @@ // Floating point raised to integer power -float __powisf2( float a, si_int b); // a ^ b -double __powidf2( double a, si_int b); // a ^ b -long double __powixf2(long double a, si_int b); // a ^ b -long double __powitf2(long double a, si_int b); // ppc only, a ^ b +float __powisf2( float a, int b); // a ^ b +double __powidf2( double a, int b); // a ^ b +long double __powixf2(long double a, int b); // a ^ b +long double __powitf2(long double a, int b); // ppc only, a ^ b // Complex arithmetic diff --git a/compiler-rt/lib/builtins/clzdi2.c b/compiler-rt/lib/builtins/clzdi2.c --- a/compiler-rt/lib/builtins/clzdi2.c +++ b/compiler-rt/lib/builtins/clzdi2.c @@ -21,12 +21,12 @@ // ctz instruction, gcc resolves __builtin_clz to __clzdi2 rather than // __clzsi2, leading to infinite recursion. #define __builtin_clz(a) __clzsi2(a) -extern si_int __clzsi2(si_int); +extern int __clzsi2(si_int); #endif // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzdi2(di_int a) { +COMPILER_RT_ABI int __clzdi2(di_int a) { dwords x; x.all = a; const si_int f = -(x.s.high == 0); diff --git a/compiler-rt/lib/builtins/clzsi2.c b/compiler-rt/lib/builtins/clzsi2.c --- a/compiler-rt/lib/builtins/clzsi2.c +++ b/compiler-rt/lib/builtins/clzsi2.c @@ -16,7 +16,7 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzsi2(si_int a) { +COMPILER_RT_ABI int __clzsi2(si_int a) { su_int x = (su_int)a; si_int t = ((x & 0xFFFF0000) == 0) << 4; // if (x is small) t = 16 else 0 x >>= 16 - t; // x = [0 - 0xFFFF] diff --git a/compiler-rt/lib/builtins/clzti2.c b/compiler-rt/lib/builtins/clzti2.c --- a/compiler-rt/lib/builtins/clzti2.c +++ b/compiler-rt/lib/builtins/clzti2.c @@ -18,7 +18,7 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzti2(ti_int a) { +COMPILER_RT_ABI int __clzti2(ti_int a) { twords x; x.all = a; const di_int f = -(x.s.high == 0); diff --git a/compiler-rt/lib/builtins/ctzdi2.c b/compiler-rt/lib/builtins/ctzdi2.c --- a/compiler-rt/lib/builtins/ctzdi2.c +++ b/compiler-rt/lib/builtins/ctzdi2.c @@ -21,7 +21,7 @@ // ctz instruction, gcc resolves __builtin_ctz to __ctzdi2 rather than // __ctzsi2, leading to infinite recursion. #define __builtin_ctz(a) __ctzsi2(a) -extern si_int __ctzsi2(si_int); +extern int __ctzsi2(si_int); #endif // Precondition: a != 0 diff --git a/compiler-rt/lib/builtins/ctzsi2.c b/compiler-rt/lib/builtins/ctzsi2.c --- a/compiler-rt/lib/builtins/ctzsi2.c +++ b/compiler-rt/lib/builtins/ctzsi2.c @@ -16,7 +16,7 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __ctzsi2(si_int a) { +COMPILER_RT_ABI int __ctzsi2(si_int a) { su_int x = (su_int)a; si_int t = ((x & 0x0000FFFF) == 0) << 4; // if (x has no small bits) t = 16 else 0 diff --git a/compiler-rt/lib/builtins/ctzti2.c b/compiler-rt/lib/builtins/ctzti2.c --- a/compiler-rt/lib/builtins/ctzti2.c +++ b/compiler-rt/lib/builtins/ctzti2.c @@ -18,7 +18,7 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __ctzti2(ti_int a) { +COMPILER_RT_ABI int __ctzti2(ti_int a) { twords x; x.all = a; const di_int f = -(x.s.low == 0); diff --git a/compiler-rt/lib/builtins/ffsti2.c b/compiler-rt/lib/builtins/ffsti2.c --- a/compiler-rt/lib/builtins/ffsti2.c +++ b/compiler-rt/lib/builtins/ffsti2.c @@ -17,7 +17,7 @@ // Returns: the index of the least significant 1-bit in a, or // the value zero if a is zero. The least significant bit is index one. -COMPILER_RT_ABI si_int __ffsti2(ti_int a) { +COMPILER_RT_ABI int __ffsti2(ti_int a) { twords x; x.all = a; if (x.s.low == 0) { diff --git a/compiler-rt/lib/builtins/int_lib.h b/compiler-rt/lib/builtins/int_lib.h --- a/compiler-rt/lib/builtins/int_lib.h +++ b/compiler-rt/lib/builtins/int_lib.h @@ -92,8 +92,8 @@ // Include internal utility function declarations. #include "int_util.h" -COMPILER_RT_ABI si_int __paritysi2(si_int a); -COMPILER_RT_ABI si_int __paritydi2(di_int a); +COMPILER_RT_ABI int __paritysi2(si_int a); +COMPILER_RT_ABI int __paritydi2(di_int a); COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b); COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b); @@ -102,7 +102,7 @@ COMPILER_RT_ABI su_int __udivmodsi4(su_int a, su_int b, su_int *rem); COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int *rem); #ifdef CRT_HAS_128BIT -COMPILER_RT_ABI si_int __clzti2(ti_int a); +COMPILER_RT_ABI int __clzti2(ti_int a); COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int *rem); #endif @@ -110,14 +110,14 @@ #if defined(_MSC_VER) && !defined(__clang__) #include -uint32_t __inline __builtin_ctz(uint32_t value) { +int __inline __builtin_ctz(uint32_t value) { unsigned long trailing_zero = 0; if (_BitScanForward(&trailing_zero, value)) return trailing_zero; return 32; } -uint32_t __inline __builtin_clz(uint32_t value) { +int __inline __builtin_clz(uint32_t value) { unsigned long leading_zero = 0; if (_BitScanReverse(&leading_zero, value)) return 31 - leading_zero; @@ -125,14 +125,14 @@ } #if defined(_M_ARM) || defined(_M_X64) -uint32_t __inline __builtin_clzll(uint64_t value) { +int __inline __builtin_clzll(uint64_t value) { unsigned long leading_zero = 0; if (_BitScanReverse64(&leading_zero, value)) return 63 - leading_zero; return 64; } #else -uint32_t __inline __builtin_clzll(uint64_t value) { +int __inline __builtin_clzll(uint64_t value) { if (value == 0) return 64; uint32_t msh = (uint32_t)(value >> 32); diff --git a/compiler-rt/lib/builtins/paritydi2.c b/compiler-rt/lib/builtins/paritydi2.c --- a/compiler-rt/lib/builtins/paritydi2.c +++ b/compiler-rt/lib/builtins/paritydi2.c @@ -14,7 +14,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __paritydi2(di_int a) { +COMPILER_RT_ABI int __paritydi2(di_int a) { dwords x; x.all = a; return __paritysi2(x.s.high ^ x.s.low); diff --git a/compiler-rt/lib/builtins/paritysi2.c b/compiler-rt/lib/builtins/paritysi2.c --- a/compiler-rt/lib/builtins/paritysi2.c +++ b/compiler-rt/lib/builtins/paritysi2.c @@ -14,7 +14,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __paritysi2(si_int a) { +COMPILER_RT_ABI int __paritysi2(si_int a) { su_int x = (su_int)a; x ^= x >> 16; x ^= x >> 8; diff --git a/compiler-rt/lib/builtins/parityti2.c b/compiler-rt/lib/builtins/parityti2.c --- a/compiler-rt/lib/builtins/parityti2.c +++ b/compiler-rt/lib/builtins/parityti2.c @@ -16,7 +16,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __parityti2(ti_int a) { +COMPILER_RT_ABI int __parityti2(ti_int a) { twords x; x.all = a; return __paritydi2(x.s.high ^ x.s.low); diff --git a/compiler-rt/lib/builtins/popcountsi2.c b/compiler-rt/lib/builtins/popcountsi2.c --- a/compiler-rt/lib/builtins/popcountsi2.c +++ b/compiler-rt/lib/builtins/popcountsi2.c @@ -14,7 +14,7 @@ // Returns: count of 1 bits -COMPILER_RT_ABI si_int __popcountsi2(si_int a) { +COMPILER_RT_ABI int __popcountsi2(si_int a) { su_int x = (su_int)a; x = x - ((x >> 1) & 0x55555555); // Every 2 bits holds the sum of every pair of bits diff --git a/compiler-rt/lib/builtins/popcountti2.c b/compiler-rt/lib/builtins/popcountti2.c --- a/compiler-rt/lib/builtins/popcountti2.c +++ b/compiler-rt/lib/builtins/popcountti2.c @@ -17,7 +17,7 @@ // Returns: count of 1 bits -COMPILER_RT_ABI si_int __popcountti2(ti_int a) { +COMPILER_RT_ABI int __popcountti2(ti_int a) { tu_int x3 = (tu_int)a; x3 = x3 - ((x3 >> 1) & (((tu_int)0x5555555555555555uLL << 64) | 0x5555555555555555uLL)); diff --git a/compiler-rt/lib/builtins/powidf2.c b/compiler-rt/lib/builtins/powidf2.c --- a/compiler-rt/lib/builtins/powidf2.c +++ b/compiler-rt/lib/builtins/powidf2.c @@ -14,7 +14,7 @@ // Returns: a ^ b -COMPILER_RT_ABI double __powidf2(double a, si_int b) { +COMPILER_RT_ABI double __powidf2(double a, int b) { const int recip = b < 0; double r = 1; while (1) { diff --git a/compiler-rt/lib/builtins/powisf2.c b/compiler-rt/lib/builtins/powisf2.c --- a/compiler-rt/lib/builtins/powisf2.c +++ b/compiler-rt/lib/builtins/powisf2.c @@ -14,7 +14,7 @@ // Returns: a ^ b -COMPILER_RT_ABI float __powisf2(float a, si_int b) { +COMPILER_RT_ABI float __powisf2(float a, int b) { const int recip = b < 0; float r = 1; while (1) { diff --git a/compiler-rt/lib/builtins/powitf2.c b/compiler-rt/lib/builtins/powitf2.c --- a/compiler-rt/lib/builtins/powitf2.c +++ b/compiler-rt/lib/builtins/powitf2.c @@ -17,7 +17,7 @@ // Returns: a ^ b -COMPILER_RT_ABI long double __powitf2(long double a, si_int b) { +COMPILER_RT_ABI long double __powitf2(long double a, int b) { const int recip = b < 0; long double r = 1; while (1) { diff --git a/compiler-rt/lib/builtins/powixf2.c b/compiler-rt/lib/builtins/powixf2.c --- a/compiler-rt/lib/builtins/powixf2.c +++ b/compiler-rt/lib/builtins/powixf2.c @@ -16,7 +16,7 @@ // Returns: a ^ b -COMPILER_RT_ABI long double __powixf2(long double a, si_int b) { +COMPILER_RT_ABI long double __powixf2(long double a, int b) { const int recip = b < 0; long double r = 1; while (1) { diff --git a/compiler-rt/test/builtins/Unit/clzdi2_test.c b/compiler-rt/test/builtins/Unit/clzdi2_test.c --- a/compiler-rt/test/builtins/Unit/clzdi2_test.c +++ b/compiler-rt/test/builtins/Unit/clzdi2_test.c @@ -8,11 +8,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzdi2(di_int a); +COMPILER_RT_ABI int __clzdi2(di_int a); -int test__clzdi2(di_int a, si_int expected) +int test__clzdi2(di_int a, int expected) { - si_int x = __clzdi2(a); + int x = __clzdi2(a); if (x != expected) printf("error in __clzdi2(0x%llX) = %d, expected %d\n", a, x, expected); return x != expected; diff --git a/compiler-rt/test/builtins/Unit/clzsi2_test.c b/compiler-rt/test/builtins/Unit/clzsi2_test.c --- a/compiler-rt/test/builtins/Unit/clzsi2_test.c +++ b/compiler-rt/test/builtins/Unit/clzsi2_test.c @@ -8,11 +8,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzsi2(si_int a); +COMPILER_RT_ABI int __clzsi2(si_int a); -int test__clzsi2(si_int a, si_int expected) +int test__clzsi2(si_int a, int expected) { - si_int x = __clzsi2(a); + int x = __clzsi2(a); if (x != expected) printf("error in __clzsi2(0x%X) = %d, expected %d\n", a, x, expected); return x != expected; diff --git a/compiler-rt/test/builtins/Unit/clzti2_test.c b/compiler-rt/test/builtins/Unit/clzti2_test.c --- a/compiler-rt/test/builtins/Unit/clzti2_test.c +++ b/compiler-rt/test/builtins/Unit/clzti2_test.c @@ -11,11 +11,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzti2(ti_int a); +COMPILER_RT_ABI int __clzti2(ti_int a); -int test__clzti2(ti_int a, si_int expected) +int test__clzti2(ti_int a, int expected) { - si_int x = __clzti2(a); + int x = __clzti2(a); if (x != expected) { twords at; diff --git a/compiler-rt/test/builtins/Unit/ctzsi2_test.c b/compiler-rt/test/builtins/Unit/ctzsi2_test.c --- a/compiler-rt/test/builtins/Unit/ctzsi2_test.c +++ b/compiler-rt/test/builtins/Unit/ctzsi2_test.c @@ -8,11 +8,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __ctzsi2(si_int a); +COMPILER_RT_ABI int __ctzsi2(si_int a); -int test__ctzsi2(si_int a, si_int expected) +int test__ctzsi2(si_int a, int expected) { - si_int x = __ctzsi2(a); + int x = __ctzsi2(a); if (x != expected) printf("error in __ctzsi2(0x%X) = %d, expected %d\n", a, x, expected); return x != expected; diff --git a/compiler-rt/test/builtins/Unit/ctzti2_test.c b/compiler-rt/test/builtins/Unit/ctzti2_test.c --- a/compiler-rt/test/builtins/Unit/ctzti2_test.c +++ b/compiler-rt/test/builtins/Unit/ctzti2_test.c @@ -11,11 +11,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __ctzti2(ti_int a); +COMPILER_RT_ABI int __ctzti2(ti_int a); -int test__ctzti2(ti_int a, si_int expected) +int test__ctzti2(ti_int a, int expected) { - si_int x = __ctzti2(a); + int x = __ctzti2(a); if (x != expected) { twords at; diff --git a/compiler-rt/test/builtins/Unit/ffsti2_test.c b/compiler-rt/test/builtins/Unit/ffsti2_test.c --- a/compiler-rt/test/builtins/Unit/ffsti2_test.c +++ b/compiler-rt/test/builtins/Unit/ffsti2_test.c @@ -10,11 +10,11 @@ // Returns: the index of the least significant 1-bit in a, or // the value zero if a is zero. The least significant bit is index one. -COMPILER_RT_ABI si_int __ffsti2(ti_int a); +COMPILER_RT_ABI int __ffsti2(ti_int a); -int test__ffsti2(ti_int a, si_int expected) +int test__ffsti2(ti_int a, int expected) { - si_int x = __ffsti2(a); + int x = __ffsti2(a); if (x != expected) { twords at; diff --git a/compiler-rt/test/builtins/Unit/paritydi2_test.c b/compiler-rt/test/builtins/Unit/paritydi2_test.c --- a/compiler-rt/test/builtins/Unit/paritydi2_test.c +++ b/compiler-rt/test/builtins/Unit/paritydi2_test.c @@ -7,7 +7,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __paritydi2(di_int a); +COMPILER_RT_ABI int __paritydi2(di_int a); int naive_parity(di_int a) { diff --git a/compiler-rt/test/builtins/Unit/paritysi2_test.c b/compiler-rt/test/builtins/Unit/paritysi2_test.c --- a/compiler-rt/test/builtins/Unit/paritysi2_test.c +++ b/compiler-rt/test/builtins/Unit/paritysi2_test.c @@ -7,7 +7,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __paritysi2(si_int a); +COMPILER_RT_ABI int __paritysi2(si_int a); int naive_parity(si_int a) { diff --git a/compiler-rt/test/builtins/Unit/parityti2_test.c b/compiler-rt/test/builtins/Unit/parityti2_test.c --- a/compiler-rt/test/builtins/Unit/parityti2_test.c +++ b/compiler-rt/test/builtins/Unit/parityti2_test.c @@ -10,7 +10,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __parityti2(ti_int a); +COMPILER_RT_ABI int __parityti2(ti_int a); int naive_parity(ti_int a) { diff --git a/compiler-rt/test/builtins/Unit/popcountsi2_test.c b/compiler-rt/test/builtins/Unit/popcountsi2_test.c --- a/compiler-rt/test/builtins/Unit/popcountsi2_test.c +++ b/compiler-rt/test/builtins/Unit/popcountsi2_test.c @@ -7,7 +7,7 @@ // Returns: count of 1 bits -COMPILER_RT_ABI si_int __popcountsi2(si_int a); +COMPILER_RT_ABI int __popcountsi2(si_int a); int naive_popcount(si_int a) { diff --git a/compiler-rt/test/builtins/Unit/popcountti2_test.c b/compiler-rt/test/builtins/Unit/popcountti2_test.c --- a/compiler-rt/test/builtins/Unit/popcountti2_test.c +++ b/compiler-rt/test/builtins/Unit/popcountti2_test.c @@ -10,7 +10,7 @@ // Returns: count of 1 bits -COMPILER_RT_ABI si_int __popcountti2(ti_int a); +COMPILER_RT_ABI int __popcountti2(ti_int a); int naive_popcount(ti_int a) { diff --git a/compiler-rt/test/builtins/Unit/powidf2_test.c b/compiler-rt/test/builtins/Unit/powidf2_test.c --- a/compiler-rt/test/builtins/Unit/powidf2_test.c +++ b/compiler-rt/test/builtins/Unit/powidf2_test.c @@ -7,9 +7,9 @@ // Returns: a ^ b -COMPILER_RT_ABI double __powidf2(double a, si_int b); +COMPILER_RT_ABI double __powidf2(double a, int b); -int test__powidf2(double a, si_int b, double expected) +int test__powidf2(double a, int b, double expected) { double x = __powidf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); @@ -51,9 +51,9 @@ return 1; if (test__powidf2(0, 4, 0)) return 1; - if (test__powidf2(0, 0x7FFFFFFE, 0)) + if (test__powidf2(0, INT_MAX - 1, 0)) return 1; - if (test__powidf2(0, 0x7FFFFFFF, 0)) + if (test__powidf2(0, INT_MAX, 0)) return 1; if (test__powidf2(-0., 1, -0.)) @@ -64,9 +64,9 @@ return 1; if (test__powidf2(-0., 4, 0)) return 1; - if (test__powidf2(-0., 0x7FFFFFFE, 0)) + if (test__powidf2(-0., INT_MAX - 1, 0)) return 1; - if (test__powidf2(-0., 0x7FFFFFFF, -0.)) + if (test__powidf2(-0., INT_MAX, -0.)) return 1; if (test__powidf2(1, 1, 1)) @@ -77,9 +77,9 @@ return 1; if (test__powidf2(1, 4, 1)) return 1; - if (test__powidf2(1, 0x7FFFFFFE, 1)) + if (test__powidf2(1, INT_MAX - 1, 1)) return 1; - if (test__powidf2(1, 0x7FFFFFFF, 1)) + if (test__powidf2(1, INT_MAX, 1)) return 1; if (test__powidf2(INFINITY, 1, INFINITY)) @@ -90,9 +90,9 @@ return 1; if (test__powidf2(INFINITY, 4, INFINITY)) return 1; - if (test__powidf2(INFINITY, 0x7FFFFFFE, INFINITY)) + if (test__powidf2(INFINITY, INT_MAX - 1, INFINITY)) return 1; - if (test__powidf2(INFINITY, 0x7FFFFFFF, INFINITY)) + if (test__powidf2(INFINITY, INT_MAX, INFINITY)) return 1; if (test__powidf2(-INFINITY, 1, -INFINITY)) @@ -103,9 +103,9 @@ return 1; if (test__powidf2(-INFINITY, 4, INFINITY)) return 1; - if (test__powidf2(-INFINITY, 0x7FFFFFFE, INFINITY)) + if (test__powidf2(-INFINITY, INT_MAX - 1, INFINITY)) return 1; - if (test__powidf2(-INFINITY, 0x7FFFFFFF, -INFINITY)) + if (test__powidf2(-INFINITY, INT_MAX, -INFINITY)) return 1; if (test__powidf2(0, -1, INFINITY)) @@ -116,11 +116,11 @@ return 1; if (test__powidf2(0, -4, INFINITY)) return 1; - if (test__powidf2(0, 0x80000002, INFINITY)) + if (test__powidf2(0, INT_MIN + 2, INFINITY)) return 1; - if (test__powidf2(0, 0x80000001, INFINITY)) + if (test__powidf2(0, INT_MIN + 1, INFINITY)) return 1; - if (test__powidf2(0, 0x80000000, INFINITY)) + if (test__powidf2(0, INT_MIN, INFINITY)) return 1; if (test__powidf2(-0., -1, -INFINITY)) @@ -131,11 +131,11 @@ return 1; if (test__powidf2(-0., -4, INFINITY)) return 1; - if (test__powidf2(-0., 0x80000002, INFINITY)) + if (test__powidf2(-0., INT_MIN + 2, INFINITY)) return 1; - if (test__powidf2(-0., 0x80000001, -INFINITY)) + if (test__powidf2(-0., INT_MIN + 1, -INFINITY)) return 1; - if (test__powidf2(-0., 0x80000000, INFINITY)) + if (test__powidf2(-0., INT_MIN, INFINITY)) return 1; if (test__powidf2(1, -1, 1)) @@ -146,11 +146,11 @@ return 1; if (test__powidf2(1, -4, 1)) return 1; - if (test__powidf2(1, 0x80000002, 1)) + if (test__powidf2(1, INT_MIN + 2, 1)) return 1; - if (test__powidf2(1, 0x80000001, 1)) + if (test__powidf2(1, INT_MIN + 1, 1)) return 1; - if (test__powidf2(1, 0x80000000, 1)) + if (test__powidf2(1, INT_MIN, 1)) return 1; if (test__powidf2(INFINITY, -1, 0)) @@ -161,11 +161,11 @@ return 1; if (test__powidf2(INFINITY, -4, 0)) return 1; - if (test__powidf2(INFINITY, 0x80000002, 0)) + if (test__powidf2(INFINITY, INT_MIN + 2, 0)) return 1; - if (test__powidf2(INFINITY, 0x80000001, 0)) + if (test__powidf2(INFINITY, INT_MIN + 1, 0)) return 1; - if (test__powidf2(INFINITY, 0x80000000, 0)) + if (test__powidf2(INFINITY, INT_MIN, 0)) return 1; if (test__powidf2(-INFINITY, -1, -0.)) @@ -176,11 +176,11 @@ return 1; if (test__powidf2(-INFINITY, -4, 0)) return 1; - if (test__powidf2(-INFINITY, 0x80000002, 0)) + if (test__powidf2(-INFINITY, INT_MIN + 2, 0)) return 1; - if (test__powidf2(-INFINITY, 0x80000001, -0.)) + if (test__powidf2(-INFINITY, INT_MIN + 1, -0.)) return 1; - if (test__powidf2(-INFINITY, 0x80000000, 0)) + if (test__powidf2(-INFINITY, INT_MIN, 0)) return 1; if (test__powidf2(2, 10, 1024.)) diff --git a/compiler-rt/test/builtins/Unit/powisf2_test.c b/compiler-rt/test/builtins/Unit/powisf2_test.c --- a/compiler-rt/test/builtins/Unit/powisf2_test.c +++ b/compiler-rt/test/builtins/Unit/powisf2_test.c @@ -7,9 +7,9 @@ // Returns: a ^ b -COMPILER_RT_ABI float __powisf2(float a, si_int b); +COMPILER_RT_ABI float __powisf2(float a, int b); -int test__powisf2(float a, si_int b, float expected) +int test__powisf2(float a, int b, float expected) { float x = __powisf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); @@ -51,9 +51,9 @@ return 1; if (test__powisf2(0, 4, 0)) return 1; - if (test__powisf2(0, 0x7FFFFFFE, 0)) + if (test__powisf2(0, INT_MAX -1, 0)) return 1; - if (test__powisf2(0, 0x7FFFFFFF, 0)) + if (test__powisf2(0, INT_MAX, 0)) return 1; if (test__powisf2(-0., 1, -0.)) @@ -64,9 +64,9 @@ return 1; if (test__powisf2(-0., 4, 0)) return 1; - if (test__powisf2(-0., 0x7FFFFFFE, 0)) + if (test__powisf2(-0., INT_MAX - 1, 0)) return 1; - if (test__powisf2(-0., 0x7FFFFFFF, -0.)) + if (test__powisf2(-0., INT_MAX, -0.)) return 1; if (test__powisf2(1, 1, 1)) @@ -77,9 +77,9 @@ return 1; if (test__powisf2(1, 4, 1)) return 1; - if (test__powisf2(1, 0x7FFFFFFE, 1)) + if (test__powisf2(1, INT_MAX - 1, 1)) return 1; - if (test__powisf2(1, 0x7FFFFFFF, 1)) + if (test__powisf2(1, INT_MAX, 1)) return 1; if (test__powisf2(INFINITY, 1, INFINITY)) @@ -90,9 +90,9 @@ return 1; if (test__powisf2(INFINITY, 4, INFINITY)) return 1; - if (test__powisf2(INFINITY, 0x7FFFFFFE, INFINITY)) + if (test__powisf2(INFINITY, INT_MAX - 1, INFINITY)) return 1; - if (test__powisf2(INFINITY, 0x7FFFFFFF, INFINITY)) + if (test__powisf2(INFINITY, INT_MAX, INFINITY)) return 1; if (test__powisf2(-INFINITY, 1, -INFINITY)) @@ -103,9 +103,9 @@ return 1; if (test__powisf2(-INFINITY, 4, INFINITY)) return 1; - if (test__powisf2(-INFINITY, 0x7FFFFFFE, INFINITY)) + if (test__powisf2(-INFINITY, INT_MAX - 1, INFINITY)) return 1; - if (test__powisf2(-INFINITY, 0x7FFFFFFF, -INFINITY)) + if (test__powisf2(-INFINITY, INT_MAX, -INFINITY)) return 1; if (test__powisf2(0, -1, INFINITY)) @@ -116,11 +116,11 @@ return 1; if (test__powisf2(0, -4, INFINITY)) return 1; - if (test__powisf2(0, 0x80000002, INFINITY)) + if (test__powisf2(0, INT_MIN + 2, INFINITY)) return 1; - if (test__powisf2(0, 0x80000001, INFINITY)) + if (test__powisf2(0, INT_MIN + 1, INFINITY)) return 1; - if (test__powisf2(0, 0x80000000, INFINITY)) + if (test__powisf2(0, INT_MIN, INFINITY)) return 1; if (test__powisf2(-0., -1, -INFINITY)) @@ -131,11 +131,11 @@ return 1; if (test__powisf2(-0., -4, INFINITY)) return 1; - if (test__powisf2(-0., 0x80000002, INFINITY)) + if (test__powisf2(-0., INT_MIN + 2, INFINITY)) return 1; - if (test__powisf2(-0., 0x80000001, -INFINITY)) + if (test__powisf2(-0., INT_MIN + 1, -INFINITY)) return 1; - if (test__powisf2(-0., 0x80000000, INFINITY)) + if (test__powisf2(-0., INT_MIN, INFINITY)) return 1; if (test__powisf2(1, -1, 1)) @@ -146,11 +146,11 @@ return 1; if (test__powisf2(1, -4, 1)) return 1; - if (test__powisf2(1, 0x80000002, 1)) + if (test__powisf2(1, INT_MIN + 2, 1)) return 1; - if (test__powisf2(1, 0x80000001, 1)) + if (test__powisf2(1, INT_MIN + 1, 1)) return 1; - if (test__powisf2(1, 0x80000000, 1)) + if (test__powisf2(1, INT_MIN, 1)) return 1; if (test__powisf2(INFINITY, -1, 0)) @@ -161,11 +161,11 @@ return 1; if (test__powisf2(INFINITY, -4, 0)) return 1; - if (test__powisf2(INFINITY, 0x80000002, 0)) + if (test__powisf2(INFINITY, INT_MIN + 2, 0)) return 1; - if (test__powisf2(INFINITY, 0x80000001, 0)) + if (test__powisf2(INFINITY, INT_MIN + 1, 0)) return 1; - if (test__powisf2(INFINITY, 0x80000000, 0)) + if (test__powisf2(INFINITY, INT_MIN, 0)) return 1; if (test__powisf2(-INFINITY, -1, -0.)) @@ -176,11 +176,11 @@ return 1; if (test__powisf2(-INFINITY, -4, 0)) return 1; - if (test__powisf2(-INFINITY, 0x80000002, 0)) + if (test__powisf2(-INFINITY, INT_MIN + 2, 0)) return 1; - if (test__powisf2(-INFINITY, 0x80000001, -0.)) + if (test__powisf2(-INFINITY, INT_MIN + 1, -0.)) return 1; - if (test__powisf2(-INFINITY, 0x80000000, 0)) + if (test__powisf2(-INFINITY, INT_MIN, 0)) return 1; if (test__powisf2(2, 10, 1024.)) diff --git a/compiler-rt/test/builtins/Unit/powitf2_test.c b/compiler-rt/test/builtins/Unit/powitf2_test.c --- a/compiler-rt/test/builtins/Unit/powitf2_test.c +++ b/compiler-rt/test/builtins/Unit/powitf2_test.c @@ -10,9 +10,9 @@ // Returns: a ^ b -COMPILER_RT_ABI long double __powitf2(long double a, si_int b); +COMPILER_RT_ABI long double __powitf2(long double a, int b); -int test__powitf2(long double a, si_int b, long double expected) +int test__powitf2(long double a, int b, long double expected) { long double x = __powitf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); @@ -57,9 +57,9 @@ return 1; if (test__powitf2(0, 4, 0)) return 1; - if (test__powitf2(0, 0x7FFFFFFE, 0)) + if (test__powitf2(0, INT_MAX - 1, 0)) return 1; - if (test__powitf2(0, 0x7FFFFFFF, 0)) + if (test__powitf2(0, INT_MAX, 0)) return 1; if (test__powitf2(-0., 1, -0.)) @@ -70,9 +70,9 @@ return 1; if (test__powitf2(-0., 4, 0)) return 1; - if (test__powitf2(-0., 0x7FFFFFFE, 0)) + if (test__powitf2(-0., INT_MAX - 1, 0)) return 1; - if (test__powitf2(-0., 0x7FFFFFFF, -0.)) + if (test__powitf2(-0., INT_MAX, -0.)) return 1; if (test__powitf2(1, 1, 1)) @@ -83,9 +83,9 @@ return 1; if (test__powitf2(1, 4, 1)) return 1; - if (test__powitf2(1, 0x7FFFFFFE, 1)) + if (test__powitf2(1, INT_MAX - 1, 1)) return 1; - if (test__powitf2(1, 0x7FFFFFFF, 1)) + if (test__powitf2(1, INT_MAX, 1)) return 1; if (test__powitf2(INFINITY, 1, INFINITY)) @@ -96,9 +96,9 @@ return 1; if (test__powitf2(INFINITY, 4, INFINITY)) return 1; - if (test__powitf2(INFINITY, 0x7FFFFFFE, INFINITY)) + if (test__powitf2(INFINITY, INT_MAX - 1, INFINITY)) return 1; - if (test__powitf2(INFINITY, 0x7FFFFFFF, INFINITY)) + if (test__powitf2(INFINITY, INT_MAX, INFINITY)) return 1; if (test__powitf2(-INFINITY, 1, -INFINITY)) @@ -109,9 +109,9 @@ return 1; if (test__powitf2(-INFINITY, 4, INFINITY)) return 1; - if (test__powitf2(-INFINITY, 0x7FFFFFFE, INFINITY)) + if (test__powitf2(-INFINITY, INT_MAX - 1, INFINITY)) return 1; - if (test__powitf2(-INFINITY, 0x7FFFFFFF, -INFINITY)) + if (test__powitf2(-INFINITY, INT_MAX, -INFINITY)) return 1; if (test__powitf2(0, -1, INFINITY)) @@ -122,11 +122,11 @@ return 1; if (test__powitf2(0, -4, INFINITY)) return 1; - if (test__powitf2(0, 0x80000002, INFINITY)) + if (test__powitf2(0, INT_MIN + 2, INFINITY)) return 1; - if (test__powitf2(0, 0x80000001, INFINITY)) + if (test__powitf2(0, INT_MIN + 1, INFINITY)) return 1; - if (test__powitf2(0, 0x80000000, INFINITY)) + if (test__powitf2(0, INT_MIN, INFINITY)) return 1; if (test__powitf2(-0., -1, -INFINITY)) @@ -137,11 +137,11 @@ return 1; if (test__powitf2(-0., -4, INFINITY)) return 1; - if (test__powitf2(-0., 0x80000002, INFINITY)) + if (test__powitf2(-0., INT_MIN + 2, INFINITY)) return 1; - if (test__powitf2(-0., 0x80000001, -INFINITY)) + if (test__powitf2(-0., INT_MIN + 1, -INFINITY)) return 1; - if (test__powitf2(-0., 0x80000000, INFINITY)) + if (test__powitf2(-0., INT_MIN, INFINITY)) return 1; if (test__powitf2(1, -1, 1)) @@ -152,11 +152,11 @@ return 1; if (test__powitf2(1, -4, 1)) return 1; - if (test__powitf2(1, 0x80000002, 1)) + if (test__powitf2(1, INT_MIN + 2, 1)) return 1; - if (test__powitf2(1, 0x80000001, 1)) + if (test__powitf2(1, INT_MIN + 1, 1)) return 1; - if (test__powitf2(1, 0x80000000, 1)) + if (test__powitf2(1, INT_MIN, 1)) return 1; if (test__powitf2(INFINITY, -1, 0)) @@ -167,11 +167,11 @@ return 1; if (test__powitf2(INFINITY, -4, 0)) return 1; - if (test__powitf2(INFINITY, 0x80000002, 0)) + if (test__powitf2(INFINITY, INT_MIN + 2, 0)) return 1; - if (test__powitf2(INFINITY, 0x80000001, 0)) + if (test__powitf2(INFINITY, INT_MIN + 1, 0)) return 1; - if (test__powitf2(INFINITY, 0x80000000, 0)) + if (test__powitf2(INFINITY, INT_MIN, 0)) return 1; if (test__powitf2(-INFINITY, -1, -0.)) @@ -182,11 +182,11 @@ return 1; if (test__powitf2(-INFINITY, -4, 0)) return 1; - if (test__powitf2(-INFINITY, 0x80000002, 0)) + if (test__powitf2(-INFINITY, INT_MIN + 2, 0)) return 1; - if (test__powitf2(-INFINITY, 0x80000001, -0.)) + if (test__powitf2(-INFINITY, INT_MIN + 1, -0.)) return 1; - if (test__powitf2(-INFINITY, 0x80000000, 0)) + if (test__powitf2(-INFINITY, INT_MIN, 0)) return 1; if (test__powitf2(2, 10, 1024.)) diff --git a/compiler-rt/test/builtins/Unit/powixf2_test.c b/compiler-rt/test/builtins/Unit/powixf2_test.c --- a/compiler-rt/test/builtins/Unit/powixf2_test.c +++ b/compiler-rt/test/builtins/Unit/powixf2_test.c @@ -11,9 +11,9 @@ // Returns: a ^ b -COMPILER_RT_ABI long double __powixf2(long double a, si_int b); +COMPILER_RT_ABI long double __powixf2(long double a, int b); -int test__powixf2(long double a, si_int b, long double expected) +int test__powixf2(long double a, int b, long double expected) { long double x = __powixf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); @@ -58,9 +58,9 @@ return 1; if (test__powixf2(0, 4, 0)) return 1; - if (test__powixf2(0, 0x7FFFFFFE, 0)) + if (test__powixf2(0, INT_MAX - 1, 0)) return 1; - if (test__powixf2(0, 0x7FFFFFFF, 0)) + if (test__powixf2(0, INT_MAX, 0)) return 1; if (test__powixf2(-0., 1, -0.)) @@ -71,9 +71,9 @@ return 1; if (test__powixf2(-0., 4, 0)) return 1; - if (test__powixf2(-0., 0x7FFFFFFE, 0)) + if (test__powixf2(-0., INT_MAX - 1, 0)) return 1; - if (test__powixf2(-0., 0x7FFFFFFF, -0.)) + if (test__powixf2(-0., INT_MAX, -0.)) return 1; if (test__powixf2(1, 1, 1)) @@ -84,9 +84,9 @@ return 1; if (test__powixf2(1, 4, 1)) return 1; - if (test__powixf2(1, 0x7FFFFFFE, 1)) + if (test__powixf2(1, INT_MAX - 1, 1)) return 1; - if (test__powixf2(1, 0x7FFFFFFF, 1)) + if (test__powixf2(1, INT_MAX, 1)) return 1; if (test__powixf2(INFINITY, 1, INFINITY)) @@ -97,9 +97,9 @@ return 1; if (test__powixf2(INFINITY, 4, INFINITY)) return 1; - if (test__powixf2(INFINITY, 0x7FFFFFFE, INFINITY)) + if (test__powixf2(INFINITY, INT_MAX - 1, INFINITY)) return 1; - if (test__powixf2(INFINITY, 0x7FFFFFFF, INFINITY)) + if (test__powixf2(INFINITY, INT_MAX, INFINITY)) return 1; if (test__powixf2(-INFINITY, 1, -INFINITY)) @@ -110,9 +110,9 @@ return 1; if (test__powixf2(-INFINITY, 4, INFINITY)) return 1; - if (test__powixf2(-INFINITY, 0x7FFFFFFE, INFINITY)) + if (test__powixf2(-INFINITY, INT_MAX - 1, INFINITY)) return 1; - if (test__powixf2(-INFINITY, 0x7FFFFFFF, -INFINITY)) + if (test__powixf2(-INFINITY, INT_MAX, -INFINITY)) return 1; if (test__powixf2(0, -1, INFINITY)) @@ -123,11 +123,11 @@ return 1; if (test__powixf2(0, -4, INFINITY)) return 1; - if (test__powixf2(0, 0x80000002, INFINITY)) + if (test__powixf2(0, INT_MIN + 2, INFINITY)) return 1; - if (test__powixf2(0, 0x80000001, INFINITY)) + if (test__powixf2(0, INT_MIN + 1, INFINITY)) return 1; - if (test__powixf2(0, 0x80000000, INFINITY)) + if (test__powixf2(0, INT_MIN, INFINITY)) return 1; if (test__powixf2(-0., -1, -INFINITY)) @@ -138,11 +138,11 @@ return 1; if (test__powixf2(-0., -4, INFINITY)) return 1; - if (test__powixf2(-0., 0x80000002, INFINITY)) + if (test__powixf2(-0., INT_MIN + 2, INFINITY)) return 1; - if (test__powixf2(-0., 0x80000001, -INFINITY)) + if (test__powixf2(-0., INT_MIN + 1, -INFINITY)) return 1; - if (test__powixf2(-0., 0x80000000, INFINITY)) + if (test__powixf2(-0., INT_MIN, INFINITY)) return 1; if (test__powixf2(1, -1, 1)) @@ -153,11 +153,11 @@ return 1; if (test__powixf2(1, -4, 1)) return 1; - if (test__powixf2(1, 0x80000002, 1)) + if (test__powixf2(1, INT_MIN + 2, 1)) return 1; - if (test__powixf2(1, 0x80000001, 1)) + if (test__powixf2(1, INT_MIN + 1, 1)) return 1; - if (test__powixf2(1, 0x80000000, 1)) + if (test__powixf2(1, INT_MIN, 1)) return 1; if (test__powixf2(INFINITY, -1, 0)) @@ -168,11 +168,11 @@ return 1; if (test__powixf2(INFINITY, -4, 0)) return 1; - if (test__powixf2(INFINITY, 0x80000002, 0)) + if (test__powixf2(INFINITY, INT_MIN + 2, 0)) return 1; - if (test__powixf2(INFINITY, 0x80000001, 0)) + if (test__powixf2(INFINITY, INT_MIN + 1, 0)) return 1; - if (test__powixf2(INFINITY, 0x80000000, 0)) + if (test__powixf2(INFINITY, INT_MIN, 0)) return 1; if (test__powixf2(-INFINITY, -1, -0.)) @@ -183,11 +183,11 @@ return 1; if (test__powixf2(-INFINITY, -4, 0)) return 1; - if (test__powixf2(-INFINITY, 0x80000002, 0)) + if (test__powixf2(-INFINITY, INT_MIN + 2, 0)) return 1; - if (test__powixf2(-INFINITY, 0x80000001, -0.)) + if (test__powixf2(-INFINITY, INT_MIN + 1, -0.)) return 1; - if (test__powixf2(-INFINITY, 0x80000000, 0)) + if (test__powixf2(-INFINITY, INT_MIN, 0)) return 1; if (test__powixf2(2, 10, 1024.))