diff --git a/compiler-rt/lib/builtins/README.txt b/compiler-rt/lib/builtins/README.txt index e603dfa053566..f9e1bc805092e 100644 --- a/compiler-rt/lib/builtins/README.txt +++ b/compiler-rt/lib/builtins/README.txt @@ -20,13 +20,18 @@ Here is the specification for this library: 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 @@ ti_int __ashrti3(ti_int a, si_int b); // a >> b arithmetic (sign fill) 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 @@ long double __floatuntixf(tu_int a); // 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 index d64e9eda85130..12c17982a5cb1 100644 --- 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 index 3f9f27f413315..d75f56d937b07 100644 --- 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 index 0c787104caa2a..25d30119f271c 100644 --- 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 index 8335f5cbb314e..26c908d876ac4 100644 --- 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 index 09c6863b74e3a..ed95c60579339 100644 --- 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 index 2a1312c8437de..fb136d0de1c0d 100644 --- 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 index a2d7ce08ada13..a2177d148a099 100644 --- 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 index 7e1dabe29d01a..991c4a99ea6e2 100644 --- 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 __udivsi3(su_int n, su_int d); 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 @@ COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int *rem); #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 @@ uint32_t __inline __builtin_clz(uint32_t value) { } #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 index dd9d45e63ea47..58e85f89e0437 100644 --- 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 index 3efa961f2f85f..a4b84e0806328 100644 --- 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 index f3942ba8378c7..79e920d8a02df 100644 --- 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 index 75e592a778d98..4d346c45d9cee 100644 --- 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 index 853fd722309ee..79cbb2fb34c00 100644 --- 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 index 9697588484e74..81058af508297 100644 --- 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 index 469402348825c..d0ab26167bbd2 100644 --- 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 index 141a3a0ea727f..8e639a03a3c4b 100644 --- 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 index b7b52095afa17..3edfe9fd7af59 100644 --- 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 index 3cbfb4b68b0dc..962f1dff45113 100644 --- 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 index d12c59cf56a54..57562c497c5d0 100644 --- 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 index 3dbf907540210..13e0e698422f2 100644 --- 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 index 96db33983cc48..db6d4ce6a1621 100644 --- 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 index a19de13c9a074..054776ef71cff 100644 --- 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 index 3ec7f02bca453..446b16fe3871c 100644 --- 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 index 13218a9beeb62..2ea1ddc0977d8 100644 --- 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 index 7aae131b7b07b..2bed010d9d4ad 100644 --- 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 index 6644ee0ef0fa0..ec4cf45bf30d4 100644 --- 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 index 731e6212c06fc..7689267514744 100644 --- 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 index 53edd8c43b933..c3919dccdcb8c 100644 --- 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 index 0c4e2138734bd..aa16b8542dae3 100644 --- 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 index e86901d574ad3..6da42d908d048 100644 --- 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 index be16c5f45c32c..81331098730ac 100644 --- 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 index 5ce3e522af458..856012ab32dbb 100644 --- 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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 @@ int main() 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.))