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 @@ -35,13 +35,13 @@ // Integral bit manipulation -di_int __ashldi3(di_int a, si_int b); // a << b -ti_int __ashlti3(ti_int a, si_int b); // a << b +di_int __ashldi3(di_int a, int b); // a << b +ti_int __ashlti3(ti_int a, int b); // a << b -di_int __ashrdi3(di_int a, si_int b); // a >> b arithmetic (sign fill) -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) +di_int __ashrdi3(di_int a, int b); // a >> b arithmetic (sign fill) +ti_int __ashrti3(ti_int a, int b); // a >> b arithmetic (sign fill) +di_int __lshrdi3(di_int a, int b); // a >> b logical (zero fill) +ti_int __lshrti3(ti_int a, int b); // a >> b logical (zero fill) int __clzsi2(si_int a); // count leading zeros int __clzdi2(di_int a); // count leading zeros diff --git a/compiler-rt/lib/builtins/ashlti3.c b/compiler-rt/lib/builtins/ashlti3.c --- a/compiler-rt/lib/builtins/ashlti3.c +++ b/compiler-rt/lib/builtins/ashlti3.c @@ -18,7 +18,7 @@ // Precondition: 0 <= b < bits_in_tword -COMPILER_RT_ABI ti_int __ashlti3(ti_int a, si_int b) { +COMPILER_RT_ABI ti_int __ashlti3(ti_int a, int b) { const int bits_in_dword = (int)(sizeof(di_int) * CHAR_BIT); twords input; twords result; diff --git a/compiler-rt/lib/builtins/ashrti3.c b/compiler-rt/lib/builtins/ashrti3.c --- a/compiler-rt/lib/builtins/ashrti3.c +++ b/compiler-rt/lib/builtins/ashrti3.c @@ -18,7 +18,7 @@ // Precondition: 0 <= b < bits_in_tword -COMPILER_RT_ABI ti_int __ashrti3(ti_int a, si_int b) { +COMPILER_RT_ABI ti_int __ashrti3(ti_int a, int b) { const int bits_in_dword = (int)(sizeof(di_int) * CHAR_BIT); twords input; twords result; diff --git a/compiler-rt/lib/builtins/lshrti3.c b/compiler-rt/lib/builtins/lshrti3.c --- a/compiler-rt/lib/builtins/lshrti3.c +++ b/compiler-rt/lib/builtins/lshrti3.c @@ -18,7 +18,7 @@ // Precondition: 0 <= b < bits_in_tword -COMPILER_RT_ABI ti_int __lshrti3(ti_int a, si_int b) { +COMPILER_RT_ABI ti_int __lshrti3(ti_int a, int b) { const int bits_in_dword = (int)(sizeof(di_int) * CHAR_BIT); utwords input; utwords result; diff --git a/compiler-rt/test/builtins/Unit/ashlti3_test.c b/compiler-rt/test/builtins/Unit/ashlti3_test.c --- a/compiler-rt/test/builtins/Unit/ashlti3_test.c +++ b/compiler-rt/test/builtins/Unit/ashlti3_test.c @@ -11,27 +11,25 @@ // Precondition: 0 <= b < bits_in_tword -COMPILER_RT_ABI ti_int __ashlti3(ti_int a, si_int b); - -int test__ashlti3(ti_int a, si_int b, ti_int expected) -{ - ti_int x = __ashlti3(a, b); - if (x != expected) - { - twords at; - at.all = a; - twords bt; - bt.all = b; - twords xt; - xt.all = x; - twords expectedt; - expectedt.all = expected; - printf("error in __ashlti3: 0x%llX%.16llX << %d = 0x%llX%.16llX," - " expected 0x%llX%.16llX\n", - at.s.high, at.s.low, b, xt.s.high, xt.s.low, - expectedt.s.high, expectedt.s.low); - } - return x != expected; +COMPILER_RT_ABI ti_int __ashlti3(ti_int a, int b); + +int test__ashlti3(ti_int a, int b, ti_int expected) { + ti_int x = __ashlti3(a, b); + if (x != expected) { + twords at; + at.all = a; + twords bt; + bt.all = b; + twords xt; + xt.all = x; + twords expectedt; + expectedt.all = expected; + printf("error in __ashlti3: 0x%llX%.16llX << %d = 0x%llX%.16llX," + " expected 0x%llX%.16llX\n", + at.s.high, at.s.low, b, xt.s.high, xt.s.low, expectedt.s.high, + expectedt.s.low); + } + return x != expected; } char assumption_1[sizeof(ti_int) == 2*sizeof(di_int)] = {0}; diff --git a/compiler-rt/test/builtins/Unit/ashrti3_test.c b/compiler-rt/test/builtins/Unit/ashrti3_test.c --- a/compiler-rt/test/builtins/Unit/ashrti3_test.c +++ b/compiler-rt/test/builtins/Unit/ashrti3_test.c @@ -11,25 +11,23 @@ // Precondition: 0 <= b < bits_in_tword -COMPILER_RT_ABI ti_int __ashrti3(ti_int a, si_int b); - -int test__ashrti3(ti_int a, si_int b, ti_int expected) -{ - ti_int x = __ashrti3(a, b); - if (x != expected) - { - twords at; - at.all = a; - twords xt; - xt.all = x; - twords expectedt; - expectedt.all = expected; - printf("error in __ashrti3: 0x%llX%.16llX >> %d = 0x%llX%.16llX," - " expected 0x%llX%.16llX\n", - at.s.high, at.s.low, b, xt.s.high, xt.s.low, - expectedt.s.high, expectedt.s.low); - } - return x != expected; +COMPILER_RT_ABI ti_int __ashrti3(ti_int a, int b); + +int test__ashrti3(ti_int a, int b, ti_int expected) { + ti_int x = __ashrti3(a, b); + if (x != expected) { + twords at; + at.all = a; + twords xt; + xt.all = x; + twords expectedt; + expectedt.all = expected; + printf("error in __ashrti3: 0x%llX%.16llX >> %d = 0x%llX%.16llX," + " expected 0x%llX%.16llX\n", + at.s.high, at.s.low, b, xt.s.high, xt.s.low, expectedt.s.high, + expectedt.s.low); + } + return x != expected; } char assumption_1[sizeof(ti_int) == 2*sizeof(di_int)] = {0}; diff --git a/compiler-rt/test/builtins/Unit/lshrti3_test.c b/compiler-rt/test/builtins/Unit/lshrti3_test.c --- a/compiler-rt/test/builtins/Unit/lshrti3_test.c +++ b/compiler-rt/test/builtins/Unit/lshrti3_test.c @@ -11,25 +11,23 @@ // Precondition: 0 <= b < bits_in_dword -COMPILER_RT_ABI ti_int __lshrti3(ti_int a, si_int b); - -int test__lshrti3(ti_int a, si_int b, ti_int expected) -{ - ti_int x = __lshrti3(a, b); - if (x != expected) - { - twords at; - at.all = a; - twords xt; - xt.all = x; - twords expectedt; - expectedt.all = expected; - printf("error in __lshrti3: 0x%llX%.16llX >> %d = 0x%llX%.16llX," - " expected 0x%llX%.16llX\n", - at.s.high, at.s.low, b, xt.s.high, xt.s.low, - expectedt.s.high, expectedt.s.low); - } - return x != expected; +COMPILER_RT_ABI ti_int __lshrti3(ti_int a, int b); + +int test__lshrti3(ti_int a, int b, ti_int expected) { + ti_int x = __lshrti3(a, b); + if (x != expected) { + twords at; + at.all = a; + twords xt; + xt.all = x; + twords expectedt; + expectedt.all = expected; + printf("error in __lshrti3: 0x%llX%.16llX >> %d = 0x%llX%.16llX," + " expected 0x%llX%.16llX\n", + at.s.high, at.s.low, b, xt.s.high, xt.s.low, expectedt.s.high, + expectedt.s.low); + } + return x != expected; } char assumption_1[sizeof(ti_int) == 2*sizeof(di_int)] = {0};