atrosinenko created this revision. atrosinenko added a reviewer: howard.hinnant. Herald added a project: Sanitizers. Herald added a subscriber: Sanitizers.
This patch changes types of some integer function arguments or return values from `si_int` to the default `int` type (`typedef`ed to `native_int` to make it obvious this is intentional) to make it more compatible with `libgcc`. The compiler-rt/lib/builtins/README.txt has a link to the libgcc specification <http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc>. This specification has an explicit note on `int`, `float` and other such types being just illustrations in some cases while the actual types are expressed with machine modes. Such usage of always-32-bit-wide integer type may lead to issues on 16-bit platforms such as MSP430. Provided libgcc2.h <https://gcc.gnu.org/git/?p=gcc.git;a=blob_plain;f=libgcc/libgcc2.h;hb=HEAD> can be used as a reference for all targets supported by the libgcc, this patch fixes some existing differences in helper declarations. This patch is expected to not change behavior at all for targets with 32-bit `int` type. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D81285 Files: compiler-rt/lib/builtins/README.txt compiler-rt/lib/builtins/clzdi2.c compiler-rt/lib/builtins/clzsi2.c compiler-rt/lib/builtins/clzti2.c compiler-rt/lib/builtins/ctzdi2.c compiler-rt/lib/builtins/ctzsi2.c compiler-rt/lib/builtins/ctzti2.c compiler-rt/lib/builtins/ffsdi2.c compiler-rt/lib/builtins/ffssi2.c compiler-rt/lib/builtins/ffsti2.c compiler-rt/lib/builtins/int_lib.h compiler-rt/lib/builtins/int_types.h compiler-rt/lib/builtins/paritydi2.c compiler-rt/lib/builtins/paritysi2.c compiler-rt/lib/builtins/parityti2.c compiler-rt/lib/builtins/popcountdi2.c compiler-rt/lib/builtins/popcountsi2.c compiler-rt/lib/builtins/popcountti2.c compiler-rt/lib/builtins/powidf2.c compiler-rt/lib/builtins/powisf2.c compiler-rt/lib/builtins/powitf2.c compiler-rt/lib/builtins/powixf2.c compiler-rt/test/builtins/Unit/clzdi2_test.c compiler-rt/test/builtins/Unit/clzsi2_test.c compiler-rt/test/builtins/Unit/clzti2_test.c compiler-rt/test/builtins/Unit/ctzdi2_test.c compiler-rt/test/builtins/Unit/ctzsi2_test.c compiler-rt/test/builtins/Unit/ctzti2_test.c compiler-rt/test/builtins/Unit/ffsdi2_test.c compiler-rt/test/builtins/Unit/ffssi2_test.c compiler-rt/test/builtins/Unit/ffsti2_test.c compiler-rt/test/builtins/Unit/paritydi2_test.c compiler-rt/test/builtins/Unit/paritysi2_test.c compiler-rt/test/builtins/Unit/parityti2_test.c compiler-rt/test/builtins/Unit/popcountdi2_test.c compiler-rt/test/builtins/Unit/popcountsi2_test.c compiler-rt/test/builtins/Unit/popcountti2_test.c compiler-rt/test/builtins/Unit/powidf2_test.c compiler-rt/test/builtins/Unit/powisf2_test.c compiler-rt/test/builtins/Unit/powitf2_test.c compiler-rt/test/builtins/Unit/powixf2_test.c
Index: compiler-rt/test/builtins/Unit/powixf2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/powixf2_test.c +++ compiler-rt/test/builtins/Unit/powixf2_test.c @@ -22,9 +22,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, native_int b); -int test__powixf2(long double a, si_int b, long double expected) +int test__powixf2(long double a, native_int b, long double expected) { long double x = __powixf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); @@ -69,9 +69,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.)) @@ -82,9 +82,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)) @@ -95,9 +95,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)) @@ -108,9 +108,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)) @@ -121,9 +121,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)) @@ -134,11 +134,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)) @@ -149,11 +149,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)) @@ -164,11 +164,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)) @@ -179,11 +179,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.)) @@ -194,11 +194,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.)) Index: compiler-rt/test/builtins/Unit/powitf2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/powitf2_test.c +++ compiler-rt/test/builtins/Unit/powitf2_test.c @@ -21,9 +21,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, native_int b); -int test__powitf2(long double a, si_int b, long double expected) +int test__powitf2(long double a, native_int b, long double expected) { long double x = __powitf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); @@ -68,9 +68,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.)) @@ -81,9 +81,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)) @@ -94,9 +94,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)) @@ -107,9 +107,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)) @@ -120,9 +120,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)) @@ -133,11 +133,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)) @@ -148,11 +148,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)) @@ -163,11 +163,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)) @@ -178,11 +178,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.)) @@ -193,11 +193,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.)) Index: compiler-rt/test/builtins/Unit/powisf2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/powisf2_test.c +++ compiler-rt/test/builtins/Unit/powisf2_test.c @@ -18,9 +18,9 @@ // Returns: a ^ b -COMPILER_RT_ABI float __powisf2(float a, si_int b); +COMPILER_RT_ABI float __powisf2(float a, native_int b); -int test__powisf2(float a, si_int b, float expected) +int test__powisf2(float a, native_int b, float expected) { float x = __powisf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); @@ -62,9 +62,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.)) @@ -75,9 +75,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)) @@ -88,9 +88,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)) @@ -101,9 +101,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)) @@ -114,9 +114,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)) @@ -127,11 +127,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)) @@ -142,11 +142,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)) @@ -157,11 +157,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)) @@ -172,11 +172,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.)) @@ -187,11 +187,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.)) Index: compiler-rt/test/builtins/Unit/powidf2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/powidf2_test.c +++ compiler-rt/test/builtins/Unit/powidf2_test.c @@ -18,9 +18,9 @@ // Returns: a ^ b -COMPILER_RT_ABI double __powidf2(double a, si_int b); +COMPILER_RT_ABI double __powidf2(double a, native_int b); -int test__powidf2(double a, si_int b, double expected) +int test__powidf2(double a, native_int b, double expected) { double x = __powidf2(a, b); int correct = (x == expected) && (signbit(x) == signbit(expected)); @@ -62,9 +62,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.)) @@ -75,9 +75,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)) @@ -88,9 +88,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)) @@ -101,9 +101,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)) @@ -114,9 +114,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)) @@ -127,11 +127,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)) @@ -142,11 +142,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)) @@ -157,11 +157,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)) @@ -172,11 +172,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.)) @@ -187,11 +187,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.)) Index: compiler-rt/test/builtins/Unit/popcountti2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/popcountti2_test.c +++ compiler-rt/test/builtins/Unit/popcountti2_test.c @@ -21,7 +21,7 @@ // Returns: count of 1 bits -COMPILER_RT_ABI si_int __popcountti2(ti_int a); +COMPILER_RT_ABI native_int __popcountti2(ti_int a); int naive_popcount(ti_int a) { Index: compiler-rt/test/builtins/Unit/popcountsi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/popcountsi2_test.c +++ compiler-rt/test/builtins/Unit/popcountsi2_test.c @@ -18,7 +18,7 @@ // Returns: count of 1 bits -COMPILER_RT_ABI si_int __popcountsi2(si_int a); +COMPILER_RT_ABI native_int __popcountsi2(si_int a); int naive_popcount(si_int a) { Index: compiler-rt/test/builtins/Unit/popcountdi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/popcountdi2_test.c +++ compiler-rt/test/builtins/Unit/popcountdi2_test.c @@ -18,7 +18,7 @@ // Returns: count of 1 bits -COMPILER_RT_ABI int __popcountdi2(di_int a); +COMPILER_RT_ABI native_int __popcountdi2(di_int a); int naive_popcount(di_int a) { Index: compiler-rt/test/builtins/Unit/parityti2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/parityti2_test.c +++ compiler-rt/test/builtins/Unit/parityti2_test.c @@ -21,7 +21,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __parityti2(ti_int a); +COMPILER_RT_ABI native_int __parityti2(ti_int a); int naive_parity(ti_int a) { Index: compiler-rt/test/builtins/Unit/paritysi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/paritysi2_test.c +++ compiler-rt/test/builtins/Unit/paritysi2_test.c @@ -18,7 +18,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __paritysi2(si_int a); +COMPILER_RT_ABI native_int __paritysi2(si_int a); int naive_parity(si_int a) { Index: compiler-rt/test/builtins/Unit/paritydi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/paritydi2_test.c +++ compiler-rt/test/builtins/Unit/paritydi2_test.c @@ -18,7 +18,7 @@ // Returns: 1 if number of bits is odd else returns 0 -COMPILER_RT_ABI si_int __paritydi2(di_int a); +COMPILER_RT_ABI native_int __paritydi2(di_int a); int naive_parity(di_int a) { Index: compiler-rt/test/builtins/Unit/ffsti2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/ffsti2_test.c +++ compiler-rt/test/builtins/Unit/ffsti2_test.c @@ -21,11 +21,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 native_int __ffsti2(ti_int a); -int test__ffsti2(ti_int a, si_int expected) +int test__ffsti2(ti_int a, native_int expected) { - si_int x = __ffsti2(a); + native_int x = __ffsti2(a); if (x != expected) { twords at; Index: compiler-rt/test/builtins/Unit/ffssi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/ffssi2_test.c +++ compiler-rt/test/builtins/Unit/ffssi2_test.c @@ -18,11 +18,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 int __ffssi2(si_int a); +COMPILER_RT_ABI native_int __ffssi2(si_int a); -int test__ffssi2(si_int a, int expected) +int test__ffssi2(si_int a, native_int expected) { - int x = __ffssi2(a); + native_int x = __ffssi2(a); if (x != expected) printf("error in __ffssi2(0x%X) = %d, expected %d\n", a, x, expected); return x != expected; Index: compiler-rt/test/builtins/Unit/ffsdi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/ffsdi2_test.c +++ compiler-rt/test/builtins/Unit/ffsdi2_test.c @@ -18,11 +18,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 int __ffsdi2(di_int a); +COMPILER_RT_ABI native_int __ffsdi2(di_int a); -int test__ffsdi2(di_int a, int expected) +int test__ffsdi2(di_int a, native_int expected) { - int x = __ffsdi2(a); + native_int x = __ffsdi2(a); if (x != expected) printf("error in __ffsdi2(0x%llX) = %d, expected %d\n", a, x, expected); return x != expected; Index: compiler-rt/test/builtins/Unit/ctzti2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/ctzti2_test.c +++ compiler-rt/test/builtins/Unit/ctzti2_test.c @@ -22,11 +22,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __ctzti2(ti_int a); +COMPILER_RT_ABI native_int __ctzti2(ti_int a); -int test__ctzti2(ti_int a, si_int expected) +int test__ctzti2(ti_int a, native_int expected) { - si_int x = __ctzti2(a); + native_int x = __ctzti2(a); if (x != expected) { twords at; Index: compiler-rt/test/builtins/Unit/ctzsi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/ctzsi2_test.c +++ compiler-rt/test/builtins/Unit/ctzsi2_test.c @@ -19,11 +19,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __ctzsi2(si_int a); +COMPILER_RT_ABI native_int __ctzsi2(si_int a); -int test__ctzsi2(si_int a, si_int expected) +int test__ctzsi2(si_int a, native_int expected) { - si_int x = __ctzsi2(a); + native_int x = __ctzsi2(a); if (x != expected) printf("error in __ctzsi2(0x%X) = %d, expected %d\n", a, x, expected); return x != expected; Index: compiler-rt/test/builtins/Unit/ctzdi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/ctzdi2_test.c +++ compiler-rt/test/builtins/Unit/ctzdi2_test.c @@ -19,11 +19,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI int __ctzdi2(di_int a); +COMPILER_RT_ABI native_int __ctzdi2(di_int a); -int test__ctzdi2(di_int a, int expected) +int test__ctzdi2(di_int a, native_int expected) { - int x = __ctzdi2(a); + native_int x = __ctzdi2(a); if (x != expected) printf("error in __ctzdi2(0x%llX) = %d, expected %d\n", a, x, expected); return x != expected; Index: compiler-rt/test/builtins/Unit/clzti2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/clzti2_test.c +++ compiler-rt/test/builtins/Unit/clzti2_test.c @@ -22,11 +22,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzti2(ti_int a); +COMPILER_RT_ABI native_int __clzti2(ti_int a); -int test__clzti2(ti_int a, si_int expected) +int test__clzti2(ti_int a, native_int expected) { - si_int x = __clzti2(a); + native_int x = __clzti2(a); if (x != expected) { twords at; Index: compiler-rt/test/builtins/Unit/clzsi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/clzsi2_test.c +++ compiler-rt/test/builtins/Unit/clzsi2_test.c @@ -19,11 +19,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzsi2(si_int a); +COMPILER_RT_ABI native_int __clzsi2(si_int a); -int test__clzsi2(si_int a, si_int expected) +int test__clzsi2(si_int a, native_int expected) { - si_int x = __clzsi2(a); + native_int x = __clzsi2(a); if (x != expected) printf("error in __clzsi2(0x%X) = %d, expected %d\n", a, x, expected); return x != expected; Index: compiler-rt/test/builtins/Unit/clzdi2_test.c =================================================================== --- compiler-rt/test/builtins/Unit/clzdi2_test.c +++ compiler-rt/test/builtins/Unit/clzdi2_test.c @@ -19,11 +19,11 @@ // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzdi2(di_int a); +COMPILER_RT_ABI native_int __clzdi2(di_int a); -int test__clzdi2(di_int a, si_int expected) +int test__clzdi2(di_int a, native_int expected) { - si_int x = __clzdi2(a); + native_int x = __clzdi2(a); if (x != expected) printf("error in __clzdi2(0x%llX) = %d, expected %d\n", a, x, expected); return x != expected; Index: compiler-rt/lib/builtins/powixf2.c =================================================================== --- compiler-rt/lib/builtins/powixf2.c +++ 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, native_int b) { const int recip = b < 0; long double r = 1; while (1) { Index: compiler-rt/lib/builtins/powitf2.c =================================================================== --- compiler-rt/lib/builtins/powitf2.c +++ 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, native_int b) { const int recip = b < 0; long double r = 1; while (1) { Index: compiler-rt/lib/builtins/powisf2.c =================================================================== --- compiler-rt/lib/builtins/powisf2.c +++ 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, native_int b) { const int recip = b < 0; float r = 1; while (1) { Index: compiler-rt/lib/builtins/powidf2.c =================================================================== --- compiler-rt/lib/builtins/powidf2.c +++ 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, native_int b) { const int recip = b < 0; double r = 1; while (1) { Index: compiler-rt/lib/builtins/popcountti2.c =================================================================== --- compiler-rt/lib/builtins/popcountti2.c +++ 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 native_int __popcountti2(ti_int a) { tu_int x3 = (tu_int)a; x3 = x3 - ((x3 >> 1) & (((tu_int)0x5555555555555555uLL << 64) | 0x5555555555555555uLL)); Index: compiler-rt/lib/builtins/popcountsi2.c =================================================================== --- compiler-rt/lib/builtins/popcountsi2.c +++ 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 native_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 Index: compiler-rt/lib/builtins/popcountdi2.c =================================================================== --- compiler-rt/lib/builtins/popcountdi2.c +++ compiler-rt/lib/builtins/popcountdi2.c @@ -14,7 +14,7 @@ // Returns: count of 1 bits -COMPILER_RT_ABI int __popcountdi2(di_int a) { +COMPILER_RT_ABI native_int __popcountdi2(di_int a) { du_int x2 = (du_int)a; x2 = x2 - ((x2 >> 1) & 0x5555555555555555uLL); // Every 2 bits holds the sum of every pair of bits (32) Index: compiler-rt/lib/builtins/parityti2.c =================================================================== --- compiler-rt/lib/builtins/parityti2.c +++ 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 native_int __parityti2(ti_int a) { twords x; x.all = a; return __paritydi2(x.s.high ^ x.s.low); Index: compiler-rt/lib/builtins/paritysi2.c =================================================================== --- compiler-rt/lib/builtins/paritysi2.c +++ 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 native_int __paritysi2(si_int a) { su_int x = (su_int)a; x ^= x >> 16; x ^= x >> 8; Index: compiler-rt/lib/builtins/paritydi2.c =================================================================== --- compiler-rt/lib/builtins/paritydi2.c +++ 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 native_int __paritydi2(di_int a) { dwords x; x.all = a; return __paritysi2(x.s.high ^ x.s.low); Index: compiler-rt/lib/builtins/int_types.h =================================================================== --- compiler-rt/lib/builtins/int_types.h +++ compiler-rt/lib/builtins/int_types.h @@ -18,6 +18,8 @@ #include "int_endianness.h" +typedef int native_int; + // si_int is defined in Linux sysroot's asm-generic/siginfo.h #ifdef si_int #undef si_int Index: compiler-rt/lib/builtins/int_lib.h =================================================================== --- compiler-rt/lib/builtins/int_lib.h +++ compiler-rt/lib/builtins/int_lib.h @@ -91,8 +91,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 native_int __paritysi2(si_int a); +COMPILER_RT_ABI native_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); @@ -101,7 +101,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 native_int __clzti2(ti_int a); COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int *rem); #endif @@ -109,14 +109,14 @@ #if defined(_MSC_VER) && !defined(__clang__) #include <intrin.h> -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; @@ -124,14 +124,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); Index: compiler-rt/lib/builtins/ffsti2.c =================================================================== --- compiler-rt/lib/builtins/ffsti2.c +++ 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 native_int __ffsti2(ti_int a) { twords x; x.all = a; if (x.s.low == 0) { Index: compiler-rt/lib/builtins/ffssi2.c =================================================================== --- compiler-rt/lib/builtins/ffssi2.c +++ compiler-rt/lib/builtins/ffssi2.c @@ -15,7 +15,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 int __ffssi2(si_int a) { +COMPILER_RT_ABI native_int __ffssi2(si_int a) { if (a == 0) { return 0; } Index: compiler-rt/lib/builtins/ffsdi2.c =================================================================== --- compiler-rt/lib/builtins/ffsdi2.c +++ compiler-rt/lib/builtins/ffsdi2.c @@ -15,7 +15,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 int __ffsdi2(di_int a) { +COMPILER_RT_ABI native_int __ffsdi2(di_int a) { dwords x; x.all = a; if (x.s.low == 0) { Index: compiler-rt/lib/builtins/ctzti2.c =================================================================== --- compiler-rt/lib/builtins/ctzti2.c +++ 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 native_int __ctzti2(ti_int a) { twords x; x.all = a; const di_int f = -(x.s.low == 0); Index: compiler-rt/lib/builtins/ctzsi2.c =================================================================== --- compiler-rt/lib/builtins/ctzsi2.c +++ 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 native_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 Index: compiler-rt/lib/builtins/ctzdi2.c =================================================================== --- compiler-rt/lib/builtins/ctzdi2.c +++ compiler-rt/lib/builtins/ctzdi2.c @@ -21,12 +21,12 @@ // 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 native_int __ctzsi2(si_int); #endif // Precondition: a != 0 -COMPILER_RT_ABI int __ctzdi2(di_int a) { +COMPILER_RT_ABI native_int __ctzdi2(di_int a) { dwords x; x.all = a; const si_int f = -(x.s.low == 0); Index: compiler-rt/lib/builtins/clzti2.c =================================================================== --- compiler-rt/lib/builtins/clzti2.c +++ 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 native_int __clzti2(ti_int a) { twords x; x.all = a; const di_int f = -(x.s.high == 0); Index: compiler-rt/lib/builtins/clzsi2.c =================================================================== --- compiler-rt/lib/builtins/clzsi2.c +++ 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 native_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] Index: compiler-rt/lib/builtins/clzdi2.c =================================================================== --- compiler-rt/lib/builtins/clzdi2.c +++ 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 native_int __clzsi2(si_int); #endif // Precondition: a != 0 -COMPILER_RT_ABI si_int __clzdi2(di_int a) { +COMPILER_RT_ABI native_int __clzdi2(di_int a) { dwords x; x.all = a; const si_int f = -(x.s.high == 0); Index: compiler-rt/lib/builtins/README.txt =================================================================== --- compiler-rt/lib/builtins/README.txt +++ compiler-rt/lib/builtins/README.txt @@ -20,13 +20,20 @@ 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 int native_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 +45,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 +native_int __clzsi2(si_int a); // count leading zeros +native_int __clzdi2(di_int a); // count leading zeros +native_int __clzti2(ti_int a); // count leading zeros +native_int __ctzsi2(si_int a); // count trailing zeros +native_int __ctzdi2(di_int a); // count trailing zeros +native_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 +native_int __ffssi2(si_int a); // find least significant 1 bit +native_int __ffsdi2(di_int a); // find least significant 1 bit +native_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 +native_int __paritysi2(si_int a); // bit parity +native_int __paritydi2(di_int a); // bit parity +native_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 +native_int __popcountsi2(si_int a); // bit population +native_int __popcountdi2(di_int a); // bit population +native_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 +176,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, native_int b); // a ^ b +double __powidf2( double a, native_int b); // a ^ b +long double __powixf2(long double a, native_int b); // a ^ b +long double __powitf2(long double a, native_int b); // ppc only, a ^ b // Complex arithmetic
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits