[compiler-rt] Found one more delta to unbreak build for z/os (PR #82789)

Sean Perry via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 08:12:23 PDT 2024


https://github.com/perry-ca updated https://github.com/llvm/llvm-project/pull/82789

>From 66989a1d5937d2eadcf7658a16a8fd8eced23a00 Mon Sep 17 00:00:00 2001
From: Sean Perry <perry at ca.ibm.com>
Date: Fri, 23 Feb 2024 10:32:52 -0600
Subject: [PATCH 1/2] fix build for z/os

---
 compiler-rt/lib/builtins/fp_lib.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/builtins/fp_lib.h b/compiler-rt/lib/builtins/fp_lib.h
index c4f0a5b9587f77..48adea3619cf44 100644
--- a/compiler-rt/lib/builtins/fp_lib.h
+++ b/compiler-rt/lib/builtins/fp_lib.h
@@ -383,10 +383,10 @@ static __inline fp_t __compiler_rt_fmax(fp_t x, fp_t y) {
 #endif
 }
 
-#elif defined(QUAD_PRECISION) && defined(CRT_HAS_TF_MODE)
+#elif defined(QUAD_PRECISION)
+#if defined(CRT_HAS_TF_MODE) && defined(CRT_HAS_IEEE_TF)
 // The generic implementation only works for ieee754 floating point. For other
 // floating point types, continue to rely on the libm implementation for now.
-#if defined(CRT_HAS_IEEE_TF)
 static __inline tf_float __compiler_rt_logbtf(tf_float x) {
   return __compiler_rt_logbX(x);
 }

>From 6c45d601a845035f297973a7bc928be21dfe16cc Mon Sep 17 00:00:00 2001
From: Sean Perry <perry at ca.ibm.com>
Date: Fri, 6 Sep 2024 09:14:04 -0500
Subject: [PATCH 2/2] Fix files so div & mult are included for z/OS and
 excluded for 32-bit sparc

---
 compiler-rt/lib/builtins/CMakeLists.txt | 11 +++++++++--
 compiler-rt/lib/builtins/divtc3.c       |  2 +-
 compiler-rt/lib/builtins/multc3.c       |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 2c3b0fa84a4782..0b3ed34c37c055 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -755,8 +755,15 @@ set(riscv64_SOURCES
   ${riscv_SOURCES}
 )
 
-set(sparc_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES})
-set(sparcv9_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES})
+# Exclude the FT sources for 32-bit SPARC.  Clang doesn't
+# support 128-bit long double on 32-bit SPARC.
+if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "sparc")
+  set(sparc_SOURCES ${GENERIC_SOURCES})
+  set(sparcv9_SOURCES ${GENERIC_SOURCES})
+else()
+  set(sparc_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES})
+  set(sparcv9_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES})
+endif()
 
 set(wasm32_SOURCES
   ${GENERIC_TF_SOURCES}
diff --git a/compiler-rt/lib/builtins/divtc3.c b/compiler-rt/lib/builtins/divtc3.c
index c393de815337ef..099de5802daf0e 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,7 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128)
+#if defined(CRT_HAS_F128)
 
 // Returns: the quotient of (a + ib) / (c + id)
 
diff --git a/compiler-rt/lib/builtins/multc3.c b/compiler-rt/lib/builtins/multc3.c
index a89832f0e883e5..61a3f45e47279c 100644
--- a/compiler-rt/lib/builtins/multc3.c
+++ b/compiler-rt/lib/builtins/multc3.c
@@ -15,7 +15,7 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128)
+#if defined(CRT_HAS_F128)
 
 // Returns: the product of a + ib and c + id
 



More information about the llvm-commits mailing list