[libc-commits] [libc] [libc][math][c23] Add dfma{l, f128} and dsub{l, f128} C23 math functions (PR #101089)

via libc-commits libc-commits at lists.llvm.org
Wed Jul 31 11:23:04 PDT 2024


https://github.com/aaryanshukla updated https://github.com/llvm/llvm-project/pull/101089

>From 654c164c04f0e915eee4a73abd7f933b32087012 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 24 Jul 2024 20:38:02 +0000
Subject: [PATCH 01/16] [libc][math]: implemented dfma and dsub

---
 libc/config/baremetal/arm/entrypoints.txt   | 4 ++++
 libc/config/baremetal/riscv/entrypoints.txt | 4 ++++
 libc/config/darwin/arm/entrypoints.txt      | 4 ++++
 libc/config/darwin/x86_64/entrypoints.txt   | 4 ++++
 libc/config/gpu/entrypoints.txt             | 4 ++++
 libc/config/linux/aarch64/entrypoints.txt   | 4 ++++
 libc/config/linux/arm/entrypoints.txt       | 4 ++++
 libc/config/linux/riscv/entrypoints.txt     | 2 ++
 libc/config/linux/x86_64/entrypoints.txt    | 4 ++++
 libc/config/windows/entrypoints.txt         | 4 ++++
 10 files changed, 38 insertions(+)

diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 8025ac09b9f82..43266f140d704 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -247,6 +247,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
+    libc.src.math.dsubl
+    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index fb0308c953746..61f62fc635e37 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -243,6 +243,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
+    libc.src.math.dsubl
+    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/darwin/arm/entrypoints.txt b/libc/config/darwin/arm/entrypoints.txt
index ea5c7b537bbec..d46adda55e63f 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -135,6 +135,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.cospif
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
+    libc.src.math.dsubl
+    libc.src.math.dsubf128
     libc.src.math.dsqrtl
     libc.src.math.erff
     libc.src.math.exp
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 1a7353172d464..3858a1d52aa5a 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -119,7 +119,11 @@ set(TARGET_LIBM_ENTRYPOINTS
     #libc.src.math.ceill
     #libc.src.math.coshf
     #libc.src.math.cosf
+    #libc.src.math.dfmaf128
+    #libc.src.math.dfmal
     #libc.src.math.dsqrtl
+    #libc.src.math.dsubl
+    #libc.src.math.dsubf128
     #libc.src.math.expf
     #libc.src.math.exp2f
     #libc.src.math.expm1f
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index f7e89bdcd95cc..26cbc6a30faba 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -255,6 +255,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.cosh
     libc.src.math.coshf
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
+    libc.src.math.dsubl
+    libc.src.math.dsubf128
     libc.src.math.erf
     libc.src.math.erff
     libc.src.math.exp
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 0be6f884f0368..8cb9206cb2fce 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -358,8 +358,12 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
     libc.src.math.dmull
     libc.src.math.dsqrtl
+    libc.src.math.dsubl
+    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 55f118395c22e..2e94db7bca9f8 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -227,7 +227,11 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
     libc.src.math.dsqrtl
+    libc.src.math.dsubl
+    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 597aeb361afe4..44381e86cfd40 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -383,6 +383,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.erff
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index f7813fc16ff7c..17ce8b8d475f2 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -383,8 +383,12 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
     libc.src.math.dmull
     libc.src.math.dsqrtl
+    libc.src.math.dsubl
+    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index b6aced83c5815..84069a3e76111 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -132,6 +132,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
+    libc.src.math.dfmaf128
+    libc.src.math.dfmal
+    libc.src.math.dsubl
+    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf

>From 130c80bf1cf1bdc0e982a1d1ecc0fd59d6707347 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 24 Jul 2024 21:23:02 +0000
Subject: [PATCH 02/16] functions

---
 libc/spec/stdc.td                    |  8 +++++
 libc/src/math/CMakeLists.txt         |  5 ++-
 libc/src/math/dfmaf128               | 21 ++++++++++++
 libc/src/math/dfmal.h                | 21 ++++++++++++
 libc/src/math/dsubf128.h             | 21 ++++++++++++
 libc/src/math/dsubl.h                | 21 ++++++++++++
 libc/src/math/generic/CMakeLists.txt | 49 ++++++++++++++++++++++++++++
 libc/src/math/generic/dfmaf128.cpp   | 21 ++++++++++++
 libc/src/math/generic/dfmal.cpp      | 21 ++++++++++++
 9 files changed, 187 insertions(+), 1 deletion(-)
 create mode 100644 libc/src/math/dfmaf128
 create mode 100644 libc/src/math/dfmal.h
 create mode 100644 libc/src/math/dsubf128.h
 create mode 100644 libc/src/math/dsubl.h
 create mode 100644 libc/src/math/generic/dfmaf128.cpp
 create mode 100644 libc/src/math/generic/dfmal.cpp

diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 0aae65308d33a..fb3193f3ebde7 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -397,6 +397,14 @@ def StdC : StandardSpec<"stdc"> {
           GuardedFunctionSpec<"ceilf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
           GuardedFunctionSpec<"ceilf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
 
+          FunctionSpec<"dfmal", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          FunctionSpec<"dfmaf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<Float128Type]>,
+          FunctionSpec<"dsubf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
+          FunctionSpec<"dsubl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          
+
+
+
           FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>], [ConstAttr]>,
           FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
           FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 25aef3f72e3cd..a816076d3919f 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -88,9 +88,12 @@ add_math_entrypoint_object(cospif)
 
 add_math_entrypoint_object(dmull)
 add_math_entrypoint_object(dmulf128)
-
+add_math_entrypoint_object(dfmal)
+add_math_entrypoint_object(dfmaf128)
 add_math_entrypoint_object(dsqrtl)
 add_math_entrypoint_object(dsqrtf128)
+add_math_entrypoint_object(dsubl)
+add_math_entrypoint_object(dsubf128)
 
 add_math_entrypoint_object(erf)
 add_math_entrypoint_object(erff)
diff --git a/libc/src/math/dfmaf128 b/libc/src/math/dfmaf128
new file mode 100644
index 0000000000000..1b2e72851c806
--- /dev/null
+++ b/libc/src/math/dfmaf128
@@ -0,0 +1,21 @@
+//===-- Implementation header for dfmaf128 ----------------------*- 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_MATH_DFMAF128_H
+#define LLVM_LIBC_SRC_MATH_DFMAF128_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double dfmaf128(float128 x, float128 y, float128 z);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DFMAF128_H
diff --git a/libc/src/math/dfmal.h b/libc/src/math/dfmal.h
new file mode 100644
index 0000000000000..a31fa5b5838fe
--- /dev/null
+++ b/libc/src/math/dfmal.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for dfmal --------------------*- 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_MATH_DFMAL_H
+#define LLVM_LIBC_SRC_MATH_DFMAL_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double dfmal(long double x, long double y, long double z);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DFMAL_H
diff --git a/libc/src/math/dsubf128.h b/libc/src/math/dsubf128.h
new file mode 100644
index 0000000000000..8ac58a916f0de
--- /dev/null
+++ b/libc/src/math/dsubf128.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for dsubf128 ----------------------*- 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_MATH_DSUBF128_H
+#define LLVM_LIBC_SRC_MATH_DSUBF128_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double dsubf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DSUBF128_H
diff --git a/libc/src/math/dsubl.h b/libc/src/math/dsubl.h
new file mode 100644
index 0000000000000..8bab3d2226816
--- /dev/null
+++ b/libc/src/math/dsubl.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for dsubl -------------------------*- 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_MATH_DSUBL_H
+#define LLVM_LIBC_SRC_MATH_DSUBL_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double dsubl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DSUBL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index ef96d6c4c2f37..a8652de35bdf3 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -129,6 +129,30 @@ add_entrypoint_object(
     libc.src.__support.FPUtil.nearest_integer_operations
 )
 
+add_entrypoint_object(
+  dfmaf128
+  SRCS
+    dfmaf128.cpp
+  HDRS
+    ../dfmaf128.h
+  DEPENDS
+    libc.src.__support.FPUtil.fma
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_entrypoint_object(
+  dfmal
+  SRCS
+    dfmal.cpp
+  HDRS
+    ../dfmal.h
+  DEPENDS
+    libc.src.__support.FPUtil.fma
+  COMPILE_OPTIONS
+    -O3
+)
+
 add_entrypoint_object(
   dsqrtl
   SRCS
@@ -154,6 +178,31 @@ add_entrypoint_object(
     -O3
 )
 
+
+add_entrypoint_object(
+  dsubf128
+  SRCS
+    dsubf128.cpp
+  HDRS
+    ../dsubf128.h
+  DEPENDS
+    libc.src.__support.FPUtil.add_sub
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_entrypoint_object(
+  dsubl
+  SRCS
+    dsubl.cpp
+  HDRS
+    ../dsubl.h
+  DEPENDS
+    libc.src.__support.FPUtil.add_sub
+  COMPILE_OPTIONS
+    -O3
+)
+
 add_header_library(
   range_reduction
   HDRS
diff --git a/libc/src/math/generic/dfmaf128.cpp b/libc/src/math/generic/dfmaf128.cpp
new file mode 100644
index 0000000000000..adaa3333472c9
--- /dev/null
+++ b/libc/src/math/generic/dfmaf128.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation header for dfmaf128 ----------------------*- 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_MATH_DFMAf128_H
+#define LLVM_LIBC_SRC_MATH_DFMAf128_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double dfmaf128(float128 x, float128 y, float128 z);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DFMAf128_H
diff --git a/libc/src/math/generic/dfmal.cpp b/libc/src/math/generic/dfmal.cpp
new file mode 100644
index 0000000000000..02e0ce84ace83
--- /dev/null
+++ b/libc/src/math/generic/dfmal.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of dfmal function ----------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/dfmal.h"
+#include "src/__support/FPUtil/FMA.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, dfmal,
+                   (long double x, long double y, long double z)) {
+  return fputil::fma<double>(x, y, z);
+}
+
+} // namespace LIBC_NAMESPACE_DECL

>From 745564caf34b0e8bfc3b0e66ebf544c0c68ddafa Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 24 Jul 2024 22:27:04 +0000
Subject: [PATCH 03/16] fixed entrypoints

---
 libc/config/baremetal/arm/entrypoints.txt   | 2 --
 libc/config/baremetal/riscv/entrypoints.txt | 2 --
 libc/config/darwin/arm/entrypoints.txt      | 2 --
 libc/config/gpu/entrypoints.txt             | 4 ----
 libc/config/linux/aarch64/entrypoints.txt   | 4 ++--
 libc/config/linux/arm/entrypoints.txt       | 2 --
 libc/config/windows/entrypoints.txt         | 2 --
 7 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 43266f140d704..cd43e2ba19e45 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -247,10 +247,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dfmaf128
     libc.src.math.dfmal
     libc.src.math.dsubl
-    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 61f62fc635e37..e8452d273556a 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -243,10 +243,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dfmaf128
     libc.src.math.dfmal
     libc.src.math.dsubl
-    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/darwin/arm/entrypoints.txt b/libc/config/darwin/arm/entrypoints.txt
index d46adda55e63f..6d524da677409 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -135,10 +135,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.cospif
-    libc.src.math.dfmaf128
     libc.src.math.dfmal
     libc.src.math.dsubl
-    libc.src.math.dsubf128
     libc.src.math.dsqrtl
     libc.src.math.erff
     libc.src.math.exp
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 26cbc6a30faba..f7e89bdcd95cc 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -255,10 +255,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.cosh
     libc.src.math.coshf
-    libc.src.math.dfmaf128
-    libc.src.math.dfmal
-    libc.src.math.dsubl
-    libc.src.math.dsubf128
     libc.src.math.erf
     libc.src.math.erff
     libc.src.math.exp
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 8cb9206cb2fce..d055943f9642d 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -358,12 +358,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
-    libc.src.math.dfmaf128
     libc.src.math.dfmal
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.dsubl
-    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
@@ -603,7 +601,9 @@ if(LIBC_TYPES_HAS_FLOAT128)
     # math.h C23 _Float128 entrypoints
     libc.src.math.ceilf128
     libc.src.math.copysignf128
+    libc.src.math.dfmaf128
     libc.src.math.dsqrtf128
+    libc.src.math.dsubf128
     libc.src.math.fabsf128
     libc.src.math.fdimf128
     libc.src.math.floorf128
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 2e94db7bca9f8..0f9097d0859cc 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -227,11 +227,9 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dfmaf128
     libc.src.math.dfmal
     libc.src.math.dsqrtl
     libc.src.math.dsubl
-    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 84069a3e76111..b72cc09fa28f5 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -132,10 +132,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dfmaf128
     libc.src.math.dfmal
     libc.src.math.dsubl
-    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf

>From 4d4730676baa4409b4c2803e385e16c1cdd42433 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 29 Jul 2024 18:19:48 +0000
Subject: [PATCH 04/16] adding

---
 libc/config/darwin/x86_64/entrypoints.txt  |  2 -
 libc/src/math/{dfmaf128 => dfmaf128.h}     |  0
 libc/src/math/dsubl.h                      |  2 -
 libc/src/math/generic/CMakeLists.txt       |  6 ++-
 libc/src/math/generic/dfmaf128.cpp         |  7 ++-
 libc/src/math/generic/dsubf128.cpp         | 20 +++++++++
 libc/src/math/generic/dsubl.cpp            | 20 +++++++++
 libc/test/src/math/CMakeLists.txt          | 52 ++++++++++++++++++++++
 libc/test/src/math/dfmaf128_test.cpp       | 13 ++++++
 libc/test/src/math/dfmal_test.cpp          | 13 ++++++
 libc/test/src/math/dsubf128_test.cpp       | 13 ++++++
 libc/test/src/math/dsubl_test.cpp          | 13 ++++++
 libc/test/src/math/smoke/CMakeLists.txt    | 48 ++++++++++++++++++++
 libc/test/src/math/smoke/dfmaf128_test.cpp | 13 ++++++
 libc/test/src/math/smoke/dfmal_test.cpp    | 13 ++++++
 libc/test/src/math/smoke/dsubf128_test.cpp | 13 ++++++
 libc/test/src/math/smoke/dsubl_test.cpp    | 13 ++++++
 17 files changed, 254 insertions(+), 7 deletions(-)
 rename libc/src/math/{dfmaf128 => dfmaf128.h} (100%)
 create mode 100644 libc/src/math/generic/dsubf128.cpp
 create mode 100644 libc/src/math/generic/dsubl.cpp
 create mode 100644 libc/test/src/math/dfmaf128_test.cpp
 create mode 100644 libc/test/src/math/dfmal_test.cpp
 create mode 100644 libc/test/src/math/dsubf128_test.cpp
 create mode 100644 libc/test/src/math/dsubl_test.cpp
 create mode 100644 libc/test/src/math/smoke/dfmaf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/dfmal_test.cpp
 create mode 100644 libc/test/src/math/smoke/dsubf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/dsubl_test.cpp

diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 3858a1d52aa5a..ff3abb233ba8a 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -119,11 +119,9 @@ set(TARGET_LIBM_ENTRYPOINTS
     #libc.src.math.ceill
     #libc.src.math.coshf
     #libc.src.math.cosf
-    #libc.src.math.dfmaf128
     #libc.src.math.dfmal
     #libc.src.math.dsqrtl
     #libc.src.math.dsubl
-    #libc.src.math.dsubf128
     #libc.src.math.expf
     #libc.src.math.exp2f
     #libc.src.math.expm1f
diff --git a/libc/src/math/dfmaf128 b/libc/src/math/dfmaf128.h
similarity index 100%
rename from libc/src/math/dfmaf128
rename to libc/src/math/dfmaf128.h
diff --git a/libc/src/math/dsubl.h b/libc/src/math/dsubl.h
index 8bab3d2226816..4dc396c2731a1 100644
--- a/libc/src/math/dsubl.h
+++ b/libc/src/math/dsubl.h
@@ -10,8 +10,6 @@
 #define LLVM_LIBC_SRC_MATH_DSUBL_H
 
 #include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
-
 namespace LIBC_NAMESPACE_DECL {
 
 double dsubl(long double x, long double y);
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index a8652de35bdf3..fea64e9a9c601 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -137,6 +137,7 @@ add_entrypoint_object(
     ../dfmaf128.h
   DEPENDS
     libc.src.__support.FPUtil.fma
+    libc.src.__support.macros.properties.types
   COMPILE_OPTIONS
     -O3
 )
@@ -186,7 +187,8 @@ add_entrypoint_object(
   HDRS
     ../dsubf128.h
   DEPENDS
-    libc.src.__support.FPUtil.add_sub
+    libc.src.__support.FPUtil.generic.add_sub
+    libc.src.__support.macros.properties.types
   COMPILE_OPTIONS
     -O3
 )
@@ -198,7 +200,7 @@ add_entrypoint_object(
   HDRS
     ../dsubl.h
   DEPENDS
-    libc.src.__support.FPUtil.add_sub
+    libc.src.__support.FPUtil.generic.add_sub
   COMPILE_OPTIONS
     -O3
 )
diff --git a/libc/src/math/generic/dfmaf128.cpp b/libc/src/math/generic/dfmaf128.cpp
index adaa3333472c9..5bc15df9051c3 100644
--- a/libc/src/math/generic/dfmaf128.cpp
+++ b/libc/src/math/generic/dfmaf128.cpp
@@ -10,11 +10,16 @@
 #define LLVM_LIBC_SRC_MATH_DFMAf128_H
 
 #include "src/__support/macros/config.h"
+#include "src/math/dfmaf128.h"
 #include "src/__support/macros/properties/types.h"
+#include "src/__support/FPUtil/FMA.h"
+
 
 namespace LIBC_NAMESPACE_DECL {
 
-double dfmaf128(float128 x, float128 y, float128 z);
+LLVM_LIBC_FUNCTION(double, dfmaf128, (float128 x, float128 y, float128 z)) {
+  return fputil::generic::fma<double>(x, y, z);
+}
 
 } // namespace LIBC_NAMESPACE_DECL
 
diff --git a/libc/src/math/generic/dsubf128.cpp b/libc/src/math/generic/dsubf128.cpp
new file mode 100644
index 0000000000000..1b2f1214b3a6f
--- /dev/null
+++ b/libc/src/math/generic/dsubf128.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of dsubf128 function -------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/dsubf128.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, dsubf128, (float128 x, float128 y)) {
+  return fputil::generic::sub<double>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/dsubl.cpp b/libc/src/math/generic/dsubl.cpp
new file mode 100644
index 0000000000000..8b567d0869d2a
--- /dev/null
+++ b/libc/src/math/generic/dsubl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of dsubl function ----------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/dsubl.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, dsubl, (long double x, long double y)) {
+  return fputil::generic::sub<double>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 3ad5d98858165..a1d79d91c6a61 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -2368,6 +2368,58 @@ add_fp_unittest(
     libc.src.stdlib.srand
 )
 
+add_fp_unittest(
+  dfmal_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    dfmal_test.cpp
+  HDRS
+    FmaTest.h
+  DEPENDS
+    libc.src.math.dfmal
+)
+
+add_fp_unittest(
+  dfmaf128_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    dfmaf128_test.cpp
+  HDRS
+    FmaTest.h
+  DEPENDS
+    libc.src.math.dfmaf128
+)
+
+add_fp_unittest(
+  dsubl_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    dsubl_test.cpp
+  HDRS
+    SubTest.h
+  DEPENDS
+    libc.src.math.dsubl
+)
+
+add_fp_unittest(
+  dsubf128_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    dsubf128_test.cpp
+  HDRS
+    SubTest.h
+  DEPENDS
+    libc.src.math.dsubf128
+)
+
 add_subdirectory(generic)
 add_subdirectory(smoke)
 
diff --git a/libc/test/src/math/dfmaf128_test.cpp b/libc/test/src/math/dfmaf128_test.cpp
new file mode 100644
index 0000000000000..56c11747047b1
--- /dev/null
+++ b/libc/test/src/math/dfmaf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dfmaf128 --------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "FmaTest.h"
+
+#include "src/math/dfmaf128.h"
+
+LIST_NARROWING_FMA_TESTS(double, float128, LIBC_NAMESPACE::dfmaf128)
diff --git a/libc/test/src/math/dfmal_test.cpp b/libc/test/src/math/dfmal_test.cpp
new file mode 100644
index 0000000000000..3c38f5eb7db9d
--- /dev/null
+++ b/libc/test/src/math/dfmal_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dfmal -----------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "FmaTest.h"
+
+#include "src/math/dfmal.h"
+
+LIST_NARROWING_FMA_TESTS(double, long double, LIBC_NAMESPACE::dfmal)
diff --git a/libc/test/src/math/dsubf128_test.cpp b/libc/test/src/math/dsubf128_test.cpp
new file mode 100644
index 0000000000000..e496cdd245070
--- /dev/null
+++ b/libc/test/src/math/dsubf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dsubf128 --------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "SubTest.h"
+
+#include "src/math/dsubf128.h"
+
+LIST_SUB_TESTS(double, float128, LIBC_NAMESPACE::dsubf128)
diff --git a/libc/test/src/math/dsubl_test.cpp b/libc/test/src/math/dsubl_test.cpp
new file mode 100644
index 0000000000000..98846e0b6e3b3
--- /dev/null
+++ b/libc/test/src/math/dsubl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dsubl -----------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "SubTest.h"
+
+#include "src/math/dsubl.h"
+
+LIST_SUB_TESTS(double, long double, LIBC_NAMESPACE::dsubl)
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 1b3c51739c0fe..4deb2ad6f5527 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -358,6 +358,54 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  dfmal_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    dfmal_test.cpp
+  HDRS
+    FmaTest.h
+  DEPENDS
+    libc.src.math.dfmal
+)
+
+add_fp_unittest(
+  dfmaf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    dfmaf128_test.cpp
+  HDRS
+    SubTest.h
+  DEPENDS
+    libc.src.math.dfmaf128
+)
+
+add_fp_unittest(
+  dsubl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    dsubl_test.cpp
+  HDRS
+    SubTest.h
+  DEPENDS
+    libc.src.math.dsubl
+)
+
+add_fp_unittest(
+  dsubf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    dsubf128_test.cpp
+  HDRS
+    SubTest.h
+  DEPENDS
+    libc.src.math.dsubf128
+)
+
 add_fp_unittest(
   floor_test
   SUITE
diff --git a/libc/test/src/math/smoke/dfmaf128_test.cpp b/libc/test/src/math/smoke/dfmaf128_test.cpp
new file mode 100644
index 0000000000000..56c11747047b1
--- /dev/null
+++ b/libc/test/src/math/smoke/dfmaf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dfmaf128 --------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "FmaTest.h"
+
+#include "src/math/dfmaf128.h"
+
+LIST_NARROWING_FMA_TESTS(double, float128, LIBC_NAMESPACE::dfmaf128)
diff --git a/libc/test/src/math/smoke/dfmal_test.cpp b/libc/test/src/math/smoke/dfmal_test.cpp
new file mode 100644
index 0000000000000..3c38f5eb7db9d
--- /dev/null
+++ b/libc/test/src/math/smoke/dfmal_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dfmal -----------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "FmaTest.h"
+
+#include "src/math/dfmal.h"
+
+LIST_NARROWING_FMA_TESTS(double, long double, LIBC_NAMESPACE::dfmal)
diff --git a/libc/test/src/math/smoke/dsubf128_test.cpp b/libc/test/src/math/smoke/dsubf128_test.cpp
new file mode 100644
index 0000000000000..e496cdd245070
--- /dev/null
+++ b/libc/test/src/math/smoke/dsubf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dsubf128 --------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "SubTest.h"
+
+#include "src/math/dsubf128.h"
+
+LIST_SUB_TESTS(double, float128, LIBC_NAMESPACE::dsubf128)
diff --git a/libc/test/src/math/smoke/dsubl_test.cpp b/libc/test/src/math/smoke/dsubl_test.cpp
new file mode 100644
index 0000000000000..98846e0b6e3b3
--- /dev/null
+++ b/libc/test/src/math/smoke/dsubl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dsubl -----------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "SubTest.h"
+
+#include "src/math/dsubl.h"
+
+LIST_SUB_TESTS(double, long double, LIBC_NAMESPACE::dsubl)

>From 19f533cd9d440af63d2b5c4ac5787af84399afa7 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 29 Jul 2024 20:24:35 +0000
Subject: [PATCH 05/16] everything but index.rst

---
 libc/config/linux/riscv/entrypoints.txt  | 2 +-
 libc/config/linux/x86_64/entrypoints.txt | 5 +++--
 libc/spec/llvm_libc_ext.td               | 3 +++
 libc/spec/stdc.td                        | 1 -
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 44381e86cfd40..8293b7b2e3828 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -383,10 +383,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
-    libc.src.math.dfmaf128
     libc.src.math.dfmal
     libc.src.math.dmull
     libc.src.math.dsqrtl
+    libc.src.math.dsubl
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 17ce8b8d475f2..0d91ae5310d26 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -383,12 +383,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
-    libc.src.math.dfmaf128
     libc.src.math.dfmal
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.dsubl
-    libc.src.math.dsubf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
@@ -563,6 +561,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
     libc.src.math.canonicalizef16
     libc.src.math.ceilf16
     libc.src.math.copysignf16
+    
     libc.src.math.f16add
     libc.src.math.f16addf
     libc.src.math.f16addl
@@ -649,8 +648,10 @@ if(LIBC_TYPES_HAS_FLOAT128)
     libc.src.math.canonicalizef128
     libc.src.math.ceilf128
     libc.src.math.copysignf128
+    libc.src.math.dfmaf128
     libc.src.math.dmulf128
     libc.src.math.dsqrtf128
+    libc.src.math.dsubf128
     libc.src.math.fabsf128
     libc.src.math.fdimf128
     libc.src.math.floorf128
diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td
index f3a8862574ac5..8503f66f34b54 100644
--- a/libc/spec/llvm_libc_ext.td
+++ b/libc/spec/llvm_libc_ext.td
@@ -57,7 +57,10 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
       [], // Types
       [], // Enumerations
       [
+          GuardedFunctionSpec<"dfmaf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
           GuardedFunctionSpec<"dsqrtf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+          GuardedFunctionSpec<"dsubf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+
 	  
           GuardedFunctionSpec<"f16add", RetValSpec<Float16Type>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
           GuardedFunctionSpec<"f16addf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index fb3193f3ebde7..880046d6fb344 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -399,7 +399,6 @@ def StdC : StandardSpec<"stdc"> {
 
           FunctionSpec<"dfmal", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
           FunctionSpec<"dfmaf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<Float128Type]>,
-          FunctionSpec<"dsubf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
           FunctionSpec<"dsubl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
           
 

>From f9a65948da97311389f0001348adb312c211a82d Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 29 Jul 2024 20:26:50 +0000
Subject: [PATCH 06/16] [libc][math][c23]

---
 libc/docs/math/index.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index f287c16fd01e2..07ce817bb7e64 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -118,11 +118,11 @@ Basic Operations
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | ddiv             | N/A              | N/A             |                        | N/A                  |                        | 7.12.14.4              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| dfma             | N/A              | N/A             |                        | N/A                  |                        | 7.12.14.5              | F.10.11                    |
+| dfma             | N/A              | N/A             | |check|                | N/A                  | |check|\*             | 7.12.14.5              | F.10.11                     |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | dmul             | N/A              | N/A             | |check|                | N/A                  | |check|\*              | 7.12.14.3              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| dsub             | N/A              | N/A             |                        | N/A                  |                        | 7.12.14.2              | F.10.11                    |
+| dsub             | N/A              | N/A             | |check|                | N/A                  | |check|\*              | 7.12.14.2              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | f16add           | |check|\*        | |check|\*       | |check|\*              | N/A                  | |check|                | 7.12.14.1              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+

>From 0249688f3329e56c57c8e7ca5f0cb6e4560f037e Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 29 Jul 2024 22:02:48 +0000
Subject: [PATCH 07/16] formatting and spacing

---
 libc/config/darwin/arm/entrypoints.txt   | 2 +-
 libc/config/linux/x86_64/entrypoints.txt | 1 -
 libc/src/math/dfmal.h                    | 2 +-
 libc/src/math/generic/dfmaf128.cpp       | 5 ++---
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/libc/config/darwin/arm/entrypoints.txt b/libc/config/darwin/arm/entrypoints.txt
index 6d524da677409..bb579d29ffe4b 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -136,8 +136,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.cospif
     libc.src.math.dfmal
-    libc.src.math.dsubl
     libc.src.math.dsqrtl
+    libc.src.math.dsubl
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 0d91ae5310d26..0f13cd02c8e20 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -561,7 +561,6 @@ if(LIBC_TYPES_HAS_FLOAT16)
     libc.src.math.canonicalizef16
     libc.src.math.ceilf16
     libc.src.math.copysignf16
-    
     libc.src.math.f16add
     libc.src.math.f16addf
     libc.src.math.f16addl
diff --git a/libc/src/math/dfmal.h b/libc/src/math/dfmal.h
index a31fa5b5838fe..6e8af7c4f21c2 100644
--- a/libc/src/math/dfmal.h
+++ b/libc/src/math/dfmal.h
@@ -1,4 +1,4 @@
-//===-- Implementation header for dfmal --------------------*- C++ -*-===//
+//===-- Implementation header for dfmal -------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
diff --git a/libc/src/math/generic/dfmaf128.cpp b/libc/src/math/generic/dfmaf128.cpp
index 5bc15df9051c3..36b06e396b9f7 100644
--- a/libc/src/math/generic/dfmaf128.cpp
+++ b/libc/src/math/generic/dfmaf128.cpp
@@ -9,11 +9,10 @@
 #ifndef LLVM_LIBC_SRC_MATH_DFMAf128_H
 #define LLVM_LIBC_SRC_MATH_DFMAf128_H
 
-#include "src/__support/macros/config.h"
 #include "src/math/dfmaf128.h"
-#include "src/__support/macros/properties/types.h"
 #include "src/__support/FPUtil/FMA.h"
-
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
 
 namespace LIBC_NAMESPACE_DECL {
 

>From 2d4e4a50d2573610752632ffdc32b4e636dc0750 Mon Sep 17 00:00:00 2001
From: OverMighty <its.overmighty at gmail.com>
Date: Tue, 30 Jul 2024 12:56:27 +0200
Subject: [PATCH 08/16] Update libc/test/src/math/smoke/SubTest.h dependencies

---
 libc/test/src/math/smoke/CMakeLists.txt | 8 ++++----
 libc/test/src/math/smoke/SubTest.h      | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 4deb2ad6f5527..d023f954ccc13 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -3808,8 +3808,8 @@ add_fp_unittest(
   HDRS
     SubTest.h
   DEPENDS
+    libc.hdr.errno_macros
     libc.hdr.fenv_macros
-    libc.src.__support.FPUtil.basic_operations
     libc.src.math.f16sub
 )
 
@@ -3822,8 +3822,8 @@ add_fp_unittest(
   HDRS
     SubTest.h
   DEPENDS
+    libc.hdr.errno_macros
     libc.hdr.fenv_macros
-    libc.src.__support.FPUtil.basic_operations
     libc.src.math.f16subf
 )
 
@@ -3836,8 +3836,8 @@ add_fp_unittest(
   HDRS
     SubTest.h
   DEPENDS
+    libc.hdr.errno_macros
     libc.hdr.fenv_macros
-    libc.src.__support.FPUtil.basic_operations
     libc.src.math.f16subl
 )
 
@@ -3850,8 +3850,8 @@ add_fp_unittest(
   HDRS
     SubTest.h
   DEPENDS
+    libc.hdr.errno_macros
     libc.hdr.fenv_macros
-    libc.src.__support.FPUtil.basic_operations
     libc.src.math.f16subf128
 )
 
diff --git a/libc/test/src/math/smoke/SubTest.h b/libc/test/src/math/smoke/SubTest.h
index e5e04996affa8..9ee4220b38208 100644
--- a/libc/test/src/math/smoke/SubTest.h
+++ b/libc/test/src/math/smoke/SubTest.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_SUBTEST_H
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_SUBTEST_H
 
+#include "hdr/errno_macros.h"
 #include "hdr/fenv_macros.h"
-#include "src/__support/FPUtil/BasicOperations.h"
 #include "test/UnitTest/FEnvSafeTest.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"

>From 4497a7e1448777088c71d8ac104a2c37f05c18a5 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Tue, 30 Jul 2024 18:30:16 +0000
Subject: [PATCH 09/16] addressed comments

included long double inp and double output template
removed from riscv entrypoints
removed dfmaf128 and dsubf128 from MPFR
---
 libc/config/baremetal/riscv/entrypoints.txt |  2 --
 libc/spec/llvm_libc_ext.td                  |  2 +-
 libc/spec/stdc.td                           |  4 ---
 libc/src/math/CMakeLists.txt                |  3 ++
 libc/src/math/dfmal.h                       |  1 -
 libc/src/math/dsubl.h                       |  1 +
 libc/src/math/generic/dfmaf128.cpp          |  4 +--
 libc/test/src/math/CMakeLists.txt           | 31 ++++-----------------
 libc/test/src/math/dfmaf128_test.cpp        | 13 ---------
 libc/test/src/math/dsubf128_test.cpp        | 13 ---------
 libc/test/src/math/smoke/CMakeLists.txt     | 10 ++++++-
 libc/utils/MPFRWrapper/MPFRUtils.cpp        | 10 +++++++
 12 files changed, 31 insertions(+), 63 deletions(-)
 delete mode 100644 libc/test/src/math/dfmaf128_test.cpp
 delete mode 100644 libc/test/src/math/dsubf128_test.cpp

diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index e8452d273556a..fb0308c953746 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -243,8 +243,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dfmal
-    libc.src.math.dsubl
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td
index 8503f66f34b54..1bd001f414187 100644
--- a/libc/spec/llvm_libc_ext.td
+++ b/libc/spec/llvm_libc_ext.td
@@ -57,7 +57,7 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
       [], // Types
       [], // Enumerations
       [
-          GuardedFunctionSpec<"dfmaf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+          GuardedFunctionSpec<"dfmaf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
           GuardedFunctionSpec<"dsqrtf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
           GuardedFunctionSpec<"dsubf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
 
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 880046d6fb344..e02518c03cbf3 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -398,12 +398,8 @@ def StdC : StandardSpec<"stdc"> {
           GuardedFunctionSpec<"ceilf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
 
           FunctionSpec<"dfmal", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-          FunctionSpec<"dfmaf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<Float128Type]>,
           FunctionSpec<"dsubl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
           
-
-
-
           FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>], [ConstAttr]>,
           FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
           FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index a816076d3919f..030fb4a1bdd5c 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -88,10 +88,13 @@ add_math_entrypoint_object(cospif)
 
 add_math_entrypoint_object(dmull)
 add_math_entrypoint_object(dmulf128)
+
 add_math_entrypoint_object(dfmal)
 add_math_entrypoint_object(dfmaf128)
+
 add_math_entrypoint_object(dsqrtl)
 add_math_entrypoint_object(dsqrtf128)
+
 add_math_entrypoint_object(dsubl)
 add_math_entrypoint_object(dsubf128)
 
diff --git a/libc/src/math/dfmal.h b/libc/src/math/dfmal.h
index 6e8af7c4f21c2..e0867305b1286 100644
--- a/libc/src/math/dfmal.h
+++ b/libc/src/math/dfmal.h
@@ -10,7 +10,6 @@
 #define LLVM_LIBC_SRC_MATH_DFMAL_H
 
 #include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/math/dsubl.h b/libc/src/math/dsubl.h
index 4dc396c2731a1..a512bbe06d4e8 100644
--- a/libc/src/math/dsubl.h
+++ b/libc/src/math/dsubl.h
@@ -10,6 +10,7 @@
 #define LLVM_LIBC_SRC_MATH_DSUBL_H
 
 #include "src/__support/macros/config.h"
+
 namespace LIBC_NAMESPACE_DECL {
 
 double dsubl(long double x, long double y);
diff --git a/libc/src/math/generic/dfmaf128.cpp b/libc/src/math/generic/dfmaf128.cpp
index 36b06e396b9f7..ceaa6e615f219 100644
--- a/libc/src/math/generic/dfmaf128.cpp
+++ b/libc/src/math/generic/dfmaf128.cpp
@@ -1,4 +1,4 @@
-//===-- Implementation header for dfmaf128 ----------------------*- C++ -*-===//
+//===-- Implementation of dfmaf128 header -----------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -17,7 +17,7 @@
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, dfmaf128, (float128 x, float128 y, float128 z)) {
-  return fputil::generic::fma<double>(x, y, z);
+  return fputil::fma<double>(x, y, z);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index a1d79d91c6a61..621f36a2f65b7 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -2379,19 +2379,8 @@ add_fp_unittest(
     FmaTest.h
   DEPENDS
     libc.src.math.dfmal
-)
-
-add_fp_unittest(
-  dfmaf128_test
-  NEED_MPFR
-  SUITE
-    libc-math-unittests
-  SRCS
-    dfmaf128_test.cpp
-  HDRS
-    FmaTest.h
-  DEPENDS
-    libc.src.math.dfmaf128
+    libc.src.stdlib.rand
+    libc.src.stdlib.srand
 )
 
 add_fp_unittest(
@@ -2403,22 +2392,12 @@ add_fp_unittest(
     dsubl_test.cpp
   HDRS
     SubTest.h
-  DEPENDS
+  DEPENDS 
+    libc.src.errno.errno
+    libc.hdr.fenv_macros
     libc.src.math.dsubl
 )
 
-add_fp_unittest(
-  dsubf128_test
-  NEED_MPFR
-  SUITE
-    libc-math-unittests
-  SRCS
-    dsubf128_test.cpp
-  HDRS
-    SubTest.h
-  DEPENDS
-    libc.src.math.dsubf128
-)
 
 add_subdirectory(generic)
 add_subdirectory(smoke)
diff --git a/libc/test/src/math/dfmaf128_test.cpp b/libc/test/src/math/dfmaf128_test.cpp
deleted file mode 100644
index 56c11747047b1..0000000000000
--- a/libc/test/src/math/dfmaf128_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for dfmaf128 --------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "FmaTest.h"
-
-#include "src/math/dfmaf128.h"
-
-LIST_NARROWING_FMA_TESTS(double, float128, LIBC_NAMESPACE::dfmaf128)
diff --git a/libc/test/src/math/dsubf128_test.cpp b/libc/test/src/math/dsubf128_test.cpp
deleted file mode 100644
index e496cdd245070..0000000000000
--- a/libc/test/src/math/dsubf128_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for dsubf128 --------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "SubTest.h"
-
-#include "src/math/dsubf128.h"
-
-LIST_SUB_TESTS(double, float128, LIBC_NAMESPACE::dsubf128)
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index d023f954ccc13..e56c9fe0aee35 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -368,6 +368,8 @@ add_fp_unittest(
     FmaTest.h
   DEPENDS
     libc.src.math.dfmal
+    libc.src.stdlib.rand
+    libc.src.stdlib.srand
 )
 
 add_fp_unittest(
@@ -377,9 +379,11 @@ add_fp_unittest(
   SRCS
     dfmaf128_test.cpp
   HDRS
-    SubTest.h
+    FmaTest.h
   DEPENDS
     libc.src.math.dfmaf128
+    libc.src.stdlib.rand
+    libc.src.stdlib.srand
 )
 
 add_fp_unittest(
@@ -391,6 +395,8 @@ add_fp_unittest(
   HDRS
     SubTest.h
   DEPENDS
+    libc.src.errno.errno
+    libc.hdr.fenv_macros
     libc.src.math.dsubl
 )
 
@@ -403,6 +409,8 @@ add_fp_unittest(
   HDRS
     SubTest.h
   DEPENDS
+    libc.src.errno.errno
+    libc.hdr.fenv_macros
     libc.src.math.dsubf128
 )
 
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index f88ee2af35c52..dea23d13c815c 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -1086,6 +1086,11 @@ template void
 explain_ternary_operation_one_output_error(Operation,
                                            const TernaryInput<long double> &,
                                            long double, double, RoundingMode);
+
+template void
+explain_ternary_operation_one_output_error(Operation,
+                                           const TernaryInput<long double> &,
+                                           double, double, RoundingMode);
 #ifdef LIBC_TYPES_HAS_FLOAT16
 template void explain_ternary_operation_one_output_error(
     Operation, const TernaryInput<float> &, float16, double, RoundingMode);
@@ -1271,6 +1276,11 @@ template bool
 compare_ternary_operation_one_output(Operation,
                                      const TernaryInput<long double> &,
                                      long double, double, RoundingMode);
+
+template bool
+compare_ternary_operation_one_output(Operation,
+                                     const TernaryInput<long double> &,
+                                     double, double, RoundingMode);
 #ifdef LIBC_TYPES_HAS_FLOAT16
 template bool compare_ternary_operation_one_output(Operation,
                                                    const TernaryInput<float> &,

>From eb8066cff4bc697cbf69b83877b491d91c4f07e7 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Tue, 30 Jul 2024 19:41:25 +0000
Subject: [PATCH 10/16] fixed clang formatting error

---
 libc/utils/MPFRWrapper/MPFRUtils.cpp | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index dea23d13c815c..4263c9dccb6a5 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -1087,10 +1087,8 @@ explain_ternary_operation_one_output_error(Operation,
                                            const TernaryInput<long double> &,
                                            long double, double, RoundingMode);
 
-template void
-explain_ternary_operation_one_output_error(Operation,
-                                           const TernaryInput<long double> &,
-                                           double, double, RoundingMode);
+template void explain_ternary_operation_one_output_error(
+    Operation, const TernaryInput<long double> &, double, double, RoundingMode);
 #ifdef LIBC_TYPES_HAS_FLOAT16
 template void explain_ternary_operation_one_output_error(
     Operation, const TernaryInput<float> &, float16, double, RoundingMode);
@@ -1277,10 +1275,8 @@ compare_ternary_operation_one_output(Operation,
                                      const TernaryInput<long double> &,
                                      long double, double, RoundingMode);
 
-template bool
-compare_ternary_operation_one_output(Operation,
-                                     const TernaryInput<long double> &,
-                                     double, double, RoundingMode);
+template bool compare_ternary_operation_one_output(
+    Operation, const TernaryInput<long double> &, double, double, RoundingMode);
 #ifdef LIBC_TYPES_HAS_FLOAT16
 template bool compare_ternary_operation_one_output(Operation,
                                                    const TernaryInput<float> &,

>From 573b56885753f042bdbf47b4c2cd129f767c1ed2 Mon Sep 17 00:00:00 2001
From: aaryanshukla <53713108+aaryanshukla at users.noreply.github.com>
Date: Tue, 30 Jul 2024 12:47:03 -0700
Subject: [PATCH 11/16] Update libc/src/math/generic/dfmaf128.cpp

Co-authored-by: OverMighty <its.overmighty at gmail.com>
---
 libc/src/math/generic/dfmaf128.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/math/generic/dfmaf128.cpp b/libc/src/math/generic/dfmaf128.cpp
index ceaa6e615f219..7c0b12280db00 100644
--- a/libc/src/math/generic/dfmaf128.cpp
+++ b/libc/src/math/generic/dfmaf128.cpp
@@ -1,4 +1,4 @@
-//===-- Implementation of dfmaf128 header -----------------------*- C++ -*-===//
+//===-- Implementation of dfmaf128 function -------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

>From ff8a27f7393d0441aa220d0ecb3e1c7485c4449b Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Tue, 30 Jul 2024 19:55:28 +0000
Subject: [PATCH 12/16] addressed comments

removed entrypoints from riscv
---
 libc/config/baremetal/arm/entrypoints.txt | 2 --
 libc/src/math/generic/dfmaf128.cpp        | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index cd43e2ba19e45..8025ac09b9f82 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -247,8 +247,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dfmal
-    libc.src.math.dsubl
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/src/math/generic/dfmaf128.cpp b/libc/src/math/generic/dfmaf128.cpp
index 7c0b12280db00..b6e1bdb085cf7 100644
--- a/libc/src/math/generic/dfmaf128.cpp
+++ b/libc/src/math/generic/dfmaf128.cpp
@@ -11,8 +11,8 @@
 
 #include "src/math/dfmaf128.h"
 #include "src/__support/FPUtil/FMA.h"
+#include "src/__support/common.h"
 #include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
 
 namespace LIBC_NAMESPACE_DECL {
 

>From 267f34008eaa720566013a87f8f0b9c98098326d Mon Sep 17 00:00:00 2001
From: aaryanshukla <53713108+aaryanshukla at users.noreply.github.com>
Date: Tue, 30 Jul 2024 15:42:54 -0700
Subject: [PATCH 13/16] Update libc/test/src/math/CMakeLists.txt

Co-authored-by: OverMighty <its.overmighty at gmail.com>
---
 libc/test/src/math/CMakeLists.txt | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 621f36a2f65b7..8b447e97bb700 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -2392,9 +2392,7 @@ add_fp_unittest(
     dsubl_test.cpp
   HDRS
     SubTest.h
-  DEPENDS 
-    libc.src.errno.errno
-    libc.hdr.fenv_macros
+  DEPENDS
     libc.src.math.dsubl
 )
 

>From d1466cd5603c2cc634b13e59ec7ee31ae684cb02 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Tue, 30 Jul 2024 22:44:56 +0000
Subject: [PATCH 14/16] fixed errno.errno in smoke Cmake

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

diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index e56c9fe0aee35..29dd61d08702d 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -409,7 +409,7 @@ add_fp_unittest(
   HDRS
     SubTest.h
   DEPENDS
-    libc.src.errno.errno
+    libc.hdr.errno_macros
     libc.hdr.fenv_macros
     libc.src.math.dsubf128
 )

>From c36235109c64fc46b25c75c971c646d915092804 Mon Sep 17 00:00:00 2001
From: aaryanshukla <53713108+aaryanshukla at users.noreply.github.com>
Date: Wed, 31 Jul 2024 11:22:39 -0700
Subject: [PATCH 15/16] Update libc/test/src/math/smoke/CMakeLists.txt

Co-authored-by: OverMighty <its.overmighty at gmail.com>
---
 libc/test/src/math/smoke/CMakeLists.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 29dd61d08702d..65771dfd4a65a 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -368,8 +368,6 @@ add_fp_unittest(
     FmaTest.h
   DEPENDS
     libc.src.math.dfmal
-    libc.src.stdlib.rand
-    libc.src.stdlib.srand
 )
 
 add_fp_unittest(

>From 73a1b718eff49adbb79dc1880b7106d43d5c05ea Mon Sep 17 00:00:00 2001
From: aaryanshukla <53713108+aaryanshukla at users.noreply.github.com>
Date: Wed, 31 Jul 2024 11:22:49 -0700
Subject: [PATCH 16/16] Update libc/test/src/math/smoke/CMakeLists.txt

Co-authored-by: OverMighty <its.overmighty at gmail.com>
---
 libc/test/src/math/smoke/CMakeLists.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 65771dfd4a65a..dc687e8c0f75e 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -380,8 +380,6 @@ add_fp_unittest(
     FmaTest.h
   DEPENDS
     libc.src.math.dfmaf128
-    libc.src.stdlib.rand
-    libc.src.stdlib.srand
 )
 
 add_fp_unittest(



More information about the libc-commits mailing list