diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index 19316c52d12ce..d45c5fe31410b 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -765,8 +765,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 c393de815337e..099de5802daf0 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/fp_lib.h b/compiler-rt/lib/builtins/fp_lib.h index fae58497a8f80..e4a330d84ecf9 100644 --- a/compiler-rt/lib/builtins/fp_lib.h +++ b/compiler-rt/lib/builtins/fp_lib.h @@ -368,10 +368,11 @@ 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) +#if 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); } @@ -386,6 +387,9 @@ static __inline tf_float __compiler_rt_fmaxtf(tf_float x, tf_float y) { #define __compiler_rt_fmaxl __compiler_rt_fmaxtf #define crt_fabstf crt_fabsf128 #define crt_copysigntf crt_copysignf128 +#else +#error Unsupported TF mode type +#endif #elif defined(CRT_LDBL_128BIT) static __inline tf_float __compiler_rt_logbtf(tf_float x) { return crt_logbl(x); @@ -401,8 +405,6 @@ static __inline tf_float __compiler_rt_fmaxtf(tf_float x, tf_float y) { #define __compiler_rt_fmaxl crt_fmaxl #define crt_fabstf crt_fabsl #define crt_copysigntf crt_copysignl -#else -#error Unsupported TF mode type #endif #endif // *_PRECISION diff --git a/compiler-rt/lib/builtins/multc3.c b/compiler-rt/lib/builtins/multc3.c index a89832f0e883e..61a3f45e47279 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