[compiler-rt] [builtins] Fix floattitf.c etc. compilation on Solaris/SPARC (PR #70058)

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 09:17:53 PDT 2023


https://github.com/rorth created https://github.com/llvm/llvm-project/pull/70058

69660ccf2ae402b02799efed072afd8ecf5a6eb0 broke the [Solaris/sparcv9 buildbot](https://lab.llvm.org/staging/#/builders/12/builds/264): `compiler-rt/lib/builtins/int_to_fp.h` unconditionally uses `*int128_t` which don't exist on 32-bit SPARC.

As suggested in https://github.com/llvm/llvm-project/pull/67540, this patch fixes this by moving the `CRT_HAS_TF_MODE` guard up which does the necessary checks.

Tested on `sparcv9-sun-solaris2.11`.

>From fbc609949c5ec0543ca0860aeaa7ffc5723916cb Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro at gcc.gnu.org>
Date: Tue, 24 Oct 2023 18:10:58 +0200
Subject: [PATCH] [builtins] Fix floattitf.c etc. compilation on Solaris/SPARC

69660ccf2ae402b02799efed072afd8ecf5a6eb0 broke the Solaris/sparcv9 buildbot
https://lab.llvm.org/staging/#/builders/12/builds/264:
`compiler-rt/lib/builtins/int_to_fp.h` unconditionally uses `*int128_t`
which don't exist on 32-bit SPARC.

As suggested in https://github.com/llvm/llvm-project/pull/67540, this patch
fixes this by moving the `CRT_HAS_TF_MODE` guard up which does the
necessary checks.

Tested on `sparcv9-sun-solaris2.11`.
---
 compiler-rt/lib/builtins/floattitf.c   | 2 +-
 compiler-rt/lib/builtins/floatuntitf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/lib/builtins/floattitf.c b/compiler-rt/lib/builtins/floattitf.c
index 697bc8fb11107ca..5dffe22fdb4eb86 100644
--- a/compiler-rt/lib/builtins/floattitf.c
+++ b/compiler-rt/lib/builtins/floattitf.c
@@ -16,6 +16,7 @@
 #include "fp_lib.h"
 #include "int_lib.h"
 
+#if defined(CRT_HAS_TF_MODE)
 #define SRC_I128
 #define DST_QUAD
 #include "int_to_fp_impl.inc"
@@ -29,7 +30,6 @@
 // mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm
 // mmmm mmmm mmmm
 
-#if defined(CRT_HAS_TF_MODE)
 COMPILER_RT_ABI fp_t __floattitf(ti_int a) { return __floatXiYf__(a); }
 
 #endif
diff --git a/compiler-rt/lib/builtins/floatuntitf.c b/compiler-rt/lib/builtins/floatuntitf.c
index c9639989d3c2a3a..1c5998a40b9f7c5 100644
--- a/compiler-rt/lib/builtins/floatuntitf.c
+++ b/compiler-rt/lib/builtins/floatuntitf.c
@@ -16,6 +16,7 @@
 #include "fp_lib.h"
 #include "int_lib.h"
 
+#if defined(CRT_HAS_TF_MODE)
 #define SRC_U128
 #define DST_QUAD
 #include "int_to_fp_impl.inc"
@@ -29,7 +30,6 @@
 // mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm
 // mmmm mmmm mmmm
 
-#if defined(CRT_HAS_TF_MODE)
 COMPILER_RT_ABI fp_t __floatuntitf(tu_int a) { return __floatXiYf__(a); }
 
 #endif



More information about the llvm-commits mailing list