[libc-commits] [libc] [llvm] [libc][math] Refactor f16fmaf128 to Header Only (PR #177850)

via libc-commits libc-commits at lists.llvm.org
Thu Jan 29 09:24:02 PST 2026


https://github.com/Sukumarsawant updated https://github.com/llvm/llvm-project/pull/177850

>From 18f587af2b18cabfa93bd5f94facaee69c5f706e Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Sun, 25 Jan 2026 02:37:26 +0530
Subject: [PATCH 1/6] new files added

---
 libc/shared/math/f16fmaf128.h        | 30 ++++++++++++++++++++++++
 libc/src/__support/math/f16fmaf128.h | 34 ++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 libc/shared/math/f16fmaf128.h
 create mode 100644 libc/src/__support/math/f16fmaf128.h

diff --git a/libc/shared/math/f16fmaf128.h b/libc/shared/math/f16fmaf128.h
new file mode 100644
index 0000000000000..f3dc9f07db550
--- /dev/null
+++ b/libc/shared/math/f16fmaf128.h
@@ -0,0 +1,30 @@
+//===-- Shared f16fmaf128 function -------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_F16FMAF128_H
+#define LLVM_LIBC_SHARED_MATH_F16FMAF128_H
+
+#include "include/llvm-libc-macros/float128-macros.h"
+#include "shared/libc_common.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+
+#include "src/__support/math/f16fmaf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::f16fmaf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_F16FMAF128_H
diff --git a/libc/src/__support/math/f16fmaf128.h b/libc/src/__support/math/f16fmaf128.h
new file mode 100644
index 0000000000000..a341e87eede48
--- /dev/null
+++ b/libc/src/__support/math/f16fmaf128.h
@@ -0,0 +1,34 @@
+//===-- Implementation header for f16fmaf128 ------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
+
+#include "include/llvm-libc-macros/float128-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/FPUtil/FMA.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE static float16 f16fmaf128(float128 x, float128 y, float128 z) {
+  return fputil::fma<float16>(x, y, z);
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H

>From aad95484e5e27020bfea27246d98cb1839ef4284 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Sun, 25 Jan 2026 02:37:55 +0530
Subject: [PATCH 2/6] edited files

---
 libc/shared/math.h                                |  4 ++++
 libc/shared/math/f16fmaf128.h                     |  5 ++++-
 libc/src/__support/math/CMakeLists.txt            | 12 ++++++++++++
 libc/src/__support/math/f16fmaf128.h              |  5 +++++
 libc/src/math/generic/CMakeLists.txt              |  3 +--
 libc/src/math/generic/f16fmaf128.cpp              |  6 ++----
 libc/test/shared/CMakeLists.txt                   |  4 ++++
 libc/test/shared/shared_math_test.cpp             |  3 +++
 utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 14 +++++++++++++-
 9 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/libc/shared/math.h b/libc/shared/math.h
index 6b1f94fc6cce5..25c2af2f0aecb 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -60,8 +60,12 @@
 #include "math/expm1f.h"
 #include "math/expm1f16.h"
 #include "math/f16fma.h"
+<<<<<<< HEAD
 #include "math/f16fmal.h"
 #include "math/f16sqrtl.h"
+=======
+#include "math/f16fmaf128.h"
+>>>>>>> a01ef8ee0824 (edited files)
 #include "math/frexpf.h"
 #include "math/frexpf128.h"
 #include "math/frexpf16.h"
diff --git a/libc/shared/math/f16fmaf128.h b/libc/shared/math/f16fmaf128.h
index f3dc9f07db550..ac0a473da0beb 100644
--- a/libc/shared/math/f16fmaf128.h
+++ b/libc/shared/math/f16fmaf128.h
@@ -1,3 +1,4 @@
+
 //===-- Shared f16fmaf128 function -------------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -10,13 +11,15 @@
 #define LLVM_LIBC_SHARED_MATH_F16FMAF128_H
 
 #include "include/llvm-libc-macros/float128-macros.h"
+#include "include/llvm-libc-macros/float16-macros.h"
 #include "shared/libc_common.h"
 
 #ifdef LIBC_TYPES_HAS_FLOAT128
 
-
 #include "src/__support/math/f16fmaf128.h"
 
+
+
 namespace LIBC_NAMESPACE_DECL {
 namespace shared {
 
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index aad2270340c66..4fb7825b5c19c 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -665,6 +665,17 @@ add_header_library(
     libc.include.llvm-libc-macros.float16_macros
 )
 
+add_header_library(
+  f16fmaf128
+  HDRS
+    f16fmaf128.h
+  DEPENDS
+    libc.src.__support.FPUtil.fma
+    libc.src.__support.common
+    libc.src.__support.macros.config
+    libc.include.llvm-libc-macros.float128_macros
+)
+
 add_header_library(
   f16fmal
   HDRS
@@ -673,6 +684,7 @@ add_header_library(
     libc.src.__support.macros.config
     libc.src.__support.FPUtil.fma
     libc.include.llvm-libc-macros.float16_macros
+
 )
 
 add_header_library(
diff --git a/libc/src/__support/math/f16fmaf128.h b/libc/src/__support/math/f16fmaf128.h
index a341e87eede48..473a50a5fa87e 100644
--- a/libc/src/__support/math/f16fmaf128.h
+++ b/libc/src/__support/math/f16fmaf128.h
@@ -10,8 +10,12 @@
 #define LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
 
 #include "include/llvm-libc-macros/float128-macros.h"
+#include "include/llvm-libc-macros/float16-macros.h"
+#include "include/llvm-libc-types/float128.h"
+#include "include/llvm-libc-types/float16.h"
 
 #ifdef LIBC_TYPES_HAS_FLOAT128
+#ifdef LIBC_TYPES_HAS_FLOAT16
 
 #include "src/__support/FPUtil/FMA.h"
 #include "src/__support/common.h"
@@ -29,6 +33,7 @@ LIBC_INLINE static float16 f16fmaf128(float128 x, float128 y, float128 z) {
 
 } // namespace LIBC_NAMESPACE_DECL
 
+#endif // LIBC_TYPES_HAS_FLOAT16
 #endif // LIBC_TYPES_HAS_FLOAT128
 
 #endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 21c3a861c87d7..8db265f38fb69 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -5068,8 +5068,7 @@ add_entrypoint_object(
   HDRS
     ../f16fmaf128.h
   DEPENDS
-    libc.src.__support.macros.properties.types
-    libc.src.__support.FPUtil.fma
+    libc.src.__support.math.f16fmaf128.h
 )
 
 add_entrypoint_object(
diff --git a/libc/src/math/generic/f16fmaf128.cpp b/libc/src/math/generic/f16fmaf128.cpp
index 5c4823c47e79f..f8bcdc3028972 100644
--- a/libc/src/math/generic/f16fmaf128.cpp
+++ b/libc/src/math/generic/f16fmaf128.cpp
@@ -7,14 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/f16fmaf128.h"
-#include "src/__support/FPUtil/FMA.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
+#include "src/__support/math/f16fmaf128.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(float16, f16fmaf128, (float128 x, float128 y, float128 z)) {
-  return fputil::fma<float16>(x, y, z);
+  return math::f16fmaf128(x, y, z);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index b0a5ad730cbb2..571ad1e5985fb 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -56,8 +56,12 @@ add_fp_unittest(
     libc.src.__support.math.expf
     libc.src.__support.math.expf16
     libc.src.__support.math.f16fma
+<<<<<<< HEAD
     libc.src.__support.math.f16fmal
     libc.src.__support.math.f16sqrtl
+=======
+    libc.src.__support.math.f16fmaf128
+>>>>>>> a01ef8ee0824 (edited files)
     libc.src.__support.math.frexpf
     libc.src.__support.math.frexpf128
     libc.src.__support.math.frexpf16
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index a21863e23c3f9..502a4fc23e6d5 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -37,6 +37,9 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::sinhf16(0.0f16));
 
   EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
+#if defined(LIBC_TYPES_HAS_FLOAT128)
+  EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fmaf128(float128(2.0), float128(3.0), float128(4.0)));
+#endif
 
   EXPECT_FP_EQ(float16(10.0),
                LIBC_NAMESPACE::shared::f16fmal(2.0L, 3.0L, 4.0L));
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index a313ba48889d8..728b519c0ce00 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2897,6 +2897,18 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "__support_math_f16fmaf128",
+    hdrs = ["src/__support/math/f16fmaf128.h"],
+    deps = [
+        ":__support_fputil_fma",
+        ":__support_macros_config",
+        ":__support_common",
+        ":llvm_libc_macros_float128_macros",
+        ":llvm_libc_macros_float16_macros",
+    ],
+)
+
 libc_support_library(
     name = "__support_math_f16fmal",
     hdrs = ["src/__support/math/f16fmal.h"],
@@ -4407,7 +4419,7 @@ libc_math_function(
 libc_math_function(
     name = "f16fmaf128",
     additional_deps = [
-        ":__support_fputil_fma",
+        ":__support_math_f16fmaf128",   
     ],
 )
 

>From 746755aa4edd270d127b4caae25c6a32d590ac7b Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Sun, 25 Jan 2026 11:00:23 +0530
Subject: [PATCH 3/6] fixed .h error

---
 libc/src/math/generic/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 8db265f38fb69..fa18fde7e90f9 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -5068,7 +5068,7 @@ add_entrypoint_object(
   HDRS
     ../f16fmaf128.h
   DEPENDS
-    libc.src.__support.math.f16fmaf128.h
+    libc.src.__support.math.f16fmaf128
 )
 
 add_entrypoint_object(

>From 3af48fb2f0cb9f2e45a5265aea6d9c3af8462552 Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Wed, 28 Jan 2026 12:40:46 +0530
Subject: [PATCH 4/6] resolved format issues and added float16 macro

---
 libc/shared/math.h                                |  5 +----
 libc/shared/math/f16fmaf128.h                     |  3 ---
 libc/src/__support/math/CMakeLists.txt            |  2 +-
 libc/src/__support/math/f16fmaf128.h              |  5 ++---
 libc/test/shared/CMakeLists.txt                   |  5 +----
 libc/test/shared/shared_math_test.cpp             | 11 +++++++----
 utils/bazel/llvm-project-overlay/libc/BUILD.bazel |  2 +-
 7 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/libc/shared/math.h b/libc/shared/math.h
index 25c2af2f0aecb..0879934115228 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -60,12 +60,9 @@
 #include "math/expm1f.h"
 #include "math/expm1f16.h"
 #include "math/f16fma.h"
-<<<<<<< HEAD
+#include "math/f16fmaf28.h"
 #include "math/f16fmal.h"
 #include "math/f16sqrtl.h"
-=======
-#include "math/f16fmaf128.h"
->>>>>>> a01ef8ee0824 (edited files)
 #include "math/frexpf.h"
 #include "math/frexpf128.h"
 #include "math/frexpf16.h"
diff --git a/libc/shared/math/f16fmaf128.h b/libc/shared/math/f16fmaf128.h
index ac0a473da0beb..a5b637551c62f 100644
--- a/libc/shared/math/f16fmaf128.h
+++ b/libc/shared/math/f16fmaf128.h
@@ -1,4 +1,3 @@
-
 //===-- Shared f16fmaf128 function -------------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -18,8 +17,6 @@
 
 #include "src/__support/math/f16fmaf128.h"
 
-
-
 namespace LIBC_NAMESPACE_DECL {
 namespace shared {
 
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 4fb7825b5c19c..50e4fe6167c68 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -674,6 +674,7 @@ add_header_library(
     libc.src.__support.common
     libc.src.__support.macros.config
     libc.include.llvm-libc-macros.float128_macros
+    libc.include.llvm-libc-macros.float16_macros
 )
 
 add_header_library(
@@ -684,7 +685,6 @@ add_header_library(
     libc.src.__support.macros.config
     libc.src.__support.FPUtil.fma
     libc.include.llvm-libc-macros.float16_macros
-
 )
 
 add_header_library(
diff --git a/libc/src/__support/math/f16fmaf128.h b/libc/src/__support/math/f16fmaf128.h
index 473a50a5fa87e..6af4778615ff5 100644
--- a/libc/src/__support/math/f16fmaf128.h
+++ b/libc/src/__support/math/f16fmaf128.h
@@ -1,4 +1,4 @@
-//===-- Implementation header for f16fmaf128 ------------------------*- C++ -*-===//
+//===-- Implementation header for f16fmaf128 --------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -11,8 +11,7 @@
 
 #include "include/llvm-libc-macros/float128-macros.h"
 #include "include/llvm-libc-macros/float16-macros.h"
-#include "include/llvm-libc-types/float128.h"
-#include "include/llvm-libc-types/float16.h"
+
 
 #ifdef LIBC_TYPES_HAS_FLOAT128
 #ifdef LIBC_TYPES_HAS_FLOAT16
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 571ad1e5985fb..15309127846be 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -56,12 +56,9 @@ add_fp_unittest(
     libc.src.__support.math.expf
     libc.src.__support.math.expf16
     libc.src.__support.math.f16fma
-<<<<<<< HEAD
+    libc.src.__support.math.f16fmaf128
     libc.src.__support.math.f16fmal
     libc.src.__support.math.f16sqrtl
-=======
-    libc.src.__support.math.f16fmaf128
->>>>>>> a01ef8ee0824 (edited files)
     libc.src.__support.math.frexpf
     libc.src.__support.math.frexpf128
     libc.src.__support.math.frexpf16
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 502a4fc23e6d5..6599838ef2e38 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -36,10 +36,13 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::logf16(1.0f16));
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::sinhf16(0.0f16));
 
-  EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
-#if defined(LIBC_TYPES_HAS_FLOAT128)
-  EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fmaf128(float128(2.0), float128(3.0), float128(4.0)));
-#endif
+EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+  EXPECT_FP_EQ(10.0f16, LIBC_NAMESPACE::shared::f16fmaf128(float128(2.0), float128(3.0), float128(4.0)));
+
+#endif 
 
   EXPECT_FP_EQ(float16(10.0),
                LIBC_NAMESPACE::shared::f16fmal(2.0L, 3.0L, 4.0L));
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 728b519c0ce00..bdd6e19a0d024 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4419,7 +4419,7 @@ libc_math_function(
 libc_math_function(
     name = "f16fmaf128",
     additional_deps = [
-        ":__support_math_f16fmaf128",   
+        ":__support_math_f16fmaf128",
     ],
 )
 

>From d19ed1a15a1f7ee382f4569f65e46935c75a825a Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Thu, 29 Jan 2026 22:00:59 +0530
Subject: [PATCH 5/6] change-2 before rebase

---
 libc/shared/math/f16fmaf128.h         | 60 ++++++++++-----------
 libc/src/__support/math/f16fmaf128.h  | 75 +++++++++++++--------------
 libc/test/shared/shared_math_test.cpp |  6 +--
 3 files changed, 69 insertions(+), 72 deletions(-)

diff --git a/libc/shared/math/f16fmaf128.h b/libc/shared/math/f16fmaf128.h
index a5b637551c62f..2b5eb91724304 100644
--- a/libc/shared/math/f16fmaf128.h
+++ b/libc/shared/math/f16fmaf128.h
@@ -1,30 +1,30 @@
-//===-- Shared f16fmaf128 function -------------------------------*- 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SHARED_MATH_F16FMAF128_H
-#define LLVM_LIBC_SHARED_MATH_F16FMAF128_H
-
-#include "include/llvm-libc-macros/float128-macros.h"
-#include "include/llvm-libc-macros/float16-macros.h"
-#include "shared/libc_common.h"
-
-#ifdef LIBC_TYPES_HAS_FLOAT128
-
-#include "src/__support/math/f16fmaf128.h"
-
-namespace LIBC_NAMESPACE_DECL {
-namespace shared {
-
-using math::f16fmaf128;
-
-} // namespace shared
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LIBC_TYPES_HAS_FLOAT128
-
-#endif // LLVM_LIBC_SHARED_MATH_F16FMAF128_H
+//===-- Shared f16fmaf128 function ------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_F16FMAF128_H
+#define LLVM_LIBC_SHARED_MATH_F16FMAF128_H
+
+#include "include/llvm-libc-macros/float128-macros.h"
+#include "include/llvm-libc-macros/float16-macros.h"
+#include "shared/libc_common.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+
+#include "src/__support/math/f16fmaf128.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::f16fmaf128;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SHARED_MATH_F16FMAF128_H
diff --git a/libc/src/__support/math/f16fmaf128.h b/libc/src/__support/math/f16fmaf128.h
index 6af4778615ff5..2d120068e5502 100644
--- a/libc/src/__support/math/f16fmaf128.h
+++ b/libc/src/__support/math/f16fmaf128.h
@@ -1,38 +1,37 @@
-//===-- Implementation header for f16fmaf128 --------------------*- 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
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
-#define LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
-
-#include "include/llvm-libc-macros/float128-macros.h"
-#include "include/llvm-libc-macros/float16-macros.h"
-
-
-#ifdef LIBC_TYPES_HAS_FLOAT128
-#ifdef LIBC_TYPES_HAS_FLOAT16
-
-#include "src/__support/FPUtil/FMA.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-
-namespace LIBC_NAMESPACE_DECL {
-
-namespace math {
-
-LIBC_INLINE static float16 f16fmaf128(float128 x, float128 y, float128 z) {
-  return fputil::fma<float16>(x, y, z);
-}
-
-} // namespace math
-
-} // namespace LIBC_NAMESPACE_DECL
-
-#endif // LIBC_TYPES_HAS_FLOAT16
-#endif // LIBC_TYPES_HAS_FLOAT128
-
-#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
+//===-- Implementation header for f16fmaf128 --------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
+
+#include "include/llvm-libc-macros/float128-macros.h"
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT128
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/FMA.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE static float16 f16fmaf128(float128 x, float128 y, float128 z) {
+  return fputil::fma<float16>(x, y, z);
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+#endif // LIBC_TYPES_HAS_FLOAT128
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_F16FMAF128_H
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 6599838ef2e38..9c18f75ad7847 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -19,7 +19,6 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::acospif16(1.0f16));
   EXPECT_FP_EQ(0x1p+0f16, LIBC_NAMESPACE::shared::rsqrtf16(1.0f16));
   EXPECT_FP_EQ(0x1p+0f16, LIBC_NAMESPACE::shared::sqrtf16(1.0f16));
-
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::asinf16(0.0f16));
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::asinhf16(0.0f16));
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::atanf16(0.0f16));
@@ -36,13 +35,13 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::logf16(1.0f16));
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::sinhf16(0.0f16));
 
-EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
+  EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
 
 #ifdef LIBC_TYPES_HAS_FLOAT128
 
   EXPECT_FP_EQ(10.0f16, LIBC_NAMESPACE::shared::f16fmaf128(float128(2.0), float128(3.0), float128(4.0)));
 
-#endif 
+#endif
 
   EXPECT_FP_EQ(float16(10.0),
                LIBC_NAMESPACE::shared::f16fmal(2.0L, 3.0L, 4.0L));
@@ -58,7 +57,6 @@ EXPECT_FP_EQ(float16(10.0), LIBC_NAMESPACE::shared::f16fma(2.0, 3.0, 4.0));
   EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogbf16(1.0f16));
   EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::logbf16(1.0f16));
   EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbf16(1.0f16));
-
   EXPECT_FP_EQ(0x1.921fb6p+0f16, LIBC_NAMESPACE::shared::acosf16(0.0f16));
   EXPECT_FP_EQ(0x1p+0f16, LIBC_NAMESPACE::shared::f16sqrtl(1.0L));
   EXPECT_FP_EQ(0.0f16, LIBC_NAMESPACE::shared::sinf16(0.0f16));

>From 8e49de1c9dd31e65a1570d086bee9c03eb16124e Mon Sep 17 00:00:00 2001
From: Sukumarsawant <sawantsukumar at gmail.com>
Date: Thu, 29 Jan 2026 22:08:59 +0530
Subject: [PATCH 6/6] math.h spell err

---
 libc/shared/math.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/shared/math.h b/libc/shared/math.h
index 0879934115228..5dbffe3e879d7 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -60,7 +60,7 @@
 #include "math/expm1f.h"
 #include "math/expm1f16.h"
 #include "math/f16fma.h"
-#include "math/f16fmaf28.h"
+#include "math/f16fmaf128.h"
 #include "math/f16fmal.h"
 #include "math/f16sqrtl.h"
 #include "math/frexpf.h"



More information about the libc-commits mailing list