[libc-commits] [compiler-rt] [libc] [compiler-rt][builtins] libc-backed bfloat16 extend/truncate builtins (PR #211881)

via libc-commits libc-commits at lists.llvm.org
Fri Jul 24 11:54:59 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 bfloat16 extend/truncate builtins

depends on:
   - #<!-- -->209984 
   
Part of #<!-- -->197824

---

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


42 Files Affected:

- (modified) compiler-rt/lib/builtins/CMakeLists.txt (+33-21) 
- (added) compiler-rt/lib/builtins/extendbfsf2.cpp (+24) 
- (added) compiler-rt/lib/builtins/extenddftf2.cpp (+25) 
- (added) compiler-rt/lib/builtins/extendsfdf2.cpp (+21) 
- (added) compiler-rt/lib/builtins/extendsftf2.cpp (+25) 
- (added) compiler-rt/lib/builtins/extendxftf2.cpp (+25) 
- (added) compiler-rt/lib/builtins/truncdfbf2.cpp (+24) 
- (added) compiler-rt/lib/builtins/truncdfsf2.cpp (+21) 
- (added) compiler-rt/lib/builtins/truncsfbf2.cpp (+24) 
- (added) compiler-rt/lib/builtins/trunctfbf2.cpp (+29) 
- (added) compiler-rt/lib/builtins/trunctfdf2.cpp (+25) 
- (added) compiler-rt/lib/builtins/trunctfsf2.cpp (+25) 
- (added) compiler-rt/lib/builtins/trunctfxf2.cpp (+25) 
- (modified) libc/shared/builtins.h (+12) 
- (added) libc/shared/builtins/extendbfsf2.h (+29) 
- (added) libc/shared/builtins/extenddftf2.h (+35) 
- (added) libc/shared/builtins/extendsfdf2.h (+29) 
- (added) libc/shared/builtins/extendsftf2.h (+35) 
- (added) libc/shared/builtins/extendxftf2.h (+37) 
- (added) libc/shared/builtins/truncdfbf2.h (+29) 
- (added) libc/shared/builtins/truncdfsf2.h (+29) 
- (added) libc/shared/builtins/truncsfbf2.h (+29) 
- (added) libc/shared/builtins/trunctfbf2.h (+35) 
- (added) libc/shared/builtins/trunctfdf2.h (+35) 
- (added) libc/shared/builtins/trunctfsf2.h (+35) 
- (added) libc/shared/builtins/trunctfxf2.h (+37) 
- (modified) libc/src/__support/builtins/CMakeLists.txt (+138) 
- (added) libc/src/__support/builtins/extendbfsf2.h (+35) 
- (added) libc/src/__support/builtins/extenddftf2.h (+36) 
- (added) libc/src/__support/builtins/extendsfdf2.h (+30) 
- (added) libc/src/__support/builtins/extendsftf2.h (+36) 
- (added) libc/src/__support/builtins/extendxftf2.h (+40) 
- (added) libc/src/__support/builtins/fpconvert_helper.h (+79) 
- (added) libc/src/__support/builtins/truncdfbf2.h (+33) 
- (added) libc/src/__support/builtins/truncdfsf2.h (+30) 
- (added) libc/src/__support/builtins/truncsfbf2.h (+33) 
- (added) libc/src/__support/builtins/trunctfbf2.h (+39) 
- (added) libc/src/__support/builtins/trunctfdf2.h (+36) 
- (added) libc/src/__support/builtins/trunctfsf2.h (+36) 
- (added) libc/src/__support/builtins/trunctfxf2.h (+40) 
- (modified) libc/test/shared/CMakeLists.txt (+12) 
- (modified) libc/test/shared/shared_builtins_test.cpp (+30) 


``````````diff
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index ea21c36d3d31f..f59173e016411 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -243,6 +243,27 @@ set(GENERIC_TF_SOURCES
   trunctfsf2.c
 )
 
+# Implement extended-precision builtins, assuming long double is 80 bits.
+# long double is not 80 bits on Android or MSVC.
+set(x86_80_BIT_SOURCES
+  divxc3.c
+  extendhfxf2.c
+  extendxftf2.c
+  fixxfdi.c
+  fixxfti.c
+  fixunsxfdi.c
+  fixunsxfsi.c
+  fixunsxfti.c
+  floatdixf.c
+  floattixf.c
+  floatundixf.c
+  floatuntixf.c
+  mulxc3.c
+  powixf2.c
+  trunctfxf2.c
+  truncxfhf2.c
+)
+
 option(COMPILER_RT_USE_LIBC_MATH
       "Use LLVM libc math routines for floating-point builtins" OFF)
 
@@ -265,6 +286,18 @@ if(COMPILER_RT_USE_LIBC_MATH)
   add_definitions(-DCOMPILER_RT_USE_LIBC_MATH)
 
   use_libc_builtin(GENERIC_TF_SOURCES addtf3)
+  use_libc_builtin(BF16_SOURCES       extendbfsf2)
+  use_libc_builtin(GENERIC_TF_SOURCES extenddftf2)
+  use_libc_builtin(GENERIC_SOURCES    extendsfdf2)
+  use_libc_builtin(GENERIC_TF_SOURCES extendsftf2)
+  use_libc_builtin(x86_80_BIT_SOURCES extendxftf2)
+  use_libc_builtin(GENERIC_SOURCES    truncdfsf2)  
+  use_libc_builtin(BF16_SOURCES       truncdfbf2)
+  use_libc_builtin(BF16_SOURCES       truncsfbf2)
+  use_libc_builtin(BF16_SOURCES       trunctfbf2)
+  use_libc_builtin(GENERIC_TF_SOURCES trunctfdf2)
+  use_libc_builtin(GENERIC_TF_SOURCES trunctfsf2)
+  use_libc_builtin(x86_80_BIT_SOURCES trunctfxf2)
 endif()
 
 option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN
@@ -336,27 +369,6 @@ if (NOT MSVC)
   )
 endif ()
 
-# Implement extended-precision builtins, assuming long double is 80 bits.
-# long double is not 80 bits on Android or MSVC.
-set(x86_80_BIT_SOURCES
-  divxc3.c
-  extendhfxf2.c
-  extendxftf2.c
-  fixxfdi.c
-  fixxfti.c
-  fixunsxfdi.c
-  fixunsxfsi.c
-  fixunsxfti.c
-  floatdixf.c
-  floattixf.c
-  floatundixf.c
-  floatuntixf.c
-  mulxc3.c
-  powixf2.c
-  trunctfxf2.c
-  truncxfhf2.c
-)
-
 if (NOT MSVC)
   set(x86_64_SOURCES
     ${GENERIC_SOURCES}
diff --git a/compiler-rt/lib/builtins/extendbfsf2.cpp b/compiler-rt/lib/builtins/extendbfsf2.cpp
new file mode 100644
index 0000000000000..74c56803d5c65
--- /dev/null
+++ b/compiler-rt/lib/builtins/extendbfsf2.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __extendbfsf2, extend bfloat16 to float,
+/// on top of LLVM-libc's shared::extendbfsf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define SRC_BFLOAT16
+#define DST_SINGLE
+#include "fp_extend.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/extendbfsf2.h"
+
+extern "C" COMPILER_RT_ABI dst_t __extendbfsf2(src_t a) {
+  return LIBC_NAMESPACE::shared::extendbfsf2(__builtin_bit_cast(uint16_t, a));
+}
diff --git a/compiler-rt/lib/builtins/extenddftf2.cpp b/compiler-rt/lib/builtins/extenddftf2.cpp
new file mode 100644
index 0000000000000..38f201316a1cd
--- /dev/null
+++ b/compiler-rt/lib/builtins/extenddftf2.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __extenddftf2, extend double to float128,
+/// on top of LLVM-libc's shared::extenddftf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/extenddftf2.h"
+
+#ifdef CRT_HAS_TF_MODE
+extern "C" COMPILER_RT_ABI tf_float __extenddftf2(double a) {
+  return LIBC_NAMESPACE::shared::extenddftf2(a);
+}
+#endif
diff --git a/compiler-rt/lib/builtins/extendsfdf2.cpp b/compiler-rt/lib/builtins/extendsfdf2.cpp
new file mode 100644
index 0000000000000..e7c48dbac0cd8
--- /dev/null
+++ b/compiler-rt/lib/builtins/extendsfdf2.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __extendsfdf2, extend float to double, on
+/// top of LLVM-libc's shared::extendsfdf2.
+///
+//===----------------------------------------------------------------------===//
+
+#include "shared/builtins/extendsfdf2.h"
+#include "fp_libc_config.h"
+#include "int_lib.h"
+
+extern "C" COMPILER_RT_ABI double __extendsfdf2(float a) {
+  return LIBC_NAMESPACE::shared::extendsfdf2(a);
+}
diff --git a/compiler-rt/lib/builtins/extendsftf2.cpp b/compiler-rt/lib/builtins/extendsftf2.cpp
new file mode 100644
index 0000000000000..0c6cc83b9d142
--- /dev/null
+++ b/compiler-rt/lib/builtins/extendsftf2.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __extendsftf2, extend float to float128,
+/// on top of LLVM-libc's shared::extendsftf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/extendsftf2.h"
+
+#ifdef CRT_HAS_TF_MODE
+extern "C" COMPILER_RT_ABI tf_float __extendsftf2(float a) {
+  return LIBC_NAMESPACE::shared::extendsftf2(a);
+}
+#endif
diff --git a/compiler-rt/lib/builtins/extendxftf2.cpp b/compiler-rt/lib/builtins/extendxftf2.cpp
new file mode 100644
index 0000000000000..5c0c91118ecbe
--- /dev/null
+++ b/compiler-rt/lib/builtins/extendxftf2.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __extendxftf2, extend long double to
+/// float128, on top of LLVM-libc's shared::extendxftf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/extendxftf2.h"
+
+#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__)
+extern "C" COMPILER_RT_ABI tf_float __extendxftf2(xf_float a) {
+  return LIBC_NAMESPACE::shared::extendxftf2(a);
+}
+#endif
diff --git a/compiler-rt/lib/builtins/truncdfbf2.cpp b/compiler-rt/lib/builtins/truncdfbf2.cpp
new file mode 100644
index 0000000000000..a5ae505b03553
--- /dev/null
+++ b/compiler-rt/lib/builtins/truncdfbf2.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __truncdfbf2, truncate double to
+/// bfloat16, on top of LLVM-libc's shared::truncdfbf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define SRC_DOUBLE
+#define DST_BFLOAT
+#include "fp_trunc.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/truncdfbf2.h"
+
+extern "C" COMPILER_RT_ABI dst_t __truncdfbf2(src_t a) {
+  return __builtin_bit_cast(dst_t, LIBC_NAMESPACE::shared::truncdfbf2(a));
+}
diff --git a/compiler-rt/lib/builtins/truncdfsf2.cpp b/compiler-rt/lib/builtins/truncdfsf2.cpp
new file mode 100644
index 0000000000000..775526dbff96a
--- /dev/null
+++ b/compiler-rt/lib/builtins/truncdfsf2.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __truncdfsf2, truncate double to float,
+/// on top of LLVM-libc's shared::truncdfsf2.
+///
+//===----------------------------------------------------------------------===//
+
+#include "shared/builtins/truncdfsf2.h"
+#include "fp_libc_config.h"
+#include "int_lib.h"
+
+extern "C" COMPILER_RT_ABI float __truncdfsf2(double a) {
+  return LIBC_NAMESPACE::shared::truncdfsf2(a);
+}
diff --git a/compiler-rt/lib/builtins/truncsfbf2.cpp b/compiler-rt/lib/builtins/truncsfbf2.cpp
new file mode 100644
index 0000000000000..91011f086ad85
--- /dev/null
+++ b/compiler-rt/lib/builtins/truncsfbf2.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __truncsfbf2, truncate float to bfloat16,
+/// on top of LLVM-libc's shared::truncsfbf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define SRC_SINGLE
+#define DST_BFLOAT
+#include "fp_trunc.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/truncsfbf2.h"
+
+extern "C" COMPILER_RT_ABI dst_t __truncsfbf2(src_t a) {
+  return __builtin_bit_cast(dst_t, LIBC_NAMESPACE::shared::truncsfbf2(a));
+}
diff --git a/compiler-rt/lib/builtins/trunctfbf2.cpp b/compiler-rt/lib/builtins/trunctfbf2.cpp
new file mode 100644
index 0000000000000..d789111907fd3
--- /dev/null
+++ b/compiler-rt/lib/builtins/trunctfbf2.cpp
@@ -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 file implements compiler-rt's __trunctfbf2, truncate float128 to
+/// bfloat16, on top of LLVM-libc's shared::trunctfbf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/trunctfbf2.h"
+
+#if defined(CRT_HAS_TF_MODE) && defined(__x86_64__)
+#define SRC_QUAD
+#define DST_BFLOAT
+#include "fp_trunc.h"
+
+extern "C" COMPILER_RT_ABI dst_t __trunctfbf2(src_t a) {
+  return __builtin_bit_cast(dst_t, LIBC_NAMESPACE::shared::trunctfbf2(a));
+}
+#endif
diff --git a/compiler-rt/lib/builtins/trunctfdf2.cpp b/compiler-rt/lib/builtins/trunctfdf2.cpp
new file mode 100644
index 0000000000000..487a09bba0071
--- /dev/null
+++ b/compiler-rt/lib/builtins/trunctfdf2.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __trunctfdf2, truncate float128 to
+/// double, on top of LLVM-libc's shared::trunctfdf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/trunctfdf2.h"
+
+#ifdef CRT_HAS_TF_MODE
+extern "C" COMPILER_RT_ABI double __trunctfdf2(tf_float a) {
+  return LIBC_NAMESPACE::shared::trunctfdf2(a);
+}
+#endif
diff --git a/compiler-rt/lib/builtins/trunctfsf2.cpp b/compiler-rt/lib/builtins/trunctfsf2.cpp
new file mode 100644
index 0000000000000..2486cb3a39a7f
--- /dev/null
+++ b/compiler-rt/lib/builtins/trunctfsf2.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __trunctfsf2, truncate float128 to float,
+/// on top of LLVM-libc's shared::trunctfsf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/trunctfsf2.h"
+
+#ifdef CRT_HAS_TF_MODE
+extern "C" COMPILER_RT_ABI float __trunctfsf2(tf_float a) {
+  return LIBC_NAMESPACE::shared::trunctfsf2(a);
+}
+#endif
diff --git a/compiler-rt/lib/builtins/trunctfxf2.cpp b/compiler-rt/lib/builtins/trunctfxf2.cpp
new file mode 100644
index 0000000000000..88dae578025bc
--- /dev/null
+++ b/compiler-rt/lib/builtins/trunctfxf2.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 file implements compiler-rt's __trunctfxf2, truncate float128 to long
+/// double, on top of LLVM-libc's shared::trunctfxf2.
+///
+//===----------------------------------------------------------------------===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+
+#include "fp_libc_config.h"
+#include "shared/builtins/trunctfxf2.h"
+
+#if defined(CRT_HAS_TF_MODE) && __LDBL_MANT_DIG__ == 64 && defined(__x86_64__)
+extern "C" COMPILER_RT_ABI xf_float __trunctfxf2(tf_float a) {
+  return LIBC_NAMESPACE::shared::trunctfxf2(a);
+}
+#endif
diff --git a/libc/shared/builtins.h b/libc/shared/builtins.h
index ced054cb02582..485aa25866a09 100644
--- a/libc/shared/builtins.h
+++ b/libc/shared/builtins.h
@@ -23,11 +23,23 @@
 #include "builtins/divdf3.h"
 #include "builtins/divsf3.h"
 #include "builtins/divtf3.h"
+#include "builtins/extendbfsf2.h"
+#include "builtins/extenddftf2.h"
+#include "builtins/extendsfdf2.h"
+#include "builtins/extendsftf2.h"
+#include "builtins/extendxftf2.h"
 #include "builtins/muldf3.h"
 #include "builtins/mulsf3.h"
 #include "builtins/multf3.h"
 #include "builtins/subdf3.h"
 #include "builtins/subsf3.h"
 #include "builtins/subtf3.h"
+#include "builtins/truncdfbf2.h"
+#include "builtins/truncdfsf2.h"
+#include "builtins/truncsfbf2.h"
+#include "builtins/trunctfbf2.h"
+#include "builtins/trunctfdf2.h"
+#include "builtins/trunctfsf2.h"
+#include "builtins/trunctfxf2.h"
 
 #endif // LLVM_LIBC_SHARED_BUILTINS_H
diff --git a/libc/shared/builtins/extendbfsf2.h b/libc/shared/builtins/extendbfsf2.h
new file mode 100644
index 0000000000000..f660301a5e31c
--- /dev/null
+++ b/libc/shared/builtins/extendbfsf2.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 __extendbfsf2 implementation as
+/// shared::extendbfsf2 so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_EXTENDBFSF2_H
+#define LLVM_LIBC_SHARED_BUILTINS_EXTENDBFSF2_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/extendbfsf2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::extendbfsf2;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_EXTENDBFSF2_H
diff --git a/libc/shared/builtins/extenddftf2.h b/libc/shared/builtins/extenddftf2.h
new file mode 100644
index 0000000000000..4790d48371eef
--- /dev/null
+++ b/libc/shared/builtins/extenddftf2.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 __extenddftf2 implementation as
+/// shared::extenddftf2 so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_EXTENDDFTF2_H
+#define LLVM_LIBC_SHARED_BUILTINS_EXTENDDFTF2_H
+
+#include "include/llvm-libc-types/float128.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/extenddftf2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::extenddftf2;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_EXTENDDFTF2_H
diff --git a/libc/shared/builtins/extendsfdf2.h b/libc/shared/builtins/extendsfdf2.h
new file mode 100644
index 0000000000000..4f361ff9b4b9e
--- /dev/null
+++ b/libc/shared/builtins/extendsfdf2.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 __extendsfdf2 implementation as
+/// shared::extendsfdf2 so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_EXTENDSFDF2_H
+#define LLVM_LIBC_SHARED_BUILTINS_EXTENDSFDF2_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/extendsfdf2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::extendsfdf2;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_EXTENDSFDF2_H
diff --git a/libc/shared/builtins/extendsftf2.h b/libc/shared/builtins/extendsftf2.h
new file mode 100644
index 0000000000000..93395df407981
--- /dev/null
+++ b/libc/shared/builtins/extendsftf2.h
@@ -0,0 +1,35 @@
+//===---------------------...
[truncated]

``````````

</details>


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


More information about the libc-commits mailing list