[compiler-rt] 9595f00 - [compiler-rt][builtins] Use explicitly-sized integer types for LibCalls

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 30 10:15:03 PST 2022


Author: Anatoly Trosinenko
Date: 2022-01-30T21:10:54+03:00
New Revision: 9595f0051000fdf64dd2780b40149aa7f9aad273

URL: https://github.com/llvm/llvm-project/commit/9595f0051000fdf64dd2780b40149aa7f9aad273
DIFF: https://github.com/llvm/llvm-project/commit/9595f0051000fdf64dd2780b40149aa7f9aad273.diff

LOG: [compiler-rt][builtins] Use explicitly-sized integer types for LibCalls

Use s[iu]_int instead of `(unsigned) int` and d[ui]_int instead of
`(unsigned) long long` for LibCall arguments.

Note: the `*vfp` LibCall versions were NOT touched.

Reviewed By: aykevl

Differential Revision: https://reviews.llvm.org/D86546

Added: 
    

Modified: 
    compiler-rt/lib/builtins/floatsisf.c
    compiler-rt/lib/builtins/floatsitf.c
    compiler-rt/lib/builtins/floatunsisf.c
    compiler-rt/lib/builtins/floatunsitf.c
    compiler-rt/test/builtins/Unit/floatditf_test.c
    compiler-rt/test/builtins/Unit/floatsitf_test.c
    compiler-rt/test/builtins/Unit/floatunditf_test.c
    compiler-rt/test/builtins/Unit/floatunsitf_test.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/floatsisf.c b/compiler-rt/lib/builtins/floatsisf.c
index fe060407755b8..5f3ee99146bc9 100644
--- a/compiler-rt/lib/builtins/floatsisf.c
+++ b/compiler-rt/lib/builtins/floatsisf.c
@@ -17,7 +17,7 @@
 
 #include "int_lib.h"
 
-COMPILER_RT_ABI fp_t __floatsisf(int a) {
+COMPILER_RT_ABI fp_t __floatsisf(si_int a) {
 
   const int aWidth = sizeof a * CHAR_BIT;
 

diff  --git a/compiler-rt/lib/builtins/floatsitf.c b/compiler-rt/lib/builtins/floatsitf.c
index f56063f368d9e..e6e392a506462 100644
--- a/compiler-rt/lib/builtins/floatsitf.c
+++ b/compiler-rt/lib/builtins/floatsitf.c
@@ -16,7 +16,7 @@
 #include "fp_lib.h"
 
 #if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
-COMPILER_RT_ABI fp_t __floatsitf(int a) {
+COMPILER_RT_ABI fp_t __floatsitf(si_int a) {
 
   const int aWidth = sizeof a * CHAR_BIT;
 
@@ -26,10 +26,10 @@ COMPILER_RT_ABI fp_t __floatsitf(int a) {
 
   // All other cases begin by extracting the sign and absolute value of a
   rep_t sign = 0;
-  unsigned aAbs = (unsigned)a;
+  su_int aAbs = (su_int)a;
   if (a < 0) {
     sign = signBit;
-    aAbs = ~(unsigned)a + 1U;
+    aAbs = ~(su_int)a + (su_int)1U;
   }
 
   // Exponent of (fp_t)a is the width of abs(a).

diff  --git a/compiler-rt/lib/builtins/floatunsisf.c b/compiler-rt/lib/builtins/floatunsisf.c
index 33a1b5ae2a63c..fb9bd6f082b6e 100644
--- a/compiler-rt/lib/builtins/floatunsisf.c
+++ b/compiler-rt/lib/builtins/floatunsisf.c
@@ -17,7 +17,7 @@
 
 #include "int_lib.h"
 
-COMPILER_RT_ABI fp_t __floatunsisf(unsigned int a) {
+COMPILER_RT_ABI fp_t __floatunsisf(su_int a) {
 
   const int aWidth = sizeof a * CHAR_BIT;
 

diff  --git a/compiler-rt/lib/builtins/floatunsitf.c b/compiler-rt/lib/builtins/floatunsitf.c
index a4bf0f65fe1c7..765eaccd687af 100644
--- a/compiler-rt/lib/builtins/floatunsitf.c
+++ b/compiler-rt/lib/builtins/floatunsitf.c
@@ -16,7 +16,7 @@
 #include "fp_lib.h"
 
 #if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
-COMPILER_RT_ABI fp_t __floatunsitf(unsigned int a) {
+COMPILER_RT_ABI fp_t __floatunsitf(su_int a) {
 
   const int aWidth = sizeof a * CHAR_BIT;
 

diff  --git a/compiler-rt/test/builtins/Unit/floatditf_test.c b/compiler-rt/test/builtins/Unit/floatditf_test.c
index 07f1eeb575f3d..4d5da32ec25d4 100644
--- a/compiler-rt/test/builtins/Unit/floatditf_test.c
+++ b/compiler-rt/test/builtins/Unit/floatditf_test.c
@@ -12,9 +12,9 @@
 
 // Returns: long integer converted to long double
 
-COMPILER_RT_ABI long double __floatditf(long long a);
+COMPILER_RT_ABI long double __floatditf(di_int a);
 
-int test__floatditf(long long a, uint64_t expectedHi, uint64_t expectedLo)
+int test__floatditf(di_int a, uint64_t expectedHi, uint64_t expectedLo)
 {
     long double x = __floatditf(a);
     int ret = compareResultLD(x, expectedHi, expectedLo);

diff  --git a/compiler-rt/test/builtins/Unit/floatsitf_test.c b/compiler-rt/test/builtins/Unit/floatsitf_test.c
index d317f73a71b61..751a4a9b9207a 100644
--- a/compiler-rt/test/builtins/Unit/floatsitf_test.c
+++ b/compiler-rt/test/builtins/Unit/floatsitf_test.c
@@ -8,9 +8,9 @@
 
 #include "fp_test.h"
 
-long COMPILER_RT_ABI double __floatsitf(int a);
+COMPILER_RT_ABI long double __floatsitf(si_int a);
 
-int test__floatsitf(int a, uint64_t expectedHi, uint64_t expectedLo)
+int test__floatsitf(si_int a, uint64_t expectedHi, uint64_t expectedLo)
 {
     long double x = __floatsitf(a);
     int ret = compareResultLD(x, expectedHi, expectedLo);

diff  --git a/compiler-rt/test/builtins/Unit/floatunditf_test.c b/compiler-rt/test/builtins/Unit/floatunditf_test.c
index 735a455e29774..d44ae7934145a 100644
--- a/compiler-rt/test/builtins/Unit/floatunditf_test.c
+++ b/compiler-rt/test/builtins/Unit/floatunditf_test.c
@@ -12,9 +12,9 @@
 
 // Returns: long integer converted to long double
 
-COMPILER_RT_ABI long double __floatunditf(unsigned long long a);
+COMPILER_RT_ABI long double __floatunditf(du_int a);
 
-int test__floatunditf(unsigned long long a, uint64_t expectedHi, uint64_t expectedLo)
+int test__floatunditf(du_int a, uint64_t expectedHi, uint64_t expectedLo)
 {
     long double x = __floatunditf(a);
     int ret = compareResultLD(x, expectedHi, expectedLo);

diff  --git a/compiler-rt/test/builtins/Unit/floatunsitf_test.c b/compiler-rt/test/builtins/Unit/floatunsitf_test.c
index c7d67138f5476..f0a6c63eb8379 100644
--- a/compiler-rt/test/builtins/Unit/floatunsitf_test.c
+++ b/compiler-rt/test/builtins/Unit/floatunsitf_test.c
@@ -8,9 +8,9 @@
 
 #include "fp_test.h"
 
-COMPILER_RT_ABI long double __floatunsitf(unsigned int a);
+COMPILER_RT_ABI long double __floatunsitf(su_int a);
 
-int test__floatunsitf(unsigned int a, uint64_t expectedHi, uint64_t expectedLo)
+int test__floatunsitf(su_int a, uint64_t expectedHi, uint64_t expectedLo)
 {
     long double x = __floatunsitf(a);
     int ret = compareResultLD(x, expectedHi, expectedLo);


        


More information about the llvm-commits mailing list