Skip to content

Commit 0fa2736

Browse files
committed
[builtins] Support building the 128-bit float functions on i386
GCC provides these functions (e.g.__subtf3) in libgcc on i386. Since Clang supports float128, we can also enable the existing code in i386 for ABI compatible.
1 parent 211bcf6 commit 0fa2736

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ if (NOT MSVC)
356356
set(i386_SOURCES
357357
${GENERIC_SOURCES}
358358
${x86_ARCH_SOURCES}
359+
${GENERIC_TF_SOURCES}
359360
i386/ashldi3.S
360361
i386/ashrdi3.S
361362
i386/divdi3.S
@@ -906,7 +907,7 @@ else ()
906907

907908
# For RISCV32, we must force enable int128 for compiling long
908909
# double routines.
909-
if(COMPILER_RT_ENABLE_SOFTWARE_INT128 OR "${arch}" STREQUAL "riscv32")
910+
if(COMPILER_RT_ENABLE_SOFTWARE_INT128 OR "${arch}" STREQUAL "riscv32" OR "${arch}" STREQUAL "i386")
910911
list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128)
911912
endif()
912913

compiler-rt/lib/builtins/extendxftf2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define QUAD_PRECISION
1313
#include "fp_lib.h"
1414

15-
#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__)
15+
#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && (defined(__x86_64__) || defined(__i386__))
1616
#define SRC_80
1717
#define DST_QUAD
1818
#include "fp_extend_impl.inc"

compiler-rt/lib/builtins/trunctfxf2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define QUAD_PRECISION
1313
#include "fp_lib.h"
1414

15-
#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__)
15+
#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && (defined(__x86_64__) || defined(__i386__))
1616

1717
#define SRC_QUAD
1818
#define DST_80

0 commit comments

Comments
 (0)