Skip to content

[libc] add shared divsf3 builtin - #205679

Merged
hulxv merged 10 commits into
llvm:mainfrom
hulxv:libc/feat/builtins/divsf3
Jul 9, 2026
Merged

[libc] add shared divsf3 builtin#205679
hulxv merged 10 commits into
llvm:mainfrom
hulxv:libc/feat/builtins/divsf3

Conversation

@hulxv
hulxv requested a review from a team as a code owner June 24, 2026 21:03
@hulxv
hulxv force-pushed the libc/feat/builtins/divsf3 branch from a2d0605 to c6392b6 Compare June 25, 2026 16:17
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

🪟 Windows x64 Test Results

  • 126699 tests passed
  • 2993 tests skipped

✅ The build succeeded and all tests passed.

@hulxv
hulxv force-pushed the libc/feat/builtins/divsf3 branch from 90f4d56 to a9dacdd Compare June 26, 2026 20:02
@hulxv
hulxv force-pushed the libc/feat/builtins/divsf3 branch from a9dacdd to a3d41b6 Compare June 28, 2026 00:21
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-libc

Author: hulxv (hulxv)

Changes

Re-exposes LLVM-libc's __divsf3 as shared::divsf3 for reuse by compiler-rt's builtins.

Stacked change - merge these first:

  • #200094
  • #205669
  • #205670
  • #205671
  • #205672
  • #205673
  • #205674
  • #205675
  • #205676
  • #205677
  • #205678

Part of #197824


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

18 Files Affected:

  • (modified) libc/shared/builtins.h (+7)
  • (added) libc/shared/builtins/addsf3.h (+29)
  • (added) libc/shared/builtins/divdf3.h (+29)
  • (added) libc/shared/builtins/divsf3.h (+29)
  • (added) libc/shared/builtins/muldf3.h (+29)
  • (added) libc/shared/builtins/mulsf3.h (+29)
  • (added) libc/shared/builtins/subdf3.h (+29)
  • (added) libc/shared/builtins/subsf3.h (+29)
  • (modified) libc/src/__support/builtins/CMakeLists.txt (+63)
  • (added) libc/src/__support/builtins/addsf3.h (+32)
  • (added) libc/src/__support/builtins/divdf3.h (+32)
  • (added) libc/src/__support/builtins/divsf3.h (+32)
  • (added) libc/src/__support/builtins/muldf3.h (+32)
  • (added) libc/src/__support/builtins/mulsf3.h (+32)
  • (added) libc/src/__support/builtins/subdf3.h (+32)
  • (added) libc/src/__support/builtins/subsf3.h (+32)
  • (modified) libc/test/shared/CMakeLists.txt (+7)
  • (modified) libc/test/shared/shared_builtins_test.cpp (+7-1)
diff --git a/libc/shared/builtins.h b/libc/shared/builtins.h
index dca0171c02d18..ced054cb02582 100644
--- a/libc/shared/builtins.h
+++ b/libc/shared/builtins.h
@@ -18,9 +18,16 @@
 #include "libc_common.h"
 
 #include "builtins/adddf3.h"
+#include "builtins/addsf3.h"
 #include "builtins/addtf3.h"
+#include "builtins/divdf3.h"
+#include "builtins/divsf3.h"
 #include "builtins/divtf3.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"
 
 #endif // LLVM_LIBC_SHARED_BUILTINS_H
diff --git a/libc/shared/builtins/addsf3.h b/libc/shared/builtins/addsf3.h
new file mode 100644
index 0000000000000..58f8797d93705
--- /dev/null
+++ b/libc/shared/builtins/addsf3.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 __addsf3 implementation as shared::addsf3 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_ADDSF3_H
+#define LLVM_LIBC_SHARED_BUILTINS_ADDSF3_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/addsf3.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::addsf3;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_ADDSF3_H
diff --git a/libc/shared/builtins/divdf3.h b/libc/shared/builtins/divdf3.h
new file mode 100644
index 0000000000000..4cabc847b7a02
--- /dev/null
+++ b/libc/shared/builtins/divdf3.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 __divdf3 implementation as shared::divdf3 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_DIVDF3_H
+#define LLVM_LIBC_SHARED_BUILTINS_DIVDF3_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/divdf3.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::divdf3;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_DIVDF3_H
diff --git a/libc/shared/builtins/divsf3.h b/libc/shared/builtins/divsf3.h
new file mode 100644
index 0000000000000..edb6aec227760
--- /dev/null
+++ b/libc/shared/builtins/divsf3.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 __divsf3 implementation as shared::divsf3 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_DIVSF3_H
+#define LLVM_LIBC_SHARED_BUILTINS_DIVSF3_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/divsf3.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::divsf3;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_DIVSF3_H
diff --git a/libc/shared/builtins/muldf3.h b/libc/shared/builtins/muldf3.h
new file mode 100644
index 0000000000000..702c73428e5f4
--- /dev/null
+++ b/libc/shared/builtins/muldf3.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 __muldf3 implementation as shared::muldf3 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_MULDF3_H
+#define LLVM_LIBC_SHARED_BUILTINS_MULDF3_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/muldf3.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::muldf3;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_MULDF3_H
diff --git a/libc/shared/builtins/mulsf3.h b/libc/shared/builtins/mulsf3.h
new file mode 100644
index 0000000000000..b0b24b1b2e620
--- /dev/null
+++ b/libc/shared/builtins/mulsf3.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 __mulsf3 implementation as shared::mulsf3 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_MULSF3_H
+#define LLVM_LIBC_SHARED_BUILTINS_MULSF3_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/mulsf3.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::mulsf3;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_MULSF3_H
diff --git a/libc/shared/builtins/subdf3.h b/libc/shared/builtins/subdf3.h
new file mode 100644
index 0000000000000..8cff7e3bfa28f
--- /dev/null
+++ b/libc/shared/builtins/subdf3.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 __subdf3 implementation as shared::subdf3 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_SUBDF3_H
+#define LLVM_LIBC_SHARED_BUILTINS_SUBDF3_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/subdf3.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::subdf3;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_SUBDF3_H
diff --git a/libc/shared/builtins/subsf3.h b/libc/shared/builtins/subsf3.h
new file mode 100644
index 0000000000000..3f92aa1c2828c
--- /dev/null
+++ b/libc/shared/builtins/subsf3.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 __subsf3 implementation as shared::subsf3 so
+/// that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_BUILTINS_SUBSF3_H
+#define LLVM_LIBC_SHARED_BUILTINS_SUBSF3_H
+
+#include "shared/libc_common.h"
+#include "src/__support/builtins/subsf3.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using builtins::subsf3;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_BUILTINS_SUBSF3_H
diff --git a/libc/src/__support/builtins/CMakeLists.txt b/libc/src/__support/builtins/CMakeLists.txt
index dee5a830b8857..f5b5ffe3e07b4 100644
--- a/libc/src/__support/builtins/CMakeLists.txt
+++ b/libc/src/__support/builtins/CMakeLists.txt
@@ -46,3 +46,66 @@ add_header_library(
     libc.src.__support.FPUtil.generic.add_sub
     libc.src.__support.macros.config
 )
+
+add_header_library(
+  subdf3
+  HDRS
+    subdf3.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.add_sub
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  muldf3
+  HDRS
+    muldf3.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.mul
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  divdf3
+  HDRS
+    divdf3.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.div
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  addsf3
+  HDRS
+    addsf3.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.add_sub
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  subsf3
+  HDRS
+    subsf3.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.add_sub
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  mulsf3
+  HDRS
+    mulsf3.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.mul
+    libc.src.__support.macros.config
+)
+
+add_header_library(
+  divsf3
+  HDRS
+    divsf3.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.div
+    libc.src.__support.macros.config
+)
diff --git a/libc/src/__support/builtins/addsf3.h b/libc/src/__support/builtins/addsf3.h
new file mode 100644
index 0000000000000..5fa55e30dd0c6
--- /dev/null
+++ b/libc/src/__support/builtins/addsf3.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __addsf3 implementation as builtins::addsf3
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_ADDSF3_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_ADDSF3_H
+
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Addition at float precision; mirrors compiler-rt's __addsf3.
+LIBC_INLINE float addsf3(float x, float y) {
+  return fputil::generic::add<float>(x, y);
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_ADDSF3_H
diff --git a/libc/src/__support/builtins/divdf3.h b/libc/src/__support/builtins/divdf3.h
new file mode 100644
index 0000000000000..b9af2252be389
--- /dev/null
+++ b/libc/src/__support/builtins/divdf3.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __divdf3 implementation as builtins::divdf3
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_DIVDF3_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_DIVDF3_H
+
+#include "src/__support/FPUtil/generic/div.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Division at double precision; mirrors compiler-rt's __divdf3.
+LIBC_INLINE double divdf3(double x, double y) {
+  return fputil::generic::div<double>(x, y);
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_DIVDF3_H
diff --git a/libc/src/__support/builtins/divsf3.h b/libc/src/__support/builtins/divsf3.h
new file mode 100644
index 0000000000000..681b705f9e666
--- /dev/null
+++ b/libc/src/__support/builtins/divsf3.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __divsf3 implementation as builtins::divsf3
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_DIVSF3_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_DIVSF3_H
+
+#include "src/__support/FPUtil/generic/div.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Division at float precision; mirrors compiler-rt's __divsf3.
+LIBC_INLINE float divsf3(float x, float y) {
+  return fputil::generic::div<float>(x, y);
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_DIVSF3_H
diff --git a/libc/src/__support/builtins/muldf3.h b/libc/src/__support/builtins/muldf3.h
new file mode 100644
index 0000000000000..b407b96ef90b4
--- /dev/null
+++ b/libc/src/__support/builtins/muldf3.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __muldf3 implementation as builtins::muldf3
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_MULDF3_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_MULDF3_H
+
+#include "src/__support/FPUtil/generic/mul.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Multiplication at double precision; mirrors compiler-rt's __muldf3.
+LIBC_INLINE double muldf3(double x, double y) {
+  return fputil::generic::mul<double>(x, y);
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_MULDF3_H
diff --git a/libc/src/__support/builtins/mulsf3.h b/libc/src/__support/builtins/mulsf3.h
new file mode 100644
index 0000000000000..d1fef264d945a
--- /dev/null
+++ b/libc/src/__support/builtins/mulsf3.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __mulsf3 implementation as builtins::mulsf3
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_MULSF3_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_MULSF3_H
+
+#include "src/__support/FPUtil/generic/mul.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Multiplication at float precision; mirrors compiler-rt's __mulsf3.
+LIBC_INLINE float mulsf3(float x, float y) {
+  return fputil::generic::mul<float>(x, y);
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_MULSF3_H
diff --git a/libc/src/__support/builtins/subdf3.h b/libc/src/__support/builtins/subdf3.h
new file mode 100644
index 0000000000000..5e704aa714af6
--- /dev/null
+++ b/libc/src/__support/builtins/subdf3.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __subdf3 implementation as builtins::subdf3
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_SUBDF3_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_SUBDF3_H
+
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Subtraction at double precision; mirrors compiler-rt's __subdf3.
+LIBC_INLINE double subdf3(double x, double y) {
+  return fputil::generic::sub<double>(x, y);
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_SUBDF3_H
diff --git a/libc/src/__support/builtins/subsf3.h b/libc/src/__support/builtins/subsf3.h
new file mode 100644
index 0000000000000..e45c8ce43a896
--- /dev/null
+++ b/libc/src/__support/builtins/subsf3.h
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 __subsf3 implementation as builtins::subsf3
+/// so that it can be reused by compiler-rt's builtins.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_BUILTINS_SUBSF3_H
+#define LLVM_LIBC_SRC___SUPPORT_BUILTINS_SUBSF3_H
+
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace builtins {
+
+// Subtraction at float precision; mirrors compiler-rt's __subsf3.
+LIBC_INLINE float subsf3(float x, float y) {
+  return fputil::generic::sub<float>(x, y);
+}
+
+} // namespace builtins
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_BUILTINS_SUBSF3_H
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 120524bed5ead..6efe8365b1557 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -828,9 +828,16 @@ add_fp_unittest(
     shared_builtins_test.cpp
   DEPENDS
     libc.src.__support.builtins.adddf3
+    libc.src.__support.builtins.addsf3
     libc.src.__support.builtins.addtf3
+    libc.src.__support.builtins.divdf3
+    libc.src.__support.builtins.divsf3
     libc.src.__support.builtins.divtf3
+    libc.src.__support.builtins.muldf3
+    libc.src.__support.builtins.mulsf3
     libc.src.__supp...
[truncated]

@hulxv
hulxv merged commit 232f98e into llvm:main Jul 9, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants