[libc-commits] [compiler-rt] [libc] [compiler-rt][builtins] add libc-backed double/float-to-int builtins (PR #207543)

via libc-commits libc-commits at lists.llvm.org
Sat Jul 4 21:46:45 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: hulxv (hulxv)

<details>
<summary>Changes</summary>

Add libc-backed double/float to integer conversion builtins 

Part of #<!-- -->197824

---

Patch is 54.17 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/207543.diff


42 Files Affected:

- (modified) compiler-rt/lib/builtins/CMakeLists.txt (+12) 
- (added) compiler-rt/lib/builtins/fixdfdi.cpp (+22) 
- (added) compiler-rt/lib/builtins/fixdfsi.cpp (+22) 
- (added) compiler-rt/lib/builtins/fixdfti.cpp (+26) 
- (added) compiler-rt/lib/builtins/fixsfdi.cpp (+22) 
- (added) compiler-rt/lib/builtins/fixsfsi.cpp (+22) 
- (added) compiler-rt/lib/builtins/fixsfti.cpp (+26) 
- (added) compiler-rt/lib/builtins/fixunsdfdi.cpp (+22) 
- (added) compiler-rt/lib/builtins/fixunsdfsi.cpp (+22) 
- (added) compiler-rt/lib/builtins/fixunsdfti.cpp (+26) 
- (added) compiler-rt/lib/builtins/fixunssfdi.cpp (+22) 
- (added) compiler-rt/lib/builtins/fixunssfsi.cpp (+22) 
- (added) compiler-rt/lib/builtins/fixunssfti.cpp (+26) 
- (modified) libc/shared/builtins.h (+12) 
- (added) libc/shared/builtins/fixdfdi.h (+29) 
- (added) libc/shared/builtins/fixdfsi.h (+29) 
- (added) libc/shared/builtins/fixdfti.h (+35) 
- (added) libc/shared/builtins/fixsfdi.h (+29) 
- (added) libc/shared/builtins/fixsfsi.h (+29) 
- (added) libc/shared/builtins/fixsfti.h (+35) 
- (added) libc/shared/builtins/fixunsdfdi.h (+29) 
- (added) libc/shared/builtins/fixunsdfsi.h (+29) 
- (added) libc/shared/builtins/fixunsdfti.h (+35) 
- (added) libc/shared/builtins/fixunssfdi.h (+29) 
- (added) libc/shared/builtins/fixunssfsi.h (+29) 
- (added) libc/shared/builtins/fixunssfti.h (+35) 
- (modified) libc/src/__support/builtins/CMakeLists.txt (+124) 
- (added) libc/src/__support/builtins/fixdfdi.h (+32) 
- (added) libc/src/__support/builtins/fixdfsi.h (+32) 
- (added) libc/src/__support/builtins/fixdfti.h (+38) 
- (added) libc/src/__support/builtins/fixint_helper.h (+78) 
- (added) libc/src/__support/builtins/fixsfdi.h (+32) 
- (added) libc/src/__support/builtins/fixsfsi.h (+32) 
- (added) libc/src/__support/builtins/fixsfti.h (+38) 
- (added) libc/src/__support/builtins/fixunsdfdi.h (+32) 
- (added) libc/src/__support/builtins/fixunsdfsi.h (+32) 
- (added) libc/src/__support/builtins/fixunsdfti.h (+38) 
- (added) libc/src/__support/builtins/fixunssfdi.h (+32) 
- (added) libc/src/__support/builtins/fixunssfsi.h (+32) 
- (added) libc/src/__support/builtins/fixunssfti.h (+38) 
- (modified) libc/test/shared/CMakeLists.txt (+12) 
- (modified) libc/test/shared/shared_builtins_test.cpp (+29) 


``````````diff
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index e128fea6a3415..e546aeb96b7ec 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -265,6 +265,18 @@ if(COMPILER_RT_USE_LIBC_MATH)
   add_definitions(-DCOMPILER_RT_USE_LIBC_MATH)
 
   use_libc_builtin(GENERIC_TF_SOURCES addtf3)
+  use_libc_builtin(GENERIC_SOURCES    fixdfsi)
+  use_libc_builtin(GENERIC_SOURCES    fixdfdi)
+  use_libc_builtin(GENERIC_SOURCES    fixdfti)
+  use_libc_builtin(GENERIC_SOURCES    fixsfsi)
+  use_libc_builtin(GENERIC_SOURCES    fixsfdi)
+  use_libc_builtin(GENERIC_SOURCES    fixsfti)
+  use_libc_builtin(GENERIC_SOURCES    fixunsdfsi)
+  use_libc_builtin(GENERIC_SOURCES    fixunsdfdi)
+  use_libc_builtin(GENERIC_SOURCES    fixunsdfti)
+  use_libc_builtin(GENERIC_SOURCES    fixunssfsi)
+  use_libc_builtin(GENERIC_SOURCES    fixunssfdi)
+  use_libc_builtin(GENERIC_SOURCES    fixunssfti)
 endif()
 
 option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN
diff --git a/compiler-rt/lib/builtins/fixdfdi.cpp b/compiler-rt/lib/builtins/fixdfdi.cpp
new file mode 100644
index 0000000000000..7f384b3cd4ee3
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixdfdi.cpp
@@ -0,0 +1,22 @@
+//===-- lib/fixdfdi.cpp - libc-backed __fixdfdi -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixdfdi implemented on top of LLVM-libc's shared::fixdfdi.
+//
+//===----------------------------------------------------------------------===//
+
+#define DOUBLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/fixdfdi.h"
+
+extern "C" COMPILER_RT_ABI di_int __fixdfdi(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixdfdi(a);
+}
diff --git a/compiler-rt/lib/builtins/fixdfsi.cpp b/compiler-rt/lib/builtins/fixdfsi.cpp
new file mode 100644
index 0000000000000..3b597b0226c5d
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixdfsi.cpp
@@ -0,0 +1,22 @@
+//===-- lib/fixdfsi.cpp - libc-backed __fixdfsi -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixdfsi implemented on top of LLVM-libc's shared::fixdfsi.
+//
+//===----------------------------------------------------------------------===//
+
+#define DOUBLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/fixdfsi.h"
+
+extern "C" COMPILER_RT_ABI si_int __fixdfsi(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixdfsi(a);
+}
diff --git a/compiler-rt/lib/builtins/fixdfti.cpp b/compiler-rt/lib/builtins/fixdfti.cpp
new file mode 100644
index 0000000000000..17f4447db71c5
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixdfti.cpp
@@ -0,0 +1,26 @@
+//===-- lib/fixdfti.cpp - libc-backed __fixdfti -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixdfti implemented on top of LLVM-libc's shared::fixdfti.
+//
+//===----------------------------------------------------------------------===//
+
+#include "int_lib.h"
+
+#ifdef CRT_HAS_128BIT
+#define DOUBLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/fixdfti.h"
+
+extern "C" COMPILER_RT_ABI ti_int __fixdfti(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixdfti(a);
+}
+
+#endif // CRT_HAS_128BIT
diff --git a/compiler-rt/lib/builtins/fixsfdi.cpp b/compiler-rt/lib/builtins/fixsfdi.cpp
new file mode 100644
index 0000000000000..9e649bc501e5b
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixsfdi.cpp
@@ -0,0 +1,22 @@
+//===-- lib/fixsfdi.cpp - libc-backed __fixsfdi -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixsfdi implemented on top of LLVM-libc's shared::fixsfdi.
+//
+//===----------------------------------------------------------------------===//
+
+#define SINGLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/fixsfdi.h"
+
+extern "C" COMPILER_RT_ABI di_int __fixsfdi(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixsfdi(a);
+}
diff --git a/compiler-rt/lib/builtins/fixsfsi.cpp b/compiler-rt/lib/builtins/fixsfsi.cpp
new file mode 100644
index 0000000000000..579fb45c28a76
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixsfsi.cpp
@@ -0,0 +1,22 @@
+//===-- lib/fixsfsi.cpp - libc-backed __fixsfsi -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixsfsi implemented on top of LLVM-libc's shared::fixsfsi.
+//
+//===----------------------------------------------------------------------===//
+
+#define SINGLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/fixsfsi.h"
+
+extern "C" COMPILER_RT_ABI si_int __fixsfsi(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixsfsi(a);
+}
diff --git a/compiler-rt/lib/builtins/fixsfti.cpp b/compiler-rt/lib/builtins/fixsfti.cpp
new file mode 100644
index 0000000000000..e3592e94b5196
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixsfti.cpp
@@ -0,0 +1,26 @@
+//===-- lib/fixsfti.cpp - libc-backed __fixsfti -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixsfti implemented on top of LLVM-libc's shared::fixsfti.
+//
+//===----------------------------------------------------------------------===//
+
+#include "int_lib.h"
+
+#ifdef CRT_HAS_128BIT
+#define SINGLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/fixsfti.h"
+
+extern "C" COMPILER_RT_ABI ti_int __fixsfti(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixsfti(a);
+}
+
+#endif // CRT_HAS_128BIT
diff --git a/compiler-rt/lib/builtins/fixunsdfdi.cpp b/compiler-rt/lib/builtins/fixunsdfdi.cpp
new file mode 100644
index 0000000000000..9a31f0744e9df
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixunsdfdi.cpp
@@ -0,0 +1,22 @@
+//===-- lib/fixunsdfdi.cpp - libc-backed __fixunsdfdi -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixunsdfdi implemented on top of LLVM-libc's shared::fixunsdfdi.
+//
+//===----------------------------------------------------------------------===//
+
+#define DOUBLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/fixunsdfdi.h"
+
+extern "C" COMPILER_RT_ABI du_int __fixunsdfdi(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixunsdfdi(a);
+}
diff --git a/compiler-rt/lib/builtins/fixunsdfsi.cpp b/compiler-rt/lib/builtins/fixunsdfsi.cpp
new file mode 100644
index 0000000000000..c23f40dd8ea7b
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixunsdfsi.cpp
@@ -0,0 +1,22 @@
+//===-- lib/fixunsdfsi.cpp - libc-backed __fixunsdfsi -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixunsdfsi implemented on top of LLVM-libc's shared::fixunsdfsi.
+//
+//===----------------------------------------------------------------------===//
+
+#define DOUBLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/fixunsdfsi.h"
+
+extern "C" COMPILER_RT_ABI su_int __fixunsdfsi(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixunsdfsi(a);
+}
diff --git a/compiler-rt/lib/builtins/fixunsdfti.cpp b/compiler-rt/lib/builtins/fixunsdfti.cpp
new file mode 100644
index 0000000000000..9db9a6f1d873e
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixunsdfti.cpp
@@ -0,0 +1,26 @@
+//===-- lib/fixunsdfti.cpp - libc-backed __fixunsdfti -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixunsdfti implemented on top of LLVM-libc's shared::fixunsdfti.
+//
+//===----------------------------------------------------------------------===//
+
+#include "int_lib.h"
+
+#ifdef CRT_HAS_128BIT
+#define DOUBLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/fixunsdfti.h"
+
+extern "C" COMPILER_RT_ABI tu_int __fixunsdfti(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixunsdfti(a);
+}
+
+#endif // CRT_HAS_128BIT
diff --git a/compiler-rt/lib/builtins/fixunssfdi.cpp b/compiler-rt/lib/builtins/fixunssfdi.cpp
new file mode 100644
index 0000000000000..eb21e38c4f575
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixunssfdi.cpp
@@ -0,0 +1,22 @@
+//===-- lib/fixunssfdi.cpp - libc-backed __fixunssfdi -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixunssfdi implemented on top of LLVM-libc's shared::fixunssfdi.
+//
+//===----------------------------------------------------------------------===//
+
+#define SINGLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/fixunssfdi.h"
+
+extern "C" COMPILER_RT_ABI du_int __fixunssfdi(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixunssfdi(a);
+}
diff --git a/compiler-rt/lib/builtins/fixunssfsi.cpp b/compiler-rt/lib/builtins/fixunssfsi.cpp
new file mode 100644
index 0000000000000..7ee2dfd8a03c6
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixunssfsi.cpp
@@ -0,0 +1,22 @@
+//===-- lib/fixunssfsi.cpp - libc-backed __fixunssfsi -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixunssfsi implemented on top of LLVM-libc's shared::fixunssfsi.
+//
+//===----------------------------------------------------------------------===//
+
+#define SINGLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "int_lib.h"
+#include "shared/builtins/fixunssfsi.h"
+
+extern "C" COMPILER_RT_ABI su_int __fixunssfsi(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixunssfsi(a);
+}
diff --git a/compiler-rt/lib/builtins/fixunssfti.cpp b/compiler-rt/lib/builtins/fixunssfti.cpp
new file mode 100644
index 0000000000000..c577cc957786c
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixunssfti.cpp
@@ -0,0 +1,26 @@
+//===-- lib/fixunssfti.cpp - libc-backed __fixunssfti -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// __fixunssfti implemented on top of LLVM-libc's shared::fixunssfti.
+//
+//===----------------------------------------------------------------------===//
+
+#include "int_lib.h"
+
+#ifdef CRT_HAS_128BIT
+#define SINGLE_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/fixunssfti.h"
+
+extern "C" COMPILER_RT_ABI tu_int __fixunssfti(fp_t a) {
+  return LIBC_NAMESPACE::shared::fixunssfti(a);
+}
+
+#endif // CRT_HAS_128BIT
diff --git a/libc/shared/builtins.h b/libc/shared/builtins.h
index a6a8973beda25..e6e435480d527 100644
--- a/libc/shared/builtins.h
+++ b/libc/shared/builtins.h
@@ -22,6 +22,18 @@
 #include "builtins/addtf3.h"
 #include "builtins/divdf3.h"
 #include "builtins/divtf3.h"
+#include "builtins/fixdfdi.h"
+#include "builtins/fixdfsi.h"
+#include "builtins/fixdfti.h"
+#include "builtins/fixsfdi.h"
+#include "builtins/fixsfsi.h"
+#include "builtins/fixsfti.h"
+#include "builtins/fixunsdfdi.h"
+#include "builtins/fixunsdfsi.h"
+#include "builtins/fixunsdfti.h"
+#include "builtins/fixunssfdi.h"
+#include "builtins/fixunssfsi.h"
+#include "builtins/fixunssfti.h"
 #include "builtins/muldf3.h"
 #include "builtins/multf3.h"
 #include "builtins/subdf3.h"
diff --git a/libc/shared/builtins/fixdfdi.h b/libc/shared/builtins/fixdfdi.h
new file mode 100644
index 0000000000000..2a0eb4da645a1
--- /dev/null
+++ b/libc/shared/builtins/fixdfdi.h
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This header exposes LLVM-libc's __fixdfdi implementation as shared::fixdfdi
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_FIXDFDI_H
+#define LLVM_LIBC_SHARED_BUILTINS_FIXDFDI_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/fixdfdi.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::fixdfdi;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_FIXDFDI_H
diff --git a/libc/shared/builtins/fixdfsi.h b/libc/shared/builtins/fixdfsi.h
new file mode 100644
index 0000000000000..ab7dae3688c5c
--- /dev/null
+++ b/libc/shared/builtins/fixdfsi.h
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This header exposes LLVM-libc's __fixdfsi implementation as shared::fixdfsi
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_FIXDFSI_H
+#define LLVM_LIBC_SHARED_BUILTINS_FIXDFSI_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/fixdfsi.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::fixdfsi;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_FIXDFSI_H
diff --git a/libc/shared/builtins/fixdfti.h b/libc/shared/builtins/fixdfti.h
new file mode 100644
index 0000000000000..bd83e706fd9a7
--- /dev/null
+++ b/libc/shared/builtins/fixdfti.h
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This header exposes LLVM-libc's __fixdfti implementation as shared::fixdfti
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_FIXDFTI_H
+#define LLVM_LIBC_SHARED_BUILTINS_FIXDFTI_H
+
+#include "src/__support/macros/properties/types.h"
+
+#ifdef LIBC_TYPES_HAS_INT128
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/fixdfti.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::fixdfti;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_INT128
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_FIXDFTI_H
diff --git a/libc/shared/builtins/fixsfdi.h b/libc/shared/builtins/fixsfdi.h
new file mode 100644
index 0000000000000..ff969a6551a44
--- /dev/null
+++ b/libc/shared/builtins/fixsfdi.h
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This header exposes LLVM-libc's __fixsfdi implementation as shared::fixsfdi
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_FIXSFDI_H
+#define LLVM_LIBC_SHARED_BUILTINS_FIXSFDI_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/fixsfdi.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::fixsfdi;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_FIXSFDI_H
diff --git a/libc/shared/builtins/fixsfsi.h b/libc/shared/builtins/fixsfsi.h
new file mode 100644
index 0000000000000..debd82aefc8eb
--- /dev/null
+++ b/libc/shared/builtins/fixsfsi.h
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This header exposes LLVM-libc's __fixsfsi implementation as shared::fixsfsi
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_FIXSFSI_H
+#define LLVM_LIBC_SHARED_BUILTINS_FIXSFSI_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/fixsfsi.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::fixsfsi;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_FIXSFSI_H
diff --git a/libc/shared/builtins/fixsfti.h b/libc/shared/builtins/fixsfti.h
new file mode 100644
index 0000000000000..191fb5292b92b
--- /dev/null
+++ b/libc/shared/builtins/fixsfti.h
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exce...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/207543


More information about the libc-commits mailing list