[libc-commits] [libc] [libc][math][c23] Add dadd{l, f128} and ddiv{l, f128} C23 math functions (PR #100456)

via libc-commits libc-commits at lists.llvm.org
Tue Jul 30 10:25:37 PDT 2024


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

>From baaf05c414fbb151f5f1d3065425f200722bc514 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Fri, 19 Jul 2024 17:55:11 +0000
Subject: [PATCH 01/14] testing

---
 libc/config/gpu/entrypoints.txt          |  1 +
 libc/config/linux/x86_64/entrypoints.txt |  1 +
 libc/config/windows/entrypoints.txt      |  1 +
 libc/spec/stdc.td                        |  2 ++
 libc/src/math/CMakeLists.txt             |  1 +
 libc/src/math/dadd.h                     | 21 +++++++++++++++++++++
 libc/src/math/generic/dadd.cpp           | 20 ++++++++++++++++++++
 7 files changed, 47 insertions(+)
 create mode 100644 libc/src/math/dadd.h
 create mode 100644 libc/src/math/generic/dadd.cpp

diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 506c7d6d7b314..58fa5311d3d68 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -254,6 +254,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.cosh
     libc.src.math.coshf
+    libc.src.math.dadd
     libc.src.math.erf
     libc.src.math.erff
     libc.src.math.exp
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 7c422bad9f01d..1eca43f92dff9 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -383,6 +383,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cospif
     libc.src.math.dmull
     libc.src.math.dsqrtl
+    libc.src.math.dadd
     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..c6c506daa999d 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -132,6 +132,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
+    libc.src.math.dadd
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 0aae65308d33a..797bb25b8a886 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -397,6 +397,8 @@ 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<"dadd", RetValSpec<DoubleType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+
           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..8024a434ec306 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -86,6 +86,7 @@ add_math_entrypoint_object(cosh)
 add_math_entrypoint_object(coshf)
 add_math_entrypoint_object(cospif)
 
+add_math_entrypoint_object(dadd)
 add_math_entrypoint_object(dmull)
 add_math_entrypoint_object(dmulf128)
 
diff --git a/libc/src/math/dadd.h b/libc/src/math/dadd.h
new file mode 100644
index 0000000000000..b78c9e84fe7fb
--- /dev/null
+++ b/libc/src/math/dadd.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for dadd --------------------------*- 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_DADD_H
+#define LLVM_LIBC_SRC_MATH_DADD_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double daadd(float x, float y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DADD_H
diff --git a/libc/src/math/generic/dadd.cpp b/libc/src/math/generic/dadd.cpp
new file mode 100644
index 0000000000000..73a807d397a79
--- /dev/null
+++ b/libc/src/math/generic/dadd.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of dadd 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/dadd.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, f16add, (float x, float y)) {
+  return fputil::generic::add<double>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL

>From 84b6988dfe10a416f9ff7529b401a81937070a48 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Fri, 19 Jul 2024 20:44:29 +0000
Subject: [PATCH 02/14] [libc][math] rest of basic operations

---
 libc/config/baremetal/arm/entrypoints.txt   |  1 +
 libc/config/baremetal/riscv/entrypoints.txt |  1 +
 libc/config/linux/aarch64/entrypoints.txt   |  1 +
 libc/config/linux/arm/entrypoints.txt       |  1 +
 libc/config/linux/riscv/entrypoints.txt     |  1 +
 libc/src/math/dadd.h                        |  3 +--
 libc/src/math/generic/CMakeLists.txt        | 13 +++++++++++++
 libc/src/math/generic/dadd.cpp              |  4 ++--
 libc/test/src/math/CMakeLists.txt           | 15 +++++++++++++++
 libc/test/src/math/smoke/CMakeLists.txt     | 13 +++++++++++++
 libc/test/src/math/smoke/dadd_test.cpp      | 13 +++++++++++++
 11 files changed, 62 insertions(+), 4 deletions(-)
 create mode 100644 libc/test/src/math/smoke/dadd_test.cpp

diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 8025ac09b9f82..b08e941c312be 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -247,6 +247,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
+    libc.src.math.dadd
     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..005371ca90e47 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -243,6 +243,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
+    libc.src.math.dadd
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 0be6f884f0368..2f407725bdf1e 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -358,6 +358,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
+    libc.src.math.dadd
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.erff
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 55f118395c22e..2100c52253d05 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -227,6 +227,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
+    libc.src.math.dadd
     libc.src.math.dsqrtl
     libc.src.math.erff
     libc.src.math.exp
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index ea08957f4ee89..6f52292f15a37 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -381,6 +381,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
+    libc.src.math.dadd
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.erff
diff --git a/libc/src/math/dadd.h b/libc/src/math/dadd.h
index b78c9e84fe7fb..d6360af918d79 100644
--- a/libc/src/math/dadd.h
+++ b/libc/src/math/dadd.h
@@ -10,11 +10,10 @@
 #define LLVM_LIBC_SRC_MATH_DADD_H
 
 #include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
-double daadd(float x, float y);
+double dadd(float x, float y);
 
 } // namespace LIBC_NAMESPACE_DECL
 
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 74360edff3f9a..52d697b935e15 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -129,6 +129,19 @@ add_entrypoint_object(
     libc.src.__support.FPUtil.nearest_integer_operations
 )
 
+add_entrypoint_object(
+  dadd
+  SRCS
+    dadd.cpp
+  HDRS
+    ../dadd.h
+  COMPILE_OPTIONS
+    -O3
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+
+)
+
 add_entrypoint_object(
   dsqrtl
   SRCS
diff --git a/libc/src/math/generic/dadd.cpp b/libc/src/math/generic/dadd.cpp
index 73a807d397a79..6238502aa439f 100644
--- a/libc/src/math/generic/dadd.cpp
+++ b/libc/src/math/generic/dadd.cpp
@@ -13,8 +13,8 @@
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(double, f16add, (float x, float y)) {
-  return fputil::generic::add<double>(x, y);
+LLVM_LIBC_FUNCTION(double, dadd, (float x, float y)) {
+  return static_cast<double>(x) + static_cast<double>(y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 3ad5d98858165..96fb8c63ac9b8 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -44,6 +44,21 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+
+add_fp_unittest(
+  dadd_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    dadd_test.cpp
+  HDRS
+    AddTest.h
+  DEPENDS
+    libc.src.math.dadd
+    libc.src.__support.FPUtil.basic_operations
+)
+
 add_fp_unittest(
   sinf_test
   NEED_MPFR
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 1b3c51739c0fe..76d51c89dfc1a 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -358,6 +358,19 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  dadd_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    dadd_test.cpp
+  HDRS
+    AddTest.h
+  DEPENDS
+    libc.src.math.dadd
+    libc.src.__support.FPUtil.basic_operations
+)
+
 add_fp_unittest(
   floor_test
   SUITE
diff --git a/libc/test/src/math/smoke/dadd_test.cpp b/libc/test/src/math/smoke/dadd_test.cpp
new file mode 100644
index 0000000000000..a5df1acf7122b
--- /dev/null
+++ b/libc/test/src/math/smoke/dadd_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for dadd ----------------------------------------------===//
+//
+// 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 "AddTest.h"
+
+#include "src/math/dadd.h"
+
+LIST_ADD_TESTS(double, float, LIBC_NAMESPACE::dadd)

>From d12aa59870f3b9242cd95da89be1dfed65015838 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Fri, 19 Jul 2024 22:11:11 +0000
Subject: [PATCH 03/14] implementing daddl and daddf128

---
 libc/config/baremetal/arm/entrypoints.txt     | 3 ++-
 libc/config/baremetal/riscv/entrypoints.txt   | 3 ++-
 libc/config/darwin/arm/entrypoints.txt        | 2 ++
 libc/config/darwin/x86_64/entrypoints.txt     | 2 ++
 libc/config/gpu/entrypoints.txt               | 3 ++-
 libc/config/linux/aarch64/entrypoints.txt     | 3 ++-
 libc/config/linux/arm/entrypoints.txt         | 3 ++-
 libc/config/linux/riscv/entrypoints.txt       | 3 ++-
 libc/config/linux/x86_64/entrypoints.txt      | 3 ++-
 libc/config/windows/entrypoints.txt           | 3 ++-
 libc/docs/math/index.rst                      | 2 +-
 libc/spec/stdc.td                             | 3 ++-
 libc/src/math/{dadd.h => daddl.h}             | 8 ++++----
 libc/src/math/generic/{dadd.cpp => daddl.cpp} | 4 ++--
 14 files changed, 29 insertions(+), 16 deletions(-)
 rename libc/src/math/{dadd.h => daddl.h} (76%)
 rename libc/src/math/generic/{dadd.cpp => daddl.cpp} (86%)

diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index b08e941c312be..3de4744a7ec5d 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -247,7 +247,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dadd
+    libc.src.math.daddl
+    libc.src.math.daddf128
     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 005371ca90e47..78ca96688e720 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -243,7 +243,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dadd
+    libc.src.math.daddl
+    libc.src.math.daddf128
     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..27870ca5dfa04 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -135,6 +135,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.cospif
+    libc.src.math.daddl
+    libc.src.math.daddf128
     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..c32279346f013 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -119,6 +119,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     #libc.src.math.ceill
     #libc.src.math.coshf
     #libc.src.math.cosf
+    libc.src.math.daddl
+    libc.src.math.daddf128
     #libc.src.math.dsqrtl
     #libc.src.math.expf
     #libc.src.math.exp2f
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 58fa5311d3d68..33fa1b6d66231 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -254,7 +254,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.cosh
     libc.src.math.coshf
-    libc.src.math.dadd
+    libc.src.math.daddl
+    libc.src.math.daddf128
     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 2f407725bdf1e..7a042209ce8d6 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -358,7 +358,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
-    libc.src.math.dadd
+    libc.src.math.daddl
+    libc.src.math.daddf128
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.erff
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 2100c52253d05..aed1dc92c7aaa 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -227,7 +227,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dadd
+    libc.src.math.daddl
+    libc.src.math.daddf128
     libc.src.math.dsqrtl
     libc.src.math.erff
     libc.src.math.exp
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 6f52292f15a37..0e9ad2e2090e7 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -381,7 +381,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.cospif
-    libc.src.math.dadd
+    libc.src.math.daddl
+    libc.src.math.daddf128
     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 1eca43f92dff9..114ef003d6911 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -383,7 +383,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cospif
     libc.src.math.dmull
     libc.src.math.dsqrtl
-    libc.src.math.dadd
+    libc.src.math.daddl
+    libc.src.math.daddf128
     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 c6c506daa999d..e3ac2287635c9 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -132,7 +132,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.coshf
-    libc.src.math.dadd
+    libc.src.math.daddl
+    libc.src.math.daddf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf
diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index f287c16fd01e2..699ac76e60d9d 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -136,7 +136,7 @@ Basic Operations
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | fabs             | |check|          | |check|         | |check|                | |check|              | |check|                | 7.12.7.3               | F.10.4.3                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| fadd             | N/A              | |check|         | |check|                | N/A                  | |check|                | 7.12.14.1              | F.10.11                    |
+| fadd             | N/A              |                 |                        | N/A                  |                        | 7.12.14.1              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | fdim             | |check|          | |check|         | |check|                | |check|              | |check|                | 7.12.12.1              | F.10.9.1                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 797bb25b8a886..12c41920a6008 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -397,7 +397,8 @@ 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<"dadd", RetValSpec<DoubleType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"daddf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
+          FunctionSpec<"daddl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
 
           FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>], [ConstAttr]>,
           FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
diff --git a/libc/src/math/dadd.h b/libc/src/math/daddl.h
similarity index 76%
rename from libc/src/math/dadd.h
rename to libc/src/math/daddl.h
index d6360af918d79..7fa7bef5e8038 100644
--- a/libc/src/math/dadd.h
+++ b/libc/src/math/daddl.h
@@ -6,15 +6,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_LIBC_SRC_MATH_DADD_H
-#define LLVM_LIBC_SRC_MATH_DADD_H
+#ifndef LLVM_LIBC_SRC_MATH_DADDL_H
+#define LLVM_LIBC_SRC_MATH_DADDL_H
 
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
-double dadd(float x, float y);
+double daddl(long double x, long double y);
 
 } // namespace LIBC_NAMESPACE_DECL
 
-#endif // LLVM_LIBC_SRC_MATH_DADD_H
+#endif // LLVM_LIBC_SRC_MATH_DADDL_H
diff --git a/libc/src/math/generic/dadd.cpp b/libc/src/math/generic/daddl.cpp
similarity index 86%
rename from libc/src/math/generic/dadd.cpp
rename to libc/src/math/generic/daddl.cpp
index 6238502aa439f..ed13e410b11a4 100644
--- a/libc/src/math/generic/dadd.cpp
+++ b/libc/src/math/generic/daddl.cpp
@@ -6,14 +6,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/math/dadd.h"
+#include "src/math/daddl.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, dadd, (float x, float y)) {
+LLVM_LIBC_FUNCTION(double, daddl, (long double x, long double y)) {
   return static_cast<double>(x) + static_cast<double>(y);
 }
 

>From a8004e4610e6b0a00605a6b48469b1e815fcf96f Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 22 Jul 2024 23:50:09 +0000
Subject: [PATCH 04/14] testing

---
 libc/CMakeLists.txt                           |  2 +-
 libc/config/baremetal/arm/entrypoints.txt     |  2 +
 libc/config/baremetal/riscv/entrypoints.txt   |  2 +
 libc/config/darwin/arm/entrypoints.txt        |  6 ++
 libc/config/darwin/x86_64/entrypoints.txt     |  6 ++
 libc/config/gpu/entrypoints.txt               |  2 +
 libc/config/linux/aarch64/entrypoints.txt     |  2 +
 libc/config/linux/arm/entrypoints.txt         |  6 ++
 libc/config/linux/riscv/entrypoints.txt       |  6 ++
 libc/config/linux/x86_64/entrypoints.txt      |  2 +
 libc/config/windows/entrypoints.txt           |  2 +
 libc/newhdrgen/yaml_to_classes.py             |  4 +-
 libc/spec/stdc.td                             |  2 +
 libc/src/math/CMakeLists.txt                  |  5 +-
 libc/src/math/daddf128.h                      | 20 ++++++
 libc/src/math/daddl.h                         |  3 +-
 libc/src/math/ddivf128.h                      | 20 ++++++
 libc/src/math/ddivl.h                         | 20 ++++++
 libc/src/math/fadd.h                          |  3 +-
 libc/src/math/generic/CMakeLists.txt          | 46 ++++++++++++--
 libc/src/math/generic/daddf128.cpp            | 22 +++++++
 libc/src/math/generic/daddl.cpp               |  4 +-
 libc/src/math/generic/ddivf128.cpp            | 22 +++++++
 libc/src/math/generic/ddivl.cpp               | 20 ++++++
 libc/test/src/math/CMakeLists.txt             | 50 +++++++++++++--
 libc/test/src/math/daddf128_test.cpp          | 13 ++++
 .../{smoke/dadd_test.cpp => daddl_test.cpp}   |  6 +-
 libc/test/src/math/ddivf128_test.cpp          | 13 ++++
 libc/test/src/math/ddivl_test.cpp             | 13 ++++
 libc/test/src/math/smoke/CMakeLists.txt       | 61 +++++++++++++++----
 libc/test/src/math/smoke/daddf128_test.cpp    | 13 ++++
 libc/test/src/math/smoke/daddl_test.cpp       | 13 ++++
 libc/test/src/math/smoke/ddivf128_test.cpp    | 13 ++++
 libc/test/src/math/smoke/ddivl_test.cpp       | 13 ++++
 34 files changed, 403 insertions(+), 34 deletions(-)
 create mode 100644 libc/src/math/daddf128.h
 create mode 100644 libc/src/math/ddivf128.h
 create mode 100644 libc/src/math/ddivl.h
 create mode 100644 libc/src/math/generic/daddf128.cpp
 create mode 100644 libc/src/math/generic/ddivf128.cpp
 create mode 100644 libc/src/math/generic/ddivl.cpp
 create mode 100644 libc/test/src/math/daddf128_test.cpp
 rename libc/test/src/math/{smoke/dadd_test.cpp => daddl_test.cpp} (65%)
 create mode 100644 libc/test/src/math/ddivf128_test.cpp
 create mode 100644 libc/test/src/math/ddivl_test.cpp
 create mode 100644 libc/test/src/math/smoke/daddf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/daddl_test.cpp
 create mode 100644 libc/test/src/math/smoke/ddivf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/ddivl_test.cpp

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 6e0760724d963..45cca17562d26 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -73,7 +73,7 @@ if(LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
   add_subdirectory(utils/gpu)
 endif()
 
-option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" OFF)
+option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" ON)
 
 set(NEED_LIBC_HDRGEN FALSE)
 if(NOT LLVM_RUNTIMES_BUILD)
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 3de4744a7ec5d..d9ba57ef0b9c5 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -249,6 +249,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.coshf
     libc.src.math.daddl
     libc.src.math.daddf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     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 78ca96688e720..d1a54dc24e385 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -245,6 +245,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.coshf
     libc.src.math.daddl
     libc.src.math.daddf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     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 27870ca5dfa04..6c5e86f7dcafc 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -138,6 +138,12 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.daddl
     libc.src.math.daddf128
     libc.src.math.dsqrtl
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index c32279346f013..6e461c4828d42 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -122,6 +122,12 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.daddl
     libc.src.math.daddf128
     #libc.src.math.dsqrtl
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     #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 33fa1b6d66231..8c3dfa47cb2c1 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -256,6 +256,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.coshf
     libc.src.math.daddl
     libc.src.math.daddf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     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 7a042209ce8d6..f0d6981bca02a 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -360,6 +360,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cospif
     libc.src.math.daddl
     libc.src.math.daddf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.erff
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index aed1dc92c7aaa..13992055d7074 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -230,6 +230,12 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.daddl
     libc.src.math.daddf128
     libc.src.math.dsqrtl
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     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 0e9ad2e2090e7..bc142e7d46523 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -385,6 +385,12 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.daddf128
     libc.src.math.dmull
     libc.src.math.dsqrtl
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     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 114ef003d6911..5fe9e7d19606b 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -385,6 +385,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.dsqrtl
     libc.src.math.daddl
     libc.src.math.daddf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     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 e3ac2287635c9..72b665cdf3932 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -134,6 +134,8 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.coshf
     libc.src.math.daddl
     libc.src.math.daddf128
+    libc.src.math.ddivl
+    libc.src.math.ddivf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index 78588055cc960..faeca417514ea 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -118,7 +118,7 @@ def load_yaml_file(yaml_file, header_class, entry_points):
         HeaderFile: An instance of HeaderFile populated with the data.
     """
     with open(yaml_file, "r") as f:
-        yaml_data = yaml.safe_load(f)
+        yaml_data = yaml.load(f, loader=yaml.FullLoader)
     return yaml_to_classes(yaml_data, header_class, entry_points)
 
 
@@ -173,7 +173,7 @@ def add_function_to_yaml(yaml_file, function_details):
     new_function = parse_function_details(function_details)
 
     with open(yaml_file, "r") as f:
-        yaml_data = yaml.safe_load(f)
+        yaml_data = yaml.load(f, Loader=yaml.FullLoader)
 
     if "functions" not in yaml_data:
         yaml_data["functions"] = []
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 12c41920a6008..55ec2f96ecdf5 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -399,6 +399,8 @@ def StdC : StandardSpec<"stdc"> {
 
           FunctionSpec<"daddf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
           FunctionSpec<"daddl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          FunctionSpec<"ddivl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          FunctionSpec<"ddivf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
 
           FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>], [ConstAttr]>,
           FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 8024a434ec306..5688c3590c18d 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -86,7 +86,10 @@ add_math_entrypoint_object(cosh)
 add_math_entrypoint_object(coshf)
 add_math_entrypoint_object(cospif)
 
-add_math_entrypoint_object(dadd)
+add_math_entrypoint_object(daddl)
+add_math_entrypoint_object(daddf128)
+add_math_entrypoint_object(ddivl)
+add_math_entrypoint_object(ddivf128)
 add_math_entrypoint_object(dmull)
 add_math_entrypoint_object(dmulf128)
 
diff --git a/libc/src/math/daddf128.h b/libc/src/math/daddf128.h
new file mode 100644
index 0000000000000..dd3f4ce717039
--- /dev/null
+++ b/libc/src/math/daddf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for daddf128 --------------------------*- 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_DADDF128_H
+#define LLVM_LIBC_SRC_MATH_DADDF128_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double daddf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DADDF128_H
diff --git a/libc/src/math/daddl.h b/libc/src/math/daddl.h
index 7fa7bef5e8038..1b3bdeeb04894 100644
--- a/libc/src/math/daddl.h
+++ b/libc/src/math/daddl.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for dadd --------------------------*- C++ -*-===//
+//===-- Implementation header for daddl --------------------------*- 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/ddivf128.h b/libc/src/math/ddivf128.h
new file mode 100644
index 0000000000000..43a544a9d45b1
--- /dev/null
+++ b/libc/src/math/ddivf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for ddivf128 ----------------------*- 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_DDIVF128_H
+#define LLVM_LIBC_SRC_MATH_DDIVF128_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double ddivf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DDIVF128_H
diff --git a/libc/src/math/ddivl.h b/libc/src/math/ddivl.h
new file mode 100644
index 0000000000000..bf0da2887e330
--- /dev/null
+++ b/libc/src/math/ddivl.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for ddivl -------------------------*- 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_DDIVL_H
+#define LLVM_LIBC_SRC_MATH_DDIVL_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double ddivl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DDIVL_H
diff --git a/libc/src/math/fadd.h b/libc/src/math/fadd.h
index ec3ce18bb676a..1186f1ef40954 100644
--- a/libc/src/math/fadd.h
+++ b/libc/src/math/fadd.h
@@ -6,11 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/__support/macros/config.h"
-
 #ifndef LLVM_LIBC_SRC_MATH_FADD_H
 #define LLVM_LIBC_SRC_MATH_FADD_H
 
+#include "src/__support/macros/config.h"
 namespace LIBC_NAMESPACE_DECL {
 
 float fadd(double x, double y);
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 52d697b935e15..f35f4ede42d0f 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -130,16 +130,52 @@ add_entrypoint_object(
 )
 
 add_entrypoint_object(
-  dadd
+  daddl
   SRCS
-    dadd.cpp
+    daddl.cpp
   HDRS
-    ../dadd.h
+    ../daddl.h
   COMPILE_OPTIONS
     -O3
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.generic.add_sub.h
+
+)
 
+add_entrypoint_object(
+  daddf128
+  SRCS
+    daddf128.cpp
+  HDRS
+    ../daddf128.h
+  COMPILE_OPTIONS
+    -O3
+  DEPENDS
+    libc.src.__support.FPUtil.generic.add_sub.h
+)
+
+add_entrypoint_object(
+  ddivl
+  SRCS
+    ddivl.cpp
+  HDRS
+    ../ddivl.h
+  COMPILE_OPTIONS
+    -O3
+  DEPENDS
+    libc.src.__support.FPUtil.generic.div.h
+)
+
+add_entrypoint_object(
+  ddivf128
+  SRCS
+    ddivf128.cpp
+  HDRS
+    ../ddivf128.h
+  COMPILE_OPTIONS
+    -O3
+  DEPENDS
+    libc.src.__support.FPUtil.generic.div.h
 )
 
 add_entrypoint_object(
@@ -505,7 +541,7 @@ add_entrypoint_object(
   HDRS
     ../fadd.h
   DEPENDS
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.__support.FPUtil.generic.add_sub
   COMPILE_OPTIONS
     -O3
 )
diff --git a/libc/src/math/generic/daddf128.cpp b/libc/src/math/generic/daddf128.cpp
new file mode 100644
index 0000000000000..b967689ec9e81
--- /dev/null
+++ b/libc/src/math/generic/daddf128.cpp
@@ -0,0 +1,22 @@
+//===-- Implementation of daddf128 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/daddf128.h"
+#include "include/llvm-libc-types/float128.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, daddf128, (float128 x, float128 y)) {
+  return fputil::generic::add<double>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/daddl.cpp b/libc/src/math/generic/daddl.cpp
index ed13e410b11a4..2ae1add239162 100644
--- a/libc/src/math/generic/daddl.cpp
+++ b/libc/src/math/generic/daddl.cpp
@@ -1,4 +1,4 @@
-//===-- Implementation of dadd function ---------------------------------===//
+//===-- Implementation of daddl function ---------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -14,7 +14,7 @@
 namespace LIBC_NAMESPACE_DECL {
 
 LLVM_LIBC_FUNCTION(double, daddl, (long double x, long double y)) {
-  return static_cast<double>(x) + static_cast<double>(y);
+  return fputil::generic::add<double>(x, y);
 }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/ddivf128.cpp b/libc/src/math/generic/ddivf128.cpp
new file mode 100644
index 0000000000000..4d134be3cc052
--- /dev/null
+++ b/libc/src/math/generic/ddivf128.cpp
@@ -0,0 +1,22 @@
+//===-- Implementation of ddivf128 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/ddivf128.h"
+#include "include/llvm-libc-types/float128.h"
+#include "src/__support/FPUtil/generic/div.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, ddivf128, (float128 x, float128 y)) {
+  return fputil::generic::div<double>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/ddivl.cpp b/libc/src/math/generic/ddivl.cpp
new file mode 100644
index 0000000000000..64f3f5b4392bc
--- /dev/null
+++ b/libc/src/math/generic/ddivl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of ddivl 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/ddivl.h"
+#include "src/__support/FPUtil/generic/div.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, ddivl, (long double x, long double y)) {
+  return fputil::generic::div<double>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 96fb8c63ac9b8..24c2ac78e7e46 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -46,17 +46,59 @@ add_fp_unittest(
 
 
 add_fp_unittest(
-  dadd_test
+  daddl_test
   NEED_MPFR
   SUITE
     libc-math-unittests
   SRCS
-    dadd_test.cpp
+    daddl_test.cpp
   HDRS
     AddTest.h
   DEPENDS
-    libc.src.math.dadd
-    libc.src.__support.FPUtil.basic_operations
+    libc.src.math.daddl
+    libc.src.__support.FPUtil.generic.add_sub
+)
+
+add_fp_unittest(
+  daddf128_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    daddf128_test.cpp
+  HDRS
+    AddTest.h
+  DEPENDS
+    libc.src.math.daddf128
+    libc.src.__support.FPUtil.generic.add_sub
+)
+
+add_fp_unittest(
+  ddivf128_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    ddivf128_test.cpp
+  HDRS
+    DivTest.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.div
+    libc.src.math.ddivf128
+)
+
+add_fp_unittest(
+  ddivf128_test
+  NEED_MPFR
+  SUITE
+    libc-math-unittests
+  SRCS
+    ddivf128_test.cpp
+  HDRS
+    DivTest.h
+  DEPENDS
+    libc.src.__support.FPUtil.generic.div
+    libc.src.math.ddivf128
 )
 
 add_fp_unittest(
diff --git a/libc/test/src/math/daddf128_test.cpp b/libc/test/src/math/daddf128_test.cpp
new file mode 100644
index 0000000000000..a4d0341ba6512
--- /dev/null
+++ b/libc/test/src/math/daddf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for daddf128 ----------------------------------------------===//
+//
+// 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 "AddTest.h"
+
+#include "src/math/daddf128.h"
+
+LIST_ADD_TESTS(double, float128, LIBC_NAMESPACE::daddf128)
diff --git a/libc/test/src/math/smoke/dadd_test.cpp b/libc/test/src/math/daddl_test.cpp
similarity index 65%
rename from libc/test/src/math/smoke/dadd_test.cpp
rename to libc/test/src/math/daddl_test.cpp
index a5df1acf7122b..42002e5e33266 100644
--- a/libc/test/src/math/smoke/dadd_test.cpp
+++ b/libc/test/src/math/daddl_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for dadd ----------------------------------------------===//
+//===-- Unittests for daddl ----------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -8,6 +8,6 @@
 
 #include "AddTest.h"
 
-#include "src/math/dadd.h"
+#include "src/math/daddl.h"
 
-LIST_ADD_TESTS(double, float, LIBC_NAMESPACE::dadd)
+LIST_ADD_TESTS(double, long double, LIBC_NAMESPACE::daddl)
diff --git a/libc/test/src/math/ddivf128_test.cpp b/libc/test/src/math/ddivf128_test.cpp
new file mode 100644
index 0000000000000..ea1834a87baac
--- /dev/null
+++ b/libc/test/src/math/ddivf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ddivf128 --------------------------------------------===//
+//
+// 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 "DivTest.h"
+
+#include "src/math/ddivf128.h"
+
+LIST_ADD_TESTS(double, float128, LIBC_NAMESPACE::ddivf128)
diff --git a/libc/test/src/math/ddivl_test.cpp b/libc/test/src/math/ddivl_test.cpp
new file mode 100644
index 0000000000000..d3c638ddd4543
--- /dev/null
+++ b/libc/test/src/math/ddivl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ddivl ----------------------------------------------===//
+//
+// 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 "DivTest.h"
+
+#include "src/math/ddivl.h"
+
+LIST_ADD_TESTS(double, long double, LIBC_NAMESPACE::ddivl)
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 76d51c89dfc1a..536defb44138c 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -358,19 +358,6 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
-add_fp_unittest(
-  dadd_test
-  SUITE
-    libc-math-smoke-tests
-  SRCS
-    dadd_test.cpp
-  HDRS
-    AddTest.h
-  DEPENDS
-    libc.src.math.dadd
-    libc.src.__support.FPUtil.basic_operations
-)
-
 add_fp_unittest(
   floor_test
   SUITE
@@ -4167,3 +4154,51 @@ add_fp_unittest(
     libc.src.__support.FPUtil.basic_operations
     libc.src.math.f16mulf128
 )
+
+add_fp_unittest(
+  daddl
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    daddl_test.cpp
+  HDRS
+    AddTest.h
+  DEPENDS
+    libc.src.math.daddl
+)
+
+add_fp_unittest(
+  daddf128
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    daddf128_test.cpp
+  HDRS
+    AddTest.h
+  DEPENDS
+    libc.src.math.daddf128
+)
+
+add_fp_unittest(
+  ddivl
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ddivl_test.cpp
+  HDRS
+    DivTest.h
+  DEPENDS
+    libc.src.math.ddivl
+)
+
+add_fp_unittest(
+  ddivf128
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    ddivf128_test.cpp
+  HDRS
+    DivTest.h
+  DEPENDS
+    libc.src.math.ddivf128
+)
diff --git a/libc/test/src/math/smoke/daddf128_test.cpp b/libc/test/src/math/smoke/daddf128_test.cpp
new file mode 100644
index 0000000000000..a4d0341ba6512
--- /dev/null
+++ b/libc/test/src/math/smoke/daddf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for daddf128 ----------------------------------------------===//
+//
+// 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 "AddTest.h"
+
+#include "src/math/daddf128.h"
+
+LIST_ADD_TESTS(double, float128, LIBC_NAMESPACE::daddf128)
diff --git a/libc/test/src/math/smoke/daddl_test.cpp b/libc/test/src/math/smoke/daddl_test.cpp
new file mode 100644
index 0000000000000..42002e5e33266
--- /dev/null
+++ b/libc/test/src/math/smoke/daddl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for daddl ----------------------------------------------===//
+//
+// 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 "AddTest.h"
+
+#include "src/math/daddl.h"
+
+LIST_ADD_TESTS(double, long double, LIBC_NAMESPACE::daddl)
diff --git a/libc/test/src/math/smoke/ddivf128_test.cpp b/libc/test/src/math/smoke/ddivf128_test.cpp
new file mode 100644
index 0000000000000..b5f39154b0e84
--- /dev/null
+++ b/libc/test/src/math/smoke/ddivf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ddivf128 --------------------------------------------===//
+//
+// 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 "DivTest.h"
+
+#include "src/math/ddivf128.h"
+
+LIST_DIV_TESTS(double, float128, LIBC_NAMESPACE::ddivf128)
diff --git a/libc/test/src/math/smoke/ddivl_test.cpp b/libc/test/src/math/smoke/ddivl_test.cpp
new file mode 100644
index 0000000000000..7768766e30c12
--- /dev/null
+++ b/libc/test/src/math/smoke/ddivl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for ddivl -----------------------------------------------===//
+//
+// 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 "DivTest.h"
+
+#include "src/math/ddivl.h"
+
+LIST_DIV_TESTS(double, long double, LIBC_NAMESPACE::ddivl)

>From de2cf53e23c55deae873e566a992135ae8a4c9df Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 24 Jul 2024 20:02:16 +0000
Subject: [PATCH 05/14] [libc][math] implemented dadd and ddiv

---
 libc/docs/math/index.rst                |  6 +++---
 libc/newhdrgen/yaml_to_classes.py       |  2 +-
 libc/src/math/daddf128.h                |  4 +++-
 libc/src/math/ddivf128.h                |  1 +
 libc/src/math/generic/CMakeLists.txt    | 13 ++++++++-----
 libc/test/src/math/smoke/CMakeLists.txt |  4 ++++
 6 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index 699ac76e60d9d..f8b18e11c8aac 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -114,10 +114,10 @@ Basic Operations
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | copysign         | |check|          | |check|         | |check|                | |check|              | |check|                | 7.12.11.1              | F.10.8.1                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| dadd             | N/A              | N/A             |                        | N/A                  |                        | 7.12.14.1              | F.10.11                    |
-+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| ddiv             | N/A              | N/A             |                        | N/A                  |                        | 7.12.14.4              | F.10.11                    |
+| dadd             | N/A              | N/A             | |check|                | N/A                  | |check|                | 7.12.14.1              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
+| ddiv             | N/A              | N/A             | |check|                | N/A                  | |check|                | 7.12.14.4              | F.10.11                    |
++------------------+------------------+-----------------+------------------------+----------------------+- -----------------------+------------------------+----------------------------+
 | dfma             | N/A              | N/A             |                        | N/A                  |                        | 7.12.14.5              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | dmul             | N/A              | N/A             | |check|                | N/A                  | |check|\*              | 7.12.14.3              | F.10.11                    |
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index faeca417514ea..29a8ff5eef05d 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -118,7 +118,7 @@ def load_yaml_file(yaml_file, header_class, entry_points):
         HeaderFile: An instance of HeaderFile populated with the data.
     """
     with open(yaml_file, "r") as f:
-        yaml_data = yaml.load(f, loader=yaml.FullLoader)
+        yaml_data = yaml.load(f, Loader=yaml.FullLoader)
     return yaml_to_classes(yaml_data, header_class, entry_points)
 
 
diff --git a/libc/src/math/daddf128.h b/libc/src/math/daddf128.h
index dd3f4ce717039..2ad261d525337 100644
--- a/libc/src/math/daddf128.h
+++ b/libc/src/math/daddf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for daddf128 --------------------------*- C++ -*-===//
+//===-- Implementation header for daddf128 --------------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -9,6 +10,7 @@
 #ifndef LLVM_LIBC_SRC_MATH_DADDF128_H
 #define LLVM_LIBC_SRC_MATH_DADDF128_H
 
+#include "include/llvm-libc-types/float128.h"
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/ddivf128.h b/libc/src/math/ddivf128.h
index 43a544a9d45b1..a32d2349f8952 100644
--- a/libc/src/math/ddivf128.h
+++ b/libc/src/math/ddivf128.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_LIBC_SRC_MATH_DDIVF128_H
 #define LLVM_LIBC_SRC_MATH_DDIVF128_H
 
+#include "include/llvm-libc-types/float128.h"
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index f35f4ede42d0f..61aa76a331c84 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -138,7 +138,8 @@ add_entrypoint_object(
   COMPILE_OPTIONS
     -O3
   DEPENDS
-    libc.src.__support.FPUtil.generic.add_sub.h
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.generic.add_sub
 
 )
 
@@ -150,8 +151,9 @@ add_entrypoint_object(
     ../daddf128.h
   COMPILE_OPTIONS
     -O3
-  DEPENDS
-    libc.src.__support.FPUtil.generic.add_sub.h
+ DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.generic.add_sub
 )
 
 add_entrypoint_object(
@@ -163,7 +165,8 @@ add_entrypoint_object(
   COMPILE_OPTIONS
     -O3
   DEPENDS
-    libc.src.__support.FPUtil.generic.div.h
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.generic.div
 )
 
 add_entrypoint_object(
@@ -175,7 +178,7 @@ add_entrypoint_object(
   COMPILE_OPTIONS
     -O3
   DEPENDS
-    libc.src.__support.FPUtil.generic.div.h
+    libc.src.__support.FPUtil.generic.div
 )
 
 add_entrypoint_object(
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 536defb44138c..2613cf0448c68 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -4165,6 +4165,7 @@ add_fp_unittest(
     AddTest.h
   DEPENDS
     libc.src.math.daddl
+    libc.src.__support.FPUtil.generic.add_sub
 )
 
 add_fp_unittest(
@@ -4177,6 +4178,7 @@ add_fp_unittest(
     AddTest.h
   DEPENDS
     libc.src.math.daddf128
+    libc.src.__support.FPUtil.generic.add_sub
 )
 
 add_fp_unittest(
@@ -4189,6 +4191,7 @@ add_fp_unittest(
     DivTest.h
   DEPENDS
     libc.src.math.ddivl
+    libc.src.__support.FPUtil.generic.div
 )
 
 add_fp_unittest(
@@ -4201,4 +4204,5 @@ add_fp_unittest(
     DivTest.h
   DEPENDS
     libc.src.math.ddivf128
+    libc.src.__support.FPUtil.generic.div
 )

>From 7a6a4f9a9f392ec8ede3cdeed4d2231c77379169 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 24 Jul 2024 20:19:12 +0000
Subject: [PATCH 06/14] removed duplicate entrypoints

---
 libc/config/darwin/arm/entrypoints.txt    |  6 +-----
 libc/config/darwin/x86_64/entrypoints.txt | 12 ++++--------
 libc/config/linux/arm/entrypoints.txt     |  6 +-----
 libc/config/linux/riscv/entrypoints.txt   |  8 ++------
 libc/docs/math/index.rst                  |  2 +-
 5 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/libc/config/darwin/arm/entrypoints.txt b/libc/config/darwin/arm/entrypoints.txt
index 6c5e86f7dcafc..3a53848d1aa3b 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -135,13 +135,9 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cos
     libc.src.math.cosf
     libc.src.math.cospif
+    libc.src.math.dsqrtl
     libc.src.math.daddl
     libc.src.math.daddf128
-    libc.src.math.dsqrtl
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.ddivl
     libc.src.math.ddivf128
     libc.src.math.erff
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 6e461c4828d42..8a0225e503e4e 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -119,15 +119,11 @@ set(TARGET_LIBM_ENTRYPOINTS
     #libc.src.math.ceill
     #libc.src.math.coshf
     #libc.src.math.cosf
-    libc.src.math.daddl
-    libc.src.math.daddf128
+    #libc.src.math.daddl
+    #libc.src.math.daddf128
+    #libc.src.math.ddivl
+    #libc.src.math.ddivf128
     #libc.src.math.dsqrtl
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
     #libc.src.math.expf
     #libc.src.math.exp2f
     #libc.src.math.expm1f
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 13992055d7074..6dba4b0b10df1 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -229,13 +229,9 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.coshf
     libc.src.math.daddl
     libc.src.math.daddf128
-    libc.src.math.dsqrtl
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.ddivl
     libc.src.math.ddivf128
+    libc.src.math.dsqrtl
     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 bc142e7d46523..1aa509c3bfc28 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -383,14 +383,10 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cospif
     libc.src.math.daddl
     libc.src.math.daddf128
-    libc.src.math.dmull
-    libc.src.math.dsqrtl
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.ddivl
     libc.src.math.ddivf128
+    libc.src.math.dmull
+    libc.src.math.dsqrtl
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index f8b18e11c8aac..f277bb05bf0d9 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -136,7 +136,7 @@ Basic Operations
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | fabs             | |check|          | |check|         | |check|                | |check|              | |check|                | 7.12.7.3               | F.10.4.3                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| fadd             | N/A              |                 |                        | N/A                  |                        | 7.12.14.1              | F.10.11                    |
+| fadd             | N/A              | |check|                                 | N/A                  |                        | 7.12.14.1              | F.10.11                     |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | fdim             | |check|          | |check|         | |check|                | |check|              | |check|                | 7.12.12.1              | F.10.9.1                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+

>From dac176eb1c66f46c1d03f183681cfbab264f7f10 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 24 Jul 2024 20:20:19 +0000
Subject: [PATCH 07/14] set option to off

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

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 45cca17562d26..6e0760724d963 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -73,7 +73,7 @@ if(LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
   add_subdirectory(utils/gpu)
 endif()
 
-option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" ON)
+option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" OFF)
 
 set(NEED_LIBC_HDRGEN FALSE)
 if(NOT LLVM_RUNTIMES_BUILD)

>From 6439c71c991564ffea140bdc58d32248cd866ef7 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 24 Jul 2024 22:03:30 +0000
Subject: [PATCH 08/14] fixed nits and entrypoint errors

---
 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/windows/entrypoints.txt         | 2 --
 libc/docs/math/index.rst                    | 6 +++---
 libc/spec/llvm_libc_ext.td                  | 2 ++
 libc/spec/stdc.td                           | 4 +---
 libc/src/math/daddf128.h                    | 5 ++---
 libc/src/math/daddl.h                       | 3 +--
 libc/src/math/ddivf128.h                    | 2 +-
 libc/src/math/fadd.h                        | 3 ++-
 libc/src/math/generic/CMakeLists.txt        | 2 +-
 libc/src/math/generic/daddf128.cpp          | 3 +--
 libc/src/math/generic/daddl.cpp             | 2 +-
 libc/src/math/generic/ddivf128.cpp          | 3 +--
 libc/src/math/generic/ddivl.cpp             | 2 +-
 libc/test/src/math/daddf128_test.cpp        | 2 +-
 libc/test/src/math/daddl_test.cpp           | 2 +-
 libc/test/src/math/ddivl_test.cpp           | 2 +-
 libc/test/src/math/smoke/CMakeLists.txt     | 4 ----
 libc/test/src/math/smoke/daddf128_test.cpp  | 2 +-
 libc/test/src/math/smoke/daddl_test.cpp     | 2 +-
 24 files changed, 24 insertions(+), 43 deletions(-)

diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index d9ba57ef0b9c5..7c14bd0558624 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -248,9 +248,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.daddl
-    libc.src.math.daddf128
     libc.src.math.ddivl
-    libc.src.math.ddivf128
     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 d1a54dc24e385..94f33077b5dfb 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -244,9 +244,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.daddl
-    libc.src.math.daddf128
     libc.src.math.ddivl
-    libc.src.math.ddivf128
     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 3a53848d1aa3b..a60a2d1b1d4f6 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -137,9 +137,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cospif
     libc.src.math.dsqrtl
     libc.src.math.daddl
-    libc.src.math.daddf128
     libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 8c3dfa47cb2c1..506c7d6d7b314 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -254,10 +254,6 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.cosh
     libc.src.math.coshf
-    libc.src.math.daddl
-    libc.src.math.daddf128
-    libc.src.math.ddivl
-    libc.src.math.ddivf128
     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 f0d6981bca02a..e6695ba0dcafe 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -359,9 +359,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.coshf
     libc.src.math.cospif
     libc.src.math.daddl
-    libc.src.math.daddf128
     libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.erff
@@ -603,6 +601,8 @@ if(LIBC_TYPES_HAS_FLOAT128)
     # math.h C23 _Float128 entrypoints
     libc.src.math.ceilf128
     libc.src.math.copysignf128
+    libc.src.math.daddf128
+    libc.src.math.ddivf128
     libc.src.math.dsqrtf128
     libc.src.math.fabsf128
     libc.src.math.fdimf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 72b665cdf3932..e873caae04341 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -133,9 +133,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.daddl
-    libc.src.math.daddf128
     libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.expf
diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index f277bb05bf0d9..688ed8bfe9977 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -114,10 +114,10 @@ Basic Operations
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | copysign         | |check|          | |check|         | |check|                | |check|              | |check|                | 7.12.11.1              | F.10.8.1                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| dadd             | N/A              | N/A             | |check|                | N/A                  | |check|                | 7.12.14.1              | F.10.11                    |
+| dadd             | N/A              | N/A             | |check|                | N/A                  | |check|\*              | 7.12.14.1              | F.10.11                    |
++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
+| ddiv             | N/A              | N/A             | |check|                | N/A                  | |check|\*              | 7.12.14.4              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| ddiv             | N/A              | N/A             | |check|                | N/A                  | |check|                | 7.12.14.4              | F.10.11                    |
-+------------------+------------------+-----------------+------------------------+----------------------+- -----------------------+------------------------+----------------------------+
 | dfma             | N/A              | N/A             |                        | N/A                  |                        | 7.12.14.5              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | dmul             | N/A              | N/A             | |check|                | N/A                  | |check|\*              | 7.12.14.3              | F.10.11                    |
diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td
index f3a8862574ac5..a957f45efd05f 100644
--- a/libc/spec/llvm_libc_ext.td
+++ b/libc/spec/llvm_libc_ext.td
@@ -57,6 +57,8 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
       [], // Types
       [], // Enumerations
       [
+          GuardedFunctionSpec<"daddf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+          GuardedFunctionSpec<"ddivf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
           GuardedFunctionSpec<"dsqrtf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
 	  
           GuardedFunctionSpec<"f16add", RetValSpec<Float16Type>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 55ec2f96ecdf5..8cce24c1b44dd 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -396,11 +396,9 @@ def StdC : StandardSpec<"stdc"> {
           FunctionSpec<"ceill", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
           GuardedFunctionSpec<"ceilf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
           GuardedFunctionSpec<"ceilf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
-          FunctionSpec<"daddf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
+          
           FunctionSpec<"daddl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
           FunctionSpec<"ddivl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-          FunctionSpec<"ddivf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
 
           FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>], [ConstAttr]>,
           FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
diff --git a/libc/src/math/daddf128.h b/libc/src/math/daddf128.h
index 2ad261d525337..cf6c1999d9d03 100644
--- a/libc/src/math/daddf128.h
+++ b/libc/src/math/daddf128.h
@@ -1,5 +1,4 @@
-//===-- Implementation header for daddf128 --------------------------*- C++
-//-*-===//
+//===-- Implementation header for daddf128 ----------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -10,8 +9,8 @@
 #ifndef LLVM_LIBC_SRC_MATH_DADDF128_H
 #define LLVM_LIBC_SRC_MATH_DADDF128_H
 
-#include "include/llvm-libc-types/float128.h"
 #include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/math/daddl.h b/libc/src/math/daddl.h
index 1b3bdeeb04894..aeb299d74c0a1 100644
--- a/libc/src/math/daddl.h
+++ b/libc/src/math/daddl.h
@@ -1,5 +1,4 @@
-//===-- Implementation header for daddl --------------------------*- C++
-//-*-===//
+//===-- Implementation header for daddl ------------------------*- 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/ddivf128.h b/libc/src/math/ddivf128.h
index a32d2349f8952..f7a5ef07cb5fe 100644
--- a/libc/src/math/ddivf128.h
+++ b/libc/src/math/ddivf128.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_LIBC_SRC_MATH_DDIVF128_H
 #define LLVM_LIBC_SRC_MATH_DDIVF128_H
 
-#include "include/llvm-libc-types/float128.h"
 #include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/math/fadd.h b/libc/src/math/fadd.h
index 1186f1ef40954..ec3ce18bb676a 100644
--- a/libc/src/math/fadd.h
+++ b/libc/src/math/fadd.h
@@ -6,10 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "src/__support/macros/config.h"
+
 #ifndef LLVM_LIBC_SRC_MATH_FADD_H
 #define LLVM_LIBC_SRC_MATH_FADD_H
 
-#include "src/__support/macros/config.h"
 namespace LIBC_NAMESPACE_DECL {
 
 float fadd(double x, double y);
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 61aa76a331c84..c418e259a6265 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -544,7 +544,7 @@ add_entrypoint_object(
   HDRS
     ../fadd.h
   DEPENDS
-    libc.src.__support.FPUtil.generic.add_sub
+    libc.src.__support.FPUtil.basic_operations
   COMPILE_OPTIONS
     -O3
 )
diff --git a/libc/src/math/generic/daddf128.cpp b/libc/src/math/generic/daddf128.cpp
index b967689ec9e81..c67f4fdcb0fc3 100644
--- a/libc/src/math/generic/daddf128.cpp
+++ b/libc/src/math/generic/daddf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of daddf128 function
-//---------------------------------===//
+//===-- Implementation of daddf128 function -------------------------------===//
 //
 // 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/daddl.cpp b/libc/src/math/generic/daddl.cpp
index 2ae1add239162..708de3833869c 100644
--- a/libc/src/math/generic/daddl.cpp
+++ b/libc/src/math/generic/daddl.cpp
@@ -1,4 +1,4 @@
-//===-- Implementation of daddl function ---------------------------------===//
+//===-- Implementation of daddl function ----------------------------------===//
 //
 // 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/ddivf128.cpp b/libc/src/math/generic/ddivf128.cpp
index 4d134be3cc052..70c936f4858a9 100644
--- a/libc/src/math/generic/ddivf128.cpp
+++ b/libc/src/math/generic/ddivf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of ddivf128 function
-//---------------------------------===//
+//===-- Implementation of ddivf128 function--------------------------------===//
 //
 // 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/ddivl.cpp b/libc/src/math/generic/ddivl.cpp
index 64f3f5b4392bc..18fc44d6f1648 100644
--- a/libc/src/math/generic/ddivl.cpp
+++ b/libc/src/math/generic/ddivl.cpp
@@ -1,4 +1,4 @@
-//===-- Implementation of ddivl function ---------------------------------===//
+//===-- Implementation of ddivl function ----------------------------------===//
 //
 // 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/test/src/math/daddf128_test.cpp b/libc/test/src/math/daddf128_test.cpp
index a4d0341ba6512..ca0bbffe73451 100644
--- a/libc/test/src/math/daddf128_test.cpp
+++ b/libc/test/src/math/daddf128_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for daddf128 ----------------------------------------------===//
+//===-- Unittests for daddf128 --------------------------------------------===//
 //
 // 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/test/src/math/daddl_test.cpp b/libc/test/src/math/daddl_test.cpp
index 42002e5e33266..7a34d962d5207 100644
--- a/libc/test/src/math/daddl_test.cpp
+++ b/libc/test/src/math/daddl_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for daddl ----------------------------------------------===//
+//===-- Unittests for daddl -----------------------------------------------===//
 //
 // 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/test/src/math/ddivl_test.cpp b/libc/test/src/math/ddivl_test.cpp
index d3c638ddd4543..1d0aca5f573b6 100644
--- a/libc/test/src/math/ddivl_test.cpp
+++ b/libc/test/src/math/ddivl_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for ddivl ----------------------------------------------===//
+//===-- Unittests for ddivl -----------------------------------------------===//
 //
 // 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/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 2613cf0448c68..536defb44138c 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -4165,7 +4165,6 @@ add_fp_unittest(
     AddTest.h
   DEPENDS
     libc.src.math.daddl
-    libc.src.__support.FPUtil.generic.add_sub
 )
 
 add_fp_unittest(
@@ -4178,7 +4177,6 @@ add_fp_unittest(
     AddTest.h
   DEPENDS
     libc.src.math.daddf128
-    libc.src.__support.FPUtil.generic.add_sub
 )
 
 add_fp_unittest(
@@ -4191,7 +4189,6 @@ add_fp_unittest(
     DivTest.h
   DEPENDS
     libc.src.math.ddivl
-    libc.src.__support.FPUtil.generic.div
 )
 
 add_fp_unittest(
@@ -4204,5 +4201,4 @@ add_fp_unittest(
     DivTest.h
   DEPENDS
     libc.src.math.ddivf128
-    libc.src.__support.FPUtil.generic.div
 )
diff --git a/libc/test/src/math/smoke/daddf128_test.cpp b/libc/test/src/math/smoke/daddf128_test.cpp
index a4d0341ba6512..ca0bbffe73451 100644
--- a/libc/test/src/math/smoke/daddf128_test.cpp
+++ b/libc/test/src/math/smoke/daddf128_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for daddf128 ----------------------------------------------===//
+//===-- Unittests for daddf128 --------------------------------------------===//
 //
 // 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/test/src/math/smoke/daddl_test.cpp b/libc/test/src/math/smoke/daddl_test.cpp
index 42002e5e33266..7a34d962d5207 100644
--- a/libc/test/src/math/smoke/daddl_test.cpp
+++ b/libc/test/src/math/smoke/daddl_test.cpp
@@ -1,4 +1,4 @@
-//===-- Unittests for daddl ----------------------------------------------===//
+//===-- Unittests for daddl -----------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

>From 678b1b454c5fcc9213309603b6db772bc19211f7 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 24 Jul 2024 22:40:06 +0000
Subject: [PATCH 09/14] addressed comments

---
 libc/config/darwin/x86_64/entrypoints.txt | 2 --
 libc/config/linux/arm/entrypoints.txt     | 2 --
 libc/config/linux/riscv/entrypoints.txt   | 2 --
 libc/src/math/daddl.h                     | 2 +-
 libc/src/math/generic/CMakeLists.txt      | 3 ---
 libc/src/math/generic/daddf128.cpp        | 1 -
 libc/src/math/generic/ddivf128.cpp        | 1 -
 libc/test/src/math/CMakeLists.txt         | 1 -
 8 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 8a0225e503e4e..1466fe6dffbae 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -120,9 +120,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     #libc.src.math.coshf
     #libc.src.math.cosf
     #libc.src.math.daddl
-    #libc.src.math.daddf128
     #libc.src.math.ddivl
-    #libc.src.math.ddivf128
     #libc.src.math.dsqrtl
     #libc.src.math.expf
     #libc.src.math.exp2f
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 6dba4b0b10df1..6f84eba7ef22a 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -228,9 +228,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.cosf
     libc.src.math.coshf
     libc.src.math.daddl
-    libc.src.math.daddf128
     libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.dsqrtl
     libc.src.math.erff
     libc.src.math.exp
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 1aa509c3bfc28..acaf7408a137b 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -382,9 +382,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.coshf
     libc.src.math.cospif
     libc.src.math.daddl
-    libc.src.math.daddf128
     libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.erff
diff --git a/libc/src/math/daddl.h b/libc/src/math/daddl.h
index aeb299d74c0a1..8dc5d4d8d4b69 100644
--- a/libc/src/math/daddl.h
+++ b/libc/src/math/daddl.h
@@ -1,4 +1,4 @@
-//===-- Implementation header for daddl ------------------------*- C++//-*-===//
+//===-- Implementation header for daddl -------------------------*- 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/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index c418e259a6265..aebf389d66d80 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -138,9 +138,7 @@ add_entrypoint_object(
   COMPILE_OPTIONS
     -O3
   DEPENDS
-    libc.src.__support.macros.properties.types
     libc.src.__support.FPUtil.generic.add_sub
-
 )
 
 add_entrypoint_object(
@@ -165,7 +163,6 @@ add_entrypoint_object(
   COMPILE_OPTIONS
     -O3
   DEPENDS
-    libc.src.__support.macros.properties.types
     libc.src.__support.FPUtil.generic.div
 )
 
diff --git a/libc/src/math/generic/daddf128.cpp b/libc/src/math/generic/daddf128.cpp
index c67f4fdcb0fc3..6edba3b8f5e43 100644
--- a/libc/src/math/generic/daddf128.cpp
+++ b/libc/src/math/generic/daddf128.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/daddf128.h"
-#include "include/llvm-libc-types/float128.h"
 #include "src/__support/FPUtil/generic/add_sub.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
diff --git a/libc/src/math/generic/ddivf128.cpp b/libc/src/math/generic/ddivf128.cpp
index 70c936f4858a9..1ce4fd66b42cb 100644
--- a/libc/src/math/generic/ddivf128.cpp
+++ b/libc/src/math/generic/ddivf128.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/math/ddivf128.h"
-#include "include/llvm-libc-types/float128.h"
 #include "src/__support/FPUtil/generic/div.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 24c2ac78e7e46..e4703f79660b0 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -56,7 +56,6 @@ add_fp_unittest(
     AddTest.h
   DEPENDS
     libc.src.math.daddl
-    libc.src.__support.FPUtil.generic.add_sub
 )
 
 add_fp_unittest(

>From deb4a9d07909e57339391d7e4b283a57298edb73 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 29 Jul 2024 19:39:22 +0000
Subject: [PATCH 10/14] fixed entrypoints errors

---
 libc/config/baremetal/arm/entrypoints.txt | 2 --
 libc/config/linux/x86_64/entrypoints.txt  | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 7c14bd0558624..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.daddl
-    libc.src.math.ddivl
     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 b54cb94e1b912..9dbd204b1a2a2 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -386,9 +386,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.dmull
     libc.src.math.dsqrtl
     libc.src.math.daddl
-    libc.src.math.daddf128
     libc.src.math.ddivl
-    libc.src.math.ddivf128
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
@@ -652,6 +650,8 @@ if(LIBC_TYPES_HAS_FLOAT128)
     libc.src.math.canonicalizef128
     libc.src.math.ceilf128
     libc.src.math.copysignf128
+    libc.src.math.daddf128
+    libc.src.math.ddivf128
     libc.src.math.dmulf128
     libc.src.math.dsqrtf128
     libc.src.math.fabsf128

>From 2515dba1bdcafc773964d50dca1f080b0ae686aa Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 29 Jul 2024 20:31:16 +0000
Subject: [PATCH 11/14] deleted newline in newhdrgen

---
 libc/newhdrgen/yaml_to_classes.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index 29a8ff5eef05d..d3bdfde2e2a22 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -174,7 +174,6 @@ def add_function_to_yaml(yaml_file, function_details):
 
     with open(yaml_file, "r") as f:
         yaml_data = yaml.load(f, Loader=yaml.FullLoader)
-
     if "functions" not in yaml_data:
         yaml_data["functions"] = []
 

>From 38af4ea4d932a1d50e23e97f2ba597d9ab305965 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 29 Jul 2024 20:38:56 +0000
Subject: [PATCH 12/14] removed fadd changes and updated tests

---
 libc/docs/math/index.rst             | 2 +-
 libc/src/math/generic/CMakeLists.txt | 1 +
 libc/test/src/math/CMakeLists.txt    | 2 --
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index 23d8d4ff169f3..9e1555e17ff8b 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -136,7 +136,7 @@ Basic Operations
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | fabs             | |check|          | |check|         | |check|                | |check|              | |check|                | 7.12.7.3               | F.10.4.3                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| fadd             | N/A              | |check|                                 | N/A                  |                        | 7.12.14.1              | F.10.11                     |
+| fadd             | N/A              | |check|         | |check|                | N/A                  | |check|                | 7.12.14.1              | F.10.11                    |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
 | fdim             | |check|          | |check|         | |check|                | |check|              | |check|                | 7.12.12.1              | F.10.9.1                   |
 +------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 8840ae5739b70..40331a4648bc2 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -175,6 +175,7 @@ add_entrypoint_object(
   COMPILE_OPTIONS
     -O3
   DEPENDS
+    libc.src.__support.macros.properties.types
     libc.src.__support.FPUtil.generic.div
 )
 
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index fac77826f745f..486be0e85adb9 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -69,7 +69,6 @@ add_fp_unittest(
     AddTest.h
   DEPENDS
     libc.src.math.daddf128
-    libc.src.__support.FPUtil.generic.add_sub
 )
 
 add_fp_unittest(
@@ -82,7 +81,6 @@ add_fp_unittest(
   HDRS
     DivTest.h
   DEPENDS
-    libc.src.__support.FPUtil.generic.div
     libc.src.math.ddivf128
 )
 

>From f33abc5474f723710f0865667c65494de33d3be0 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 29 Jul 2024 20:55:08 +0000
Subject: [PATCH 13/14] fixed duplicate tests

---
 libc/test/src/math/CMakeLists.txt | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 486be0e85adb9..acd9b0a49cba4 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -59,29 +59,29 @@ add_fp_unittest(
 )
 
 add_fp_unittest(
-  daddf128_test
+  ddivl_test
   NEED_MPFR
   SUITE
     libc-math-unittests
   SRCS
-    daddf128_test.cpp
+    ddivl_test.cpp
   HDRS
     AddTest.h
   DEPENDS
-    libc.src.math.daddf128
+    libc.src.math.ddivl
 )
 
 add_fp_unittest(
-  ddivf128_test
+  daddf128_test
   NEED_MPFR
   SUITE
     libc-math-unittests
   SRCS
-    ddivf128_test.cpp
+    daddf128_test.cpp
   HDRS
-    DivTest.h
+    AddTest.h
   DEPENDS
-    libc.src.math.ddivf128
+    libc.src.math.daddf128
 )
 
 add_fp_unittest(
@@ -94,7 +94,6 @@ add_fp_unittest(
   HDRS
     DivTest.h
   DEPENDS
-    libc.src.__support.FPUtil.generic.div
     libc.src.math.ddivf128
 )
 

>From abbde4ed2097b825f8a5af3975026c159d408e08 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Tue, 30 Jul 2024 17:24:17 +0000
Subject: [PATCH 14/14] removed float128 tests and removed entrypoints

---
 libc/config/baremetal/riscv/entrypoints.txt |  2 --
 libc/test/src/math/CMakeLists.txt           | 26 ---------------------
 libc/test/src/math/daddf128_test.cpp        | 13 -----------
 libc/test/src/math/ddivf128_test.cpp        | 13 -----------
 4 files changed, 54 deletions(-)
 delete mode 100644 libc/test/src/math/daddf128_test.cpp
 delete mode 100644 libc/test/src/math/ddivf128_test.cpp

diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 94f33077b5dfb..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.daddl
-    libc.src.math.ddivl
     libc.src.math.erff
     libc.src.math.exp
     libc.src.math.exp10
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index acd9b0a49cba4..93d373e24c00e 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -71,32 +71,6 @@ add_fp_unittest(
     libc.src.math.ddivl
 )
 
-add_fp_unittest(
-  daddf128_test
-  NEED_MPFR
-  SUITE
-    libc-math-unittests
-  SRCS
-    daddf128_test.cpp
-  HDRS
-    AddTest.h
-  DEPENDS
-    libc.src.math.daddf128
-)
-
-add_fp_unittest(
-  ddivf128_test
-  NEED_MPFR
-  SUITE
-    libc-math-unittests
-  SRCS
-    ddivf128_test.cpp
-  HDRS
-    DivTest.h
-  DEPENDS
-    libc.src.math.ddivf128
-)
-
 add_fp_unittest(
   sinf_test
   NEED_MPFR
diff --git a/libc/test/src/math/daddf128_test.cpp b/libc/test/src/math/daddf128_test.cpp
deleted file mode 100644
index ca0bbffe73451..0000000000000
--- a/libc/test/src/math/daddf128_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for daddf128 --------------------------------------------===//
-//
-// 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 "AddTest.h"
-
-#include "src/math/daddf128.h"
-
-LIST_ADD_TESTS(double, float128, LIBC_NAMESPACE::daddf128)
diff --git a/libc/test/src/math/ddivf128_test.cpp b/libc/test/src/math/ddivf128_test.cpp
deleted file mode 100644
index ea1834a87baac..0000000000000
--- a/libc/test/src/math/ddivf128_test.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-//===-- Unittests for ddivf128 --------------------------------------------===//
-//
-// 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 "DivTest.h"
-
-#include "src/math/ddivf128.h"
-
-LIST_ADD_TESTS(double, float128, LIBC_NAMESPACE::ddivf128)



More information about the libc-commits mailing list