--- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -362,6 +362,7 @@ set(i386_SOURCES ${GENERIC_SOURCES} + ${GENERIC_TF_SOURCES} ${x86_ARCH_SOURCES} i386/ashldi3.S i386/ashrdi3.S @@ -1012,9 +1013,9 @@ list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET) endif() - # For RISCV32 and 32-bit SPARC, we must force enable int128 for compiling long - # double routines. - if (COMPILER_RT_ENABLE_SOFTWARE_INT128 OR ("${arch}" MATCHES "riscv32|sparc$" + # For i386, RISCV32 and 32-bit SPARC, we must force enable int128 for + # compiling long double routines. + if (COMPILER_RT_ENABLE_SOFTWARE_INT128 OR ("${arch}" MATCHES "i386|riscv32|sparc$" AND NOT CMAKE_COMPILER_IS_GNUCC)) list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128) endif() --- a/compiler-rt/lib/builtins/extendxftf2.c +++ b/compiler-rt/lib/builtins/extendxftf2.c @@ -12,7 +12,8 @@ #define QUAD_PRECISION #include "fp_lib.h" -#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) +#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && \ + (defined(__x86_64__) || defined(__i386__)) #define SRC_80 #define DST_QUAD #include "fp_extend_impl.inc" --- a/compiler-rt/lib/builtins/trunctfxf2.c +++ b/compiler-rt/lib/builtins/trunctfxf2.c @@ -12,7 +12,8 @@ #define QUAD_PRECISION #include "fp_lib.h" -#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) +#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && \ + (defined(__x86_64__) || defined(__i386__)) #define SRC_QUAD #define DST_80 --- a/compiler-rt/lib/builtins/truncxfbf2.c +++ b/compiler-rt/lib/builtins/truncxfbf2.c @@ -6,7 +6,8 @@ // //===----------------------------------------------------------------------===// -#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) +#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && \ + (defined(__x86_64__) || defined(__i386__)) #define SRC_80 #define DST_BFLOAT #include "fp_trunc_impl.inc"