[libc-commits] [libc] [libc][math][c23] add c23 floating point fmaximum and fminimum functions. (PR #86016)

Job Henandez Lara via libc-commits libc-commits at lists.llvm.org
Sun Mar 24 09:57:19 PDT 2024


https://github.com/Jobhdez updated https://github.com/llvm/llvm-project/pull/86016

>From 1c6e19c3394e39b9d45ff9681354a6bfc3d1b5f3 Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Wed, 20 Mar 2024 14:38:14 -0700
Subject: [PATCH 1/9] [libc][math][c23] add c23 floating point fmaximum and
 fminimum fns

---
 libc/config/linux/aarch64/entrypoints.txt     |  24 +
 libc/config/linux/arm/entrypoints.txt         |  24 +
 libc/config/linux/riscv/entrypoints.txt       |  24 +
 libc/config/linux/x86_64/entrypoints.txt      |  24 +
 libc/config/windows/entrypoints.txt           |  26 +-
 libc/spec/stdc.td                             |  40 ++
 libc/src/__support/FPUtil/BasicOperations.h   | 124 ++++++
 libc/src/math/CMakeLists.txt                  |  40 ++
 libc/src/math/amdgpu/fmaximum.cpp             |  21 +
 libc/src/math/amdgpu/fmaximum_mag.cpp         |  21 +
 libc/src/math/amdgpu/fmaximum_mag_num.cpp     |  21 +
 libc/src/math/amdgpu/fmaximum_mag_numf.cpp    |  21 +
 libc/src/math/amdgpu/fmaximum_mag_numl.cpp    |  21 +
 libc/src/math/amdgpu/fmaximum_magf.cpp        |  21 +
 libc/src/math/amdgpu/fmaximum_magl.cpp        |  21 +
 libc/src/math/amdgpu/fmaximum_num.cpp         |  21 +
 libc/src/math/amdgpu/fmaximum_numf.cpp        |  21 +
 libc/src/math/amdgpu/fmaximum_numl.cpp        |  21 +
 libc/src/math/amdgpu/fmaximumf.cpp            |  19 +
 libc/src/math/amdgpu/fmaximuml.cpp            |  19 +
 libc/src/math/amdgpu/fminimum.cpp             |  21 +
 libc/src/math/amdgpu/fminimum_mag.cpp         |  21 +
 libc/src/math/amdgpu/fminimum_mag_num.cpp     |  21 +
 libc/src/math/amdgpu/fminimum_mag_numf.cpp    |  21 +
 libc/src/math/amdgpu/fminimum_mag_numl.cpp    |  21 +
 libc/src/math/amdgpu/fminimum_magf.cpp        |  21 +
 libc/src/math/amdgpu/fminimum_magl.cpp        |  21 +
 libc/src/math/amdgpu/fminimum_num.cpp         |  21 +
 libc/src/math/amdgpu/fminimum_numf.cpp        |  21 +
 libc/src/math/amdgpu/fminimum_numl.cpp        |  21 +
 libc/src/math/amdgpu/fminimumf.cpp            |  19 +
 libc/src/math/amdgpu/fminimuml.cpp            |  19 +
 libc/src/math/fmaximum.h                      |  18 +
 libc/src/math/fmaximum_mag.h                  |  18 +
 libc/src/math/fmaximum_mag_num.h              |  18 +
 libc/src/math/fmaximum_mag_numf.h             |  18 +
 libc/src/math/fmaximum_mag_numf128.h          |  20 +
 libc/src/math/fmaximum_mag_numl.h             |  18 +
 libc/src/math/fmaximum_magf.h                 |  18 +
 libc/src/math/fmaximum_magf128.h              |  20 +
 libc/src/math/fmaximum_magl.h                 |  18 +
 libc/src/math/fmaximum_num.h                  |  18 +
 libc/src/math/fmaximum_numf.h                 |  18 +
 libc/src/math/fmaximum_numf128.h              |  20 +
 libc/src/math/fmaximum_numl.h                 |  18 +
 libc/src/math/fmaximumf.h                     |  18 +
 libc/src/math/fmaximumf128.h                  |  20 +
 libc/src/math/fmaximuml.h                     |  18 +
 libc/src/math/fminimum.h                      |  18 +
 libc/src/math/fminimum_mag.h                  |  18 +
 libc/src/math/fminimum_mag_num.h              |  18 +
 libc/src/math/fminimum_mag_numf.h             |  18 +
 libc/src/math/fminimum_mag_numf128.h          |  20 +
 libc/src/math/fminimum_mag_numl.h             |  18 +
 libc/src/math/fminimum_magf.h                 |  18 +
 libc/src/math/fminimum_magf128.h              |  20 +
 libc/src/math/fminimum_magl.h                 |  18 +
 libc/src/math/fminimum_num.h                  |  18 +
 libc/src/math/fminimum_numf.h                 |  18 +
 libc/src/math/fminimum_numf128.h              |  20 +
 libc/src/math/fminimum_numl.h                 |  18 +
 libc/src/math/fminimumf.h                     |  18 +
 libc/src/math/fminimumf128.h                  |  20 +
 libc/src/math/fminimuml.h                     |  18 +
 libc/src/math/generic/CMakeLists.txt          | 395 +++++++++++++++++
 libc/src/math/generic/fmaximum.cpp            |  19 +
 libc/src/math/generic/fmaximum_mag.cpp        |  19 +
 libc/src/math/generic/fmaximum_mag_num.cpp    |  19 +
 libc/src/math/generic/fmaximum_mag_numf.cpp   |  19 +
 .../src/math/generic/fmaximum_mag_numf128.cpp |  19 +
 libc/src/math/generic/fmaximum_mag_numl.cpp   |  20 +
 libc/src/math/generic/fmaximum_magf.cpp       |  19 +
 libc/src/math/generic/fmaximum_magf128.cpp    |  19 +
 libc/src/math/generic/fmaximum_magl.cpp       |  20 +
 libc/src/math/generic/fmaximum_num.cpp        |  19 +
 libc/src/math/generic/fmaximum_numf.cpp       |  19 +
 libc/src/math/generic/fmaximum_numf128.cpp    |  19 +
 libc/src/math/generic/fmaximum_numl.cpp       |  20 +
 libc/src/math/generic/fmaximumf.cpp           |  19 +
 libc/src/math/generic/fmaximumf128.cpp        |  19 +
 libc/src/math/generic/fmaximuml.cpp           |  20 +
 libc/src/math/generic/fminimum.cpp            |  19 +
 libc/src/math/generic/fminimum_mag.cpp        |  19 +
 libc/src/math/generic/fminimum_mag_num.cpp    |  19 +
 libc/src/math/generic/fminimum_mag_numf.cpp   |  19 +
 .../src/math/generic/fminimum_mag_numf128.cpp |  19 +
 libc/src/math/generic/fminimum_mag_numl.cpp   |  20 +
 libc/src/math/generic/fminimum_magf.cpp       |  19 +
 libc/src/math/generic/fminimum_magf128.cpp    |  19 +
 libc/src/math/generic/fminimum_magl.cpp       |  20 +
 libc/src/math/generic/fminimum_num.cpp        |  19 +
 libc/src/math/generic/fminimum_numf.cpp       |  19 +
 libc/src/math/generic/fminimum_numf128.cpp    |  19 +
 libc/src/math/generic/fminimum_numl.cpp       |  20 +
 libc/src/math/generic/fminimumf.cpp           |  19 +
 libc/src/math/generic/fminimumf128.cpp        |  19 +
 libc/src/math/generic/fminimuml.cpp           |  20 +
 libc/src/math/nvptx/fmaximum.cpp              |  19 +
 libc/src/math/nvptx/fmaximumf.cpp             |  21 +
 libc/test/src/math/smoke/CMakeLists.txt       | 418 ++++++++++++++++++
 libc/test/src/math/smoke/FMaxTest.h           |   2 +-
 libc/test/src/math/smoke/FMaximumMagNumTest.h |  88 ++++
 libc/test/src/math/smoke/FMaximumMagTest.h    |  88 ++++
 libc/test/src/math/smoke/FMaximumNumTest.h    |  87 ++++
 libc/test/src/math/smoke/FMaximumTest.h       |  87 ++++
 libc/test/src/math/smoke/FMinimumMagNumTest.h |  88 ++++
 libc/test/src/math/smoke/FMinimumMagTest.h    |  88 ++++
 libc/test/src/math/smoke/FMinimumNumTest.h    |  87 ++++
 libc/test/src/math/smoke/FMinimumTest.h       |  87 ++++
 .../src/math/smoke/fmaximum_mag_num_test.cpp  |  13 +
 .../math/smoke/fmaximum_mag_numf128_test.cpp  |  13 +
 .../src/math/smoke/fmaximum_mag_numf_test.cpp |  13 +
 .../src/math/smoke/fmaximum_mag_numl_test.cpp |  13 +
 .../test/src/math/smoke/fmaximum_mag_test.cpp |  13 +
 .../src/math/smoke/fmaximum_magf128_test.cpp  |  13 +
 .../src/math/smoke/fmaximum_magf_test.cpp     |  13 +
 .../src/math/smoke/fmaximum_magl_test.cpp     |  13 +
 .../test/src/math/smoke/fmaximum_num_test.cpp |  13 +
 .../src/math/smoke/fmaximum_numf128_test.cpp  |  13 +
 .../src/math/smoke/fmaximum_numf_test.cpp     |  13 +
 .../src/math/smoke/fmaximum_numl_test.cpp     |  13 +
 libc/test/src/math/smoke/fmaximum_test.cpp    |  13 +
 .../test/src/math/smoke/fmaximumf128_test.cpp |  13 +
 libc/test/src/math/smoke/fmaximumf_test.cpp   |  13 +
 libc/test/src/math/smoke/fmaximuml_test.cpp   |  13 +
 .../src/math/smoke/fminimum_mag_num_test.cpp  |  13 +
 .../src/math/smoke/fminimum_mag_numf128.cpp   |  13 +
 .../src/math/smoke/fminimum_mag_numf_test.cpp |  13 +
 .../src/math/smoke/fminimum_mag_numl_test.cpp |  13 +
 .../test/src/math/smoke/fminimum_mag_test.cpp |  13 +
 .../src/math/smoke/fminimum_magf128_test.cpp  |  13 +
 .../src/math/smoke/fminimum_magf_test.cpp     |  13 +
 .../src/math/smoke/fminimum_magl_test.cpp     |  13 +
 .../test/src/math/smoke/fminimum_num_test.cpp |  13 +
 .../src/math/smoke/fminimum_numf128_test.cpp  |  13 +
 .../src/math/smoke/fminimum_numf_test.cpp     |  13 +
 .../src/math/smoke/fminimum_numl_test.cpp     |  13 +
 libc/test/src/math/smoke/fminimum_test.cpp    |  13 +
 .../test/src/math/smoke/fminimumf128_test.cpp |  13 +
 libc/test/src/math/smoke/fminimumf_test.cpp   |  13 +
 libc/test/src/math/smoke/fminimuml_test.cpp   |  13 +
 141 files changed, 3999 insertions(+), 2 deletions(-)
 create mode 100644 libc/src/math/amdgpu/fmaximum.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_mag.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_mag_num.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_mag_numf.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_mag_numl.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_magf.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_magl.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_num.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_numf.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximum_numl.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximumf.cpp
 create mode 100644 libc/src/math/amdgpu/fmaximuml.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_mag.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_mag_num.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_mag_numf.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_mag_numl.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_magf.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_magl.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_num.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_numf.cpp
 create mode 100644 libc/src/math/amdgpu/fminimum_numl.cpp
 create mode 100644 libc/src/math/amdgpu/fminimumf.cpp
 create mode 100644 libc/src/math/amdgpu/fminimuml.cpp
 create mode 100644 libc/src/math/fmaximum.h
 create mode 100644 libc/src/math/fmaximum_mag.h
 create mode 100644 libc/src/math/fmaximum_mag_num.h
 create mode 100644 libc/src/math/fmaximum_mag_numf.h
 create mode 100644 libc/src/math/fmaximum_mag_numf128.h
 create mode 100644 libc/src/math/fmaximum_mag_numl.h
 create mode 100644 libc/src/math/fmaximum_magf.h
 create mode 100644 libc/src/math/fmaximum_magf128.h
 create mode 100644 libc/src/math/fmaximum_magl.h
 create mode 100644 libc/src/math/fmaximum_num.h
 create mode 100644 libc/src/math/fmaximum_numf.h
 create mode 100644 libc/src/math/fmaximum_numf128.h
 create mode 100644 libc/src/math/fmaximum_numl.h
 create mode 100644 libc/src/math/fmaximumf.h
 create mode 100644 libc/src/math/fmaximumf128.h
 create mode 100644 libc/src/math/fmaximuml.h
 create mode 100644 libc/src/math/fminimum.h
 create mode 100644 libc/src/math/fminimum_mag.h
 create mode 100644 libc/src/math/fminimum_mag_num.h
 create mode 100644 libc/src/math/fminimum_mag_numf.h
 create mode 100644 libc/src/math/fminimum_mag_numf128.h
 create mode 100644 libc/src/math/fminimum_mag_numl.h
 create mode 100644 libc/src/math/fminimum_magf.h
 create mode 100644 libc/src/math/fminimum_magf128.h
 create mode 100644 libc/src/math/fminimum_magl.h
 create mode 100644 libc/src/math/fminimum_num.h
 create mode 100644 libc/src/math/fminimum_numf.h
 create mode 100644 libc/src/math/fminimum_numf128.h
 create mode 100644 libc/src/math/fminimum_numl.h
 create mode 100644 libc/src/math/fminimumf.h
 create mode 100644 libc/src/math/fminimumf128.h
 create mode 100644 libc/src/math/fminimuml.h
 create mode 100644 libc/src/math/generic/fmaximum.cpp
 create mode 100644 libc/src/math/generic/fmaximum_mag.cpp
 create mode 100644 libc/src/math/generic/fmaximum_mag_num.cpp
 create mode 100644 libc/src/math/generic/fmaximum_mag_numf.cpp
 create mode 100644 libc/src/math/generic/fmaximum_mag_numf128.cpp
 create mode 100644 libc/src/math/generic/fmaximum_mag_numl.cpp
 create mode 100644 libc/src/math/generic/fmaximum_magf.cpp
 create mode 100644 libc/src/math/generic/fmaximum_magf128.cpp
 create mode 100644 libc/src/math/generic/fmaximum_magl.cpp
 create mode 100644 libc/src/math/generic/fmaximum_num.cpp
 create mode 100644 libc/src/math/generic/fmaximum_numf.cpp
 create mode 100644 libc/src/math/generic/fmaximum_numf128.cpp
 create mode 100644 libc/src/math/generic/fmaximum_numl.cpp
 create mode 100644 libc/src/math/generic/fmaximumf.cpp
 create mode 100644 libc/src/math/generic/fmaximumf128.cpp
 create mode 100644 libc/src/math/generic/fmaximuml.cpp
 create mode 100644 libc/src/math/generic/fminimum.cpp
 create mode 100644 libc/src/math/generic/fminimum_mag.cpp
 create mode 100644 libc/src/math/generic/fminimum_mag_num.cpp
 create mode 100644 libc/src/math/generic/fminimum_mag_numf.cpp
 create mode 100644 libc/src/math/generic/fminimum_mag_numf128.cpp
 create mode 100644 libc/src/math/generic/fminimum_mag_numl.cpp
 create mode 100644 libc/src/math/generic/fminimum_magf.cpp
 create mode 100644 libc/src/math/generic/fminimum_magf128.cpp
 create mode 100644 libc/src/math/generic/fminimum_magl.cpp
 create mode 100644 libc/src/math/generic/fminimum_num.cpp
 create mode 100644 libc/src/math/generic/fminimum_numf.cpp
 create mode 100644 libc/src/math/generic/fminimum_numf128.cpp
 create mode 100644 libc/src/math/generic/fminimum_numl.cpp
 create mode 100644 libc/src/math/generic/fminimumf.cpp
 create mode 100644 libc/src/math/generic/fminimumf128.cpp
 create mode 100644 libc/src/math/generic/fminimuml.cpp
 create mode 100644 libc/src/math/nvptx/fmaximum.cpp
 create mode 100644 libc/src/math/nvptx/fmaximumf.cpp
 create mode 100644 libc/test/src/math/smoke/FMaximumMagNumTest.h
 create mode 100644 libc/test/src/math/smoke/FMaximumMagTest.h
 create mode 100644 libc/test/src/math/smoke/FMaximumNumTest.h
 create mode 100644 libc/test/src/math/smoke/FMaximumTest.h
 create mode 100644 libc/test/src/math/smoke/FMinimumMagNumTest.h
 create mode 100644 libc/test/src/math/smoke/FMinimumMagTest.h
 create mode 100644 libc/test/src/math/smoke/FMinimumNumTest.h
 create mode 100644 libc/test/src/math/smoke/FMinimumTest.h
 create mode 100644 libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_mag_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_magf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_magf_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_magl_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_num_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_numf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_numf_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_numl_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximum_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximumf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximumf_test.cpp
 create mode 100644 libc/test/src/math/smoke/fmaximuml_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_mag_num_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_mag_numf128.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_mag_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_magf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_magf_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_magl_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_num_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_numf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_numf_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_numl_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimum_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimumf128_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimumf_test.cpp
 create mode 100644 libc/test/src/math/smoke/fminimuml_test.cpp

diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 43c9e81f17833e..56fb490104f67b 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -363,6 +363,30 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.fmin
     libc.src.math.fminf
     libc.src.math.fminl
+    libc.src.math.fmaximum
+    libc.src.math.fmaximumf
+    libc.src.math.fmaximuml
+    libc.src.math.fmaximum_num
+    libc.src.math.fmaximum_numf
+    libc.src.math.fmaximum_numl
+    libc.src.math.fmaximum_mag
+    libc.src.math.fmaximum_magf
+    libc.src.math.fmaximum_magl
+    libc.src.math.fmaximum_mag_num
+    libc.src.math.fmaximum_mag_numf
+    libc.src.math.fmaximum_mag_numl
+    libc.src.math.fminimum
+    libc.src.math.fminimumf
+    libc.src.math.fminimuml
+    libc.src.math.fminimum_num
+    libc.src.math.fminimum_numf
+    libc.src.math.fminimum_numl
+    libc.src.math.fminimum_mag
+    libc.src.math.fminimum_magf
+    libc.src.math.fminimum_magl
+    libc.src.math.fminimum_mag_num
+    libc.src.math.fminimum_mag_numf
+    libc.src.math.fminimum_mag_numl
     libc.src.math.fmod
     libc.src.math.fmodf
     libc.src.math.fmodl
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index bf1559b2f02369..70a3ed55a69a29 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -234,6 +234,30 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.fmin
     libc.src.math.fminf
     libc.src.math.fminl
+    libc.src.math.fmaximum
+    libc.src.math.fmaximumf
+    libc.src.math.fmaximuml
+    libc.src.math.fmaximum_num
+    libc.src.math.fmaximum_numf
+    libc.src.math.fmaximum_numl
+    libc.src.math.fmaximum_mag
+    libc.src.math.fmaximum_magf
+    libc.src.math.fmaximum_magl
+    libc.src.math.fmaximum_mag_num
+    libc.src.math.fmaximum_mag_numf
+    libc.src.math.fmaximum_mag_numl
+    libc.src.math.fminimum
+    libc.src.math.fminimumf
+    libc.src.math.fminimuml
+    libc.src.math.fminimum_num
+    libc.src.math.fminimum_numf
+    libc.src.math.fminimum_numl
+    libc.src.math.fminimum_mag
+    libc.src.math.fminimum_magf
+    libc.src.math.fminimum_magl
+    libc.src.math.fminimum_mag_num
+    libc.src.math.fminimum_mag_numf
+    libc.src.math.fminimum_mag_numl
     libc.src.math.fmod
     libc.src.math.fmodf
     libc.src.math.frexp
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 99ef84d3f73974..456baff250e101 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -371,6 +371,30 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.fmax
     libc.src.math.fmaxf
     libc.src.math.fmaxl
+    libc.src.math.fmaximum
+    libc.src.math.fmaximumf
+    libc.src.math.fmaximuml
+    libc.src.math.fmaximum_num
+    libc.src.math.fmaximum_numf
+    libc.src.math.fmaximum_numl
+    libc.src.math.fmaximum_mag
+    libc.src.math.fmaximum_magf
+    libc.src.math.fmaximum_magl
+    libc.src.math.fmaximum_mag_num
+    libc.src.math.fmaximum_mag_numf
+    libc.src.math.fmaximum_mag_numl
+    libc.src.math.fminimum
+    libc.src.math.fminimumf
+    libc.src.math.fminimuml
+    libc.src.math.fminimum_num
+    libc.src.math.fminimum_numf
+    libc.src.math.fminimum_numl
+    libc.src.math.fminimum_mag
+    libc.src.math.fminimum_magf
+    libc.src.math.fminimum_magl
+    libc.src.math.fminimum_mag_num
+    libc.src.math.fminimum_mag_numf
+    libc.src.math.fminimum_mag_numl
     libc.src.math.fmod
     libc.src.math.fmodf
     libc.src.math.fmodl
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 99182e7f92ac09..65f95a92a538ff 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -374,6 +374,30 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.fmax
     libc.src.math.fmaxf
     libc.src.math.fmaxl
+    libc.src.math.fmaximum
+    libc.src.math.fmaximumf
+    libc.src.math.fmaximuml
+    libc.src.math.fmaximum_num
+    libc.src.math.fmaximum_numf
+    libc.src.math.fmaximum_numl
+    libc.src.math.fmaximum_mag
+    libc.src.math.fmaximum_magf
+    libc.src.math.fmaximum_magl
+    libc.src.math.fmaximum_mag_num
+    libc.src.math.fmaximum_mag_numf
+    libc.src.math.fmaximum_mag_numl
+    libc.src.math.fminimum
+    libc.src.math.fminimumf
+    libc.src.math.fminimuml
+    libc.src.math.fminimum_num
+    libc.src.math.fminimum_numf
+    libc.src.math.fminimum_numl
+    libc.src.math.fminimum_mag
+    libc.src.math.fminimum_magf
+    libc.src.math.fminimum_magl
+    libc.src.math.fminimum_mag_num
+    libc.src.math.fminimum_mag_numf
+    libc.src.math.fminimum_mag_numl
     libc.src.math.fmod
     libc.src.math.fmodf
     libc.src.math.fmodl
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index d6227a427afe2b..1a1d92b1f2afe7 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -1,4 +1,4 @@
-set(TARGET_LIBC_ENTRYPOINTS
+fset(TARGET_LIBC_ENTRYPOINTS
     # ctype.h entrypoints
     libc.src.ctype.isalnum
     libc.src.ctype.isalpha
@@ -153,6 +153,30 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.fmax
     libc.src.math.fmaxf
     libc.src.math.fmaxl
+    libc.src.math.fmaximum
+    libc.src.math.fmaximumf
+    libc.src.math.fmaximuml
+    libc.src.math.fmaximum_num
+    libc.src.math.fmaximum_numf
+    libc.src.math.fmaximum_numl
+    libc.src.math.fmaximum_mag
+    libc.src.math.fmaximum_magf
+    libc.src.math.fmaximum_magl
+    libc.src.math.fmaximum_mag_num
+    libc.src.math.fmaximum_mag_numf
+    libc.src.math.fmaximum_mag_numl
+    libc.src.math.fminimum
+    libc.src.math.fminimumf
+    libc.src.math.fminimuml
+    libc.src.math.fminimum_num
+    libc.src.math.fminimum_numf
+    libc.src.math.fminimum_numl
+    libc.src.math.fminimum_mag
+    libc.src.math.fminimum_magf
+    libc.src.math.fminimum_magl
+    libc.src.math.fminimum_mag_num
+    libc.src.math.fminimum_mag_numf
+    libc.src.math.fminimum_mag_numl
     libc.src.math.fmod
     libc.src.math.fmodf
     libc.src.math.fmodl
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 84d28cc3350304..f35cf06a12ca0d 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -400,6 +400,46 @@ def StdC : StandardSpec<"stdc"> {
           FunctionSpec<"fmaxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
           FunctionSpec<"fmaxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
           GuardedFunctionSpec<"fmaxf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+	  
+	  FunctionSpec<"fmaximum", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
+          FunctionSpec<"fmaximumf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"fmaximuml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          GuardedFunctionSpec<"fmaximumf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+	  
+	  FunctionSpec<"fmaximum_num", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
+          FunctionSpec<"fmaximum_numf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"fmaximum_numl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          GuardedFunctionSpec<"fmaximum_numf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+	  
+	  FunctionSpec<"fmaximum_mag", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
+          FunctionSpec<"fmaximum_magf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"fmaximum_magl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          GuardedFunctionSpec<"fmaximum_magf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+	  
+	  FunctionSpec<"fmaximum_mag_num", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
+          FunctionSpec<"fmaximum_mag_numf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"fmaximum_mag_numl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          GuardedFunctionSpec<"fmaximum_mag_numf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+	  
+	  FunctionSpec<"fminimum", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
+          FunctionSpec<"fminimumf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"fminimuml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          GuardedFunctionSpec<"fminimumf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+	  
+	  FunctionSpec<"fminimum_num", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
+          FunctionSpec<"fminimum_numf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"fmaximum_numl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          GuardedFunctionSpec<"fminimum_numf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+	  
+	  FunctionSpec<"fminimum_mag", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
+          FunctionSpec<"fminimum_magf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"fminimum_magl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          GuardedFunctionSpec<"fminimum_magf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+	  
+	  FunctionSpec<"fminimum_mag_num", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
+          FunctionSpec<"fminimum_mag_numf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
+          FunctionSpec<"fminimum_mag_numl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+          GuardedFunctionSpec<"fminimum_mag_numf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
 
           FunctionSpec<"fma", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
           FunctionSpec<"fmaf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<FloatType>]>,
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index a19d6d0bef08ff..de04f6d0a353b5 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -58,6 +58,130 @@ LIBC_INLINE T fmax(T x, T y) {
   }
 }
 
+template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
+LIBC_INLINE T fmaximum(T x, T y) {
+  FPBits<T> bitx(x), bity(y);
+
+  if (bitx.is_nan()) {
+    return x;
+  } else if (bity.is_nan()) {
+    return y;
+  } else if (bitx.sign() != bity.sign()) {
+    // To make sure that fmax(+0, -0) == +0 == fmax(-0, +0), whenever x and
+    // y has different signs and both are not NaNs, we return the number
+    // with positive sign.
+    return (bitx.is_neg() ? y : x);
+  } else {
+    return (x > y ? x : y);
+  }
+}
+
+template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
+LIBC_INLINE T fminimum(T x, T y) {
+  const FPBits<T> bitx(x), bity(y);
+
+  if (bitx.is_nan()) {
+    return x;
+  } else if (bity.is_nan()) {
+    return y;
+  } else if (bitx.sign() != bity.sign()) {
+    // To make sure that fmin(+0, -0) == -0 == fmin(-0, +0), whenever x and
+    // y has different signs and both are not NaNs, we return the number
+    // with negative sign.
+    return (bitx.is_neg()) ? x : y;
+  } else {
+    return (x < y ? x : y);
+  }
+}
+
+template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
+LIBC_INLINE T fmaximum_num(T x, T y) {
+  FPBits<T> bitx(x), bity(y);
+
+  if (bitx.is_nan()) {
+    return y;
+  } else if (bity.is_nan()) {
+    return x;
+  } else if (bitx.sign() != bity.sign()) {
+    // To make sure that fmax(+0, -0) == +0 == fmax(-0, +0), whenever x and
+    // y has different signs and both are not NaNs, we return the number
+    // with positive sign.
+    return (bitx.is_neg() ? y : x);
+  } else {
+    return (x > y ? x : y);
+  }
+}
+
+template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
+LIBC_INLINE T fminimum_num(T x, T y) {
+  const FPBits<T> bitx(x), bity(y);
+
+  if (bitx.is_nan()) {
+    return y;
+  } else if (bity.is_nan()) {
+    return x;
+  } else if (bitx.sign() != bity.sign()) {
+    // To make sure that fmin(+0, -0) == -0 == fmin(-0, +0), whenever x and
+    // y has different signs and both are not NaNs, we return the number
+    // with negative sign.
+    return (bitx.is_neg()) ? x : y;
+  } else {
+    return (x < y ? x : y);
+  }
+}
+
+template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
+LIBC_INLINE T fmaximum_mag(T x, T y) {
+  FPBits<T> bitx(x), bity(y);
+
+  if (abs(x) > abs(y)) {
+      return x;
+    } else if (abs(y) > abs(x)) {
+      return y;
+    } else {
+      return fmaximum(x, y);
+    }
+}
+
+template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
+LIBC_INLINE T fminimum_mag(T x, T y) {
+  FPBits<T> bitx(x), bity(y);
+
+  if (abs(x) < abs(y)) {
+      return x;
+    } else if (abs(y) < abs(x)) {
+      return y;
+    } else {
+      return fminimum(x, y);
+    }
+}
+
+template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
+LIBC_INLINE T fmaximum_mag_num(T x, T y) {
+  FPBits<T> bitx(x), bity(y);
+
+  if (abs(x) > abs(y)) {
+      return x;
+    } else if (abs(y) > abs(x)) {
+      return y;
+    } else {
+      return fmaximum_num(x, y);
+    }
+}
+
+template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
+LIBC_INLINE T fminimum_mag_num(T x, T y) {
+  FPBits<T> bitx(x), bity(y);
+
+  if (abs(x) < abs(y)) {
+      return x;
+    } else if (abs(y) < abs(x)) {
+      return y;
+    } else {
+      return fminimum_num(x, y);
+    }
+}
+  
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fdim(T x, T y) {
   FPBits<T> bitx(x), bity(y);
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 5e2e6e699d0e0c..bdfd2a51346307 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -117,6 +117,46 @@ add_math_entrypoint_object(fminf)
 add_math_entrypoint_object(fminl)
 add_math_entrypoint_object(fminf128)
 
+add_math_entrypoint_object(fmaximum)
+add_math_entrypoint_object(fmaximumf)
+add_math_entrypoint_object(fmaximuml)
+add_math_entrypoint_object(fmaximumf128)
+
+add_math_entrypoint_object(fmaximum_num)
+add_math_entrypoint_object(fmaximum_numf)
+add_math_entrypoint_object(fmaximum_numl)
+add_math_entrypoint_object(fmaximum_numf128)
+
+add_math_entrypoint_object(fmaximum_mag)
+add_math_entrypoint_object(fmaximum_magf)
+add_math_entrypoint_object(fmaximum_magl)
+add_math_entrypoint_object(fmaximum_magf128)
+
+add_math_entrypoint_object(fmaximum_mag_num)
+add_math_entrypoint_object(fmaximum_mag_numf)
+add_math_entrypoint_object(fmaximum_mag_numl)
+add_math_entrypoint_object(fmaximum_mag_numf128)
+
+add_math_entrypoint_object(fminimum)
+add_math_entrypoint_object(fminimumf)
+add_math_entrypoint_object(fminimuml)
+add_math_entrypoint_object(fminimumf128)
+
+add_math_entrypoint_object(fminimum_num)
+add_math_entrypoint_object(fminimum_numf)
+add_math_entrypoint_object(fminimum_numl)
+add_math_entrypoint_object(fminimum_numf128)
+
+add_math_entrypoint_object(fminimum_mag)
+add_math_entrypoint_object(fminimum_magf)
+add_math_entrypoint_object(fminimum_magl)
+add_math_entrypoint_object(fminimum_magf128)
+
+add_math_entrypoint_object(fminimum_mag_num)
+add_math_entrypoint_object(fminimum_mag_numf)
+add_math_entrypoint_object(fminimum_mag_numl)
+add_math_entrypoint_object(fminimum_mag_numf128)
+
 add_math_entrypoint_object(fmod)
 add_math_entrypoint_object(fmodf)
 add_math_entrypoint_object(fmodl)
diff --git a/libc/src/math/amdgpu/fmaximum.cpp b/libc/src/math/amdgpu/fmaximum.cpp
new file mode 100644
index 00000000000000..a121feb79addce
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum function for GPU -----------------------===//
+//
+// 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/fmaximum.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum, (double x, double y)) {
+  return __builtin_fmaximum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_mag.cpp b/libc/src/math/amdgpu/fmaximum_mag.cpp
new file mode 100644
index 00000000000000..99e277f108e02e
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_mag.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_mag function for GPU -----------------------===//
+//
+// 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/fmaximum_mag.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum_mag, (double x, double y)) {
+  return __builtin_fmaximum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_mag_num.cpp b/libc/src/math/amdgpu/fmaximum_mag_num.cpp
new file mode 100644
index 00000000000000..bde427903ad60b
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_mag_num.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_mag_num function for GPU -----------------------===//
+//
+// 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/fmaximum_mag_num.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum_mag_num, (double x, double y)) {
+  return __builtin_fmaximum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_mag_numf.cpp b/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
new file mode 100644
index 00000000000000..52f7d1413a1cc2
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_mag_numf function for GPU -----------------------===//
+//
+// 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/fmaximum_mag_numf.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximum_mag_numf, (float x, float y)) {
+  return __builtin_fmaximum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_mag_numl.cpp b/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
new file mode 100644
index 00000000000000..33acb0dbdb1b8d
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_mag_numl function for GPU -----------------------===//
+//
+// 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/fmaximum_mag_numl.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fmaximum_mag_numl, (long double x, long double y)) {
+  return __builtin_fmaximum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_magf.cpp b/libc/src/math/amdgpu/fmaximum_magf.cpp
new file mode 100644
index 00000000000000..9b057437e8137f
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_magf.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_magf function for GPU -----------------------===//
+//
+// 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/fmaximum_magf.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximum_magf, (float x, float y)) {
+  return __builtin_fmaximum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_magl.cpp b/libc/src/math/amdgpu/fmaximum_magl.cpp
new file mode 100644
index 00000000000000..06fe8bf1c406c3
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_magl.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_magl function for GPU -----------------------===//
+//
+// 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/fmaximum_magl.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fmaximum_magl, (long double x, long double y)) {
+  return __builtin_fmaximum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_num.cpp b/libc/src/math/amdgpu/fmaximum_num.cpp
new file mode 100644
index 00000000000000..ec0b1b6a575587
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_num.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_num function for GPU -----------------------===//
+//
+// 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/fmaximum_num.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum_num, (double x, double y)) {
+  return __builtin_fmaximum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_numf.cpp b/libc/src/math/amdgpu/fmaximum_numf.cpp
new file mode 100644
index 00000000000000..81a0653730f7e5
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_numf.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_numf function for GPU -----------------------===//
+//
+// 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/fmaximum_numf.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximum_numf, (float x, float y)) {
+  return __builtin_fmaximum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_numl.cpp b/libc/src/math/amdgpu/fmaximum_numl.cpp
new file mode 100644
index 00000000000000..c378c4f9b8bb7f
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximum_numl.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximum_numl function for GPU -----------------------===//
+//
+// 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/fmaximum_numl.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum_numl, (long double x, long double y)) {
+  return __builtin_fmaximum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximumf.cpp b/libc/src/math/amdgpu/fmaximumf.cpp
new file mode 100644
index 00000000000000..842c9865bc790c
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximumf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the fmaximumf function for GPU ----------------------===//
+//
+// 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/fmaximumf.h"
+
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximumf, (float x, float y)) {
+  return __builtin_fmaximum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximuml.cpp b/libc/src/math/amdgpu/fmaximuml.cpp
new file mode 100644
index 00000000000000..6d0206f01beb33
--- /dev/null
+++ b/libc/src/math/amdgpu/fmaximuml.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the fmaximuml function for GPU ----------------------===//
+//
+// 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/fmaximuml.h"
+
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximuml, (float x, float y)) {
+  return __builtin_fmaximum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum.cpp b/libc/src/math/amdgpu/fminimum.cpp
new file mode 100644
index 00000000000000..f787a4ca11ad5c
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum function for GPU -----------------------===//
+//
+// 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/fminimum.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum, (double x, double y)) {
+  return __builtin_fminimum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_mag.cpp b/libc/src/math/amdgpu/fminimum_mag.cpp
new file mode 100644
index 00000000000000..c5e95a5340c0d4
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_mag.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_mag function for GPU -----------------------===//
+//
+// 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/fminimum_mag.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum_mag, (double x, double y)) {
+  return __builtin_fminimum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_mag_num.cpp b/libc/src/math/amdgpu/fminimum_mag_num.cpp
new file mode 100644
index 00000000000000..f09e137ca99948
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_mag_num.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_mag_num function for GPU -----------------------===//
+//
+// 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/fminimum_mag_num.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum_mag_num, (double x, double y)) {
+  return __builtin_fminimum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_mag_numf.cpp b/libc/src/math/amdgpu/fminimum_mag_numf.cpp
new file mode 100644
index 00000000000000..6bd32166443c9a
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_mag_numf.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_mag_numf function for GPU -----------------------===//
+//
+// 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/fminimum_mag_numf.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fminimum_mag_numf, (float x, float y)) {
+  return __builtin_fminimum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_mag_numl.cpp b/libc/src/math/amdgpu/fminimum_mag_numl.cpp
new file mode 100644
index 00000000000000..b5ac91dcfc771c
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_mag_numl.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_mag_numl function for GPU -----------------------===//
+//
+// 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/fminimum_mag_numl.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+  LLVM_LIBC_FUNCTION(long double, fminimum_mag_numl, (long double x, long double y)) {
+  return __builtin_fminimum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_magf.cpp b/libc/src/math/amdgpu/fminimum_magf.cpp
new file mode 100644
index 00000000000000..1603258a2e1836
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_magf.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_magf function for GPU -----------------------===//
+//
+// 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/fminimum_magf.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fminimum_magf, (float x, float y)) {
+  return __builtin_fminimum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_magl.cpp b/libc/src/math/amdgpu/fminimum_magl.cpp
new file mode 100644
index 00000000000000..af16dc07cee97c
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_magl.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_magl function for GPU -----------------------===//
+//
+// 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/fminimum_magl.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fminimum_magl, (long double x, long double y)) {
+  return __builtin_fminimum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_num.cpp b/libc/src/math/amdgpu/fminimum_num.cpp
new file mode 100644
index 00000000000000..6411d38804db33
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_num.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_num function for GPU -----------------------===//
+//
+// 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/fminimum_num.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum_num, (double x, double y)) {
+  return __builtin_fminimum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_numf.cpp b/libc/src/math/amdgpu/fminimum_numf.cpp
new file mode 100644
index 00000000000000..fd39e4da0c74aa
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_numf.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_numf function for GPU -----------------------===//
+//
+// 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/fminimum_numf.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum_numf, (double x, double y)) {
+  return __builtin_fminimum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_numl.cpp b/libc/src/math/amdgpu/fminimum_numl.cpp
new file mode 100644
index 00000000000000..cfa08b97b885b6
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimum_numl.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fminimum_numl function for GPU -----------------------===//
+//
+// 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/fminimum_numl.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum_numl, (double x, double y)) {
+  return __builtin_fminimum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimumf.cpp b/libc/src/math/amdgpu/fminimumf.cpp
new file mode 100644
index 00000000000000..032da034a0ec6f
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimumf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the fminimumf function for GPU ----------------------===//
+//
+// 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/fminimumf.h"
+
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fminimumf, (float x, float y)) {
+  return __builtin_fminimum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimuml.cpp b/libc/src/math/amdgpu/fminimuml.cpp
new file mode 100644
index 00000000000000..493392b37bc3d4
--- /dev/null
+++ b/libc/src/math/amdgpu/fminimuml.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the fminimuml function for GPU ----------------------===//
+//
+// 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/fminimuml.h"
+
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fminimuml, (long double x, long doubley)) {
+  return __builtin_fminimum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/fmaximum.h b/libc/src/math/fmaximum.h
new file mode 100644
index 00000000000000..62b4dcf4a9be92
--- /dev/null
+++ b/libc/src/math/fmaximum.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum --------------------------*- 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_FMAXIMUM_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_H
+
+namespace LIBC_NAMESPACE {
+
+double fmaximum(double x, double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_H
diff --git a/libc/src/math/fmaximum_mag.h b/libc/src/math/fmaximum_mag.h
new file mode 100644
index 00000000000000..6be9ddd08c0655
--- /dev/null
+++ b/libc/src/math/fmaximum_mag.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_mag--------------------------*- 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_FMAXIMUM_MAG_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_H
+
+namespace LIBC_NAMESPACE {
+
+double fmaximum_mag(double x, double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_H
diff --git a/libc/src/math/fmaximum_mag_num.h b/libc/src/math/fmaximum_mag_num.h
new file mode 100644
index 00000000000000..e5605e76f01114
--- /dev/null
+++ b/libc/src/math/fmaximum_mag_num.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_mag_num--------------------------*- 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_FMAXIMUM_MAG_NUM_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUM_H
+
+namespace LIBC_NAMESPACE {
+
+double fmaximum_mag_num(double x, double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUM_H
diff --git a/libc/src/math/fmaximum_mag_numf.h b/libc/src/math/fmaximum_mag_numf.h
new file mode 100644
index 00000000000000..0c670963170c1f
--- /dev/null
+++ b/libc/src/math/fmaximum_mag_numf.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_mag_numf -------------------------*- 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_FMAXIMUM_MAG_NUMF_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMF_H
+
+namespace LIBC_NAMESPACE {
+
+float fmaximum_mag_numf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMF_H
diff --git a/libc/src/math/fmaximum_mag_numf128.h b/libc/src/math/fmaximum_mag_numf128.h
new file mode 100644
index 00000000000000..b1fdaa6f7d48de
--- /dev/null
+++ b/libc/src/math/fmaximum_mag_numf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fmaximum_mag_numf128 ----------------------*- 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_FMAXIMUM_MAG_NUMF128_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMF128_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float128 fmaximum_mag_numf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMF128_H
diff --git a/libc/src/math/fmaximum_mag_numl.h b/libc/src/math/fmaximum_mag_numl.h
new file mode 100644
index 00000000000000..6b69688a8e4751
--- /dev/null
+++ b/libc/src/math/fmaximum_mag_numl.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_mag_numl -------------------------*- 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_FMAXIMUM_MAG_NUML_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUML_H
+
+namespace LIBC_NAMESPACE {
+
+long double fmaximum_mag_numl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUML_H
diff --git a/libc/src/math/fmaximum_magf.h b/libc/src/math/fmaximum_magf.h
new file mode 100644
index 00000000000000..69ef82ae2b8867
--- /dev/null
+++ b/libc/src/math/fmaximum_magf.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_magf -------------------------*- 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_FMAXIMUM_MAGF_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGF_H
+
+namespace LIBC_NAMESPACE {
+
+float fmaximum_magf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGF_H
diff --git a/libc/src/math/fmaximum_magf128.h b/libc/src/math/fmaximum_magf128.h
new file mode 100644
index 00000000000000..a9a4cc387c192c
--- /dev/null
+++ b/libc/src/math/fmaximum_magf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fmaximum_magf128 ----------------------*- 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_FMAXIMUM_MAGF128_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGF128_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float128 fmaximum_magf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGF128_H
diff --git a/libc/src/math/fmaximum_magl.h b/libc/src/math/fmaximum_magl.h
new file mode 100644
index 00000000000000..c9483e4ff3cf00
--- /dev/null
+++ b/libc/src/math/fmaximum_magl.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_magl -------------------------*- 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_FMAXIMUM_MAGL_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGL_H
+
+namespace LIBC_NAMESPACE {
+
+long double fmaximum_magl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGL_H
diff --git a/libc/src/math/fmaximum_num.h b/libc/src/math/fmaximum_num.h
new file mode 100644
index 00000000000000..4781a1392b625b
--- /dev/null
+++ b/libc/src/math/fmaximum_num.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_num--------------------------*- 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_FMAXIMUM_NUM_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_NUM_H
+
+namespace LIBC_NAMESPACE {
+
+double fmaximum_num(double x, double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_NUM_H
diff --git a/libc/src/math/fmaximum_numf.h b/libc/src/math/fmaximum_numf.h
new file mode 100644
index 00000000000000..2e211a6b232714
--- /dev/null
+++ b/libc/src/math/fmaximum_numf.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_numf -------------------------*- 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_FMAXIMUM_NUMF_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMF_H
+
+namespace LIBC_NAMESPACE {
+
+float fmaximum_numf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMF_H
diff --git a/libc/src/math/fmaximum_numf128.h b/libc/src/math/fmaximum_numf128.h
new file mode 100644
index 00000000000000..b3ef91dd6f0536
--- /dev/null
+++ b/libc/src/math/fmaximum_numf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fmaximum_numf128 ----------------------*- 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_FMAXIMUM_NUMF128_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMF128_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float128 fmaximum_numf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMF128_H
diff --git a/libc/src/math/fmaximum_numl.h b/libc/src/math/fmaximum_numl.h
new file mode 100644
index 00000000000000..0e3a8fcba7bbaf
--- /dev/null
+++ b/libc/src/math/fmaximum_numl.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximum_numl -------------------------*- 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_FMAXIMUM_NUML_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUM_NUML_H
+
+namespace LIBC_NAMESPACE {
+
+long double fmaximum_numl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_NUML_H
diff --git a/libc/src/math/fmaximumf.h b/libc/src/math/fmaximumf.h
new file mode 100644
index 00000000000000..d341f249f8634a
--- /dev/null
+++ b/libc/src/math/fmaximumf.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximumf -------------------------*- 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_FMAXIMUMF_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUMF_H
+
+namespace LIBC_NAMESPACE {
+
+float fmaximumf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUMF_H
diff --git a/libc/src/math/fmaximumf128.h b/libc/src/math/fmaximumf128.h
new file mode 100644
index 00000000000000..533617c54abbde
--- /dev/null
+++ b/libc/src/math/fmaximumf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fmaximumf128 ----------------------*- 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_FMAXIMUMF128_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUMF128_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float128 fmaximumf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUMF128_H
diff --git a/libc/src/math/fmaximuml.h b/libc/src/math/fmaximuml.h
new file mode 100644
index 00000000000000..abce56e4e71d0f
--- /dev/null
+++ b/libc/src/math/fmaximuml.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fmaximuml -------------------------*- 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_FMAXIMUML_H
+#define LLVM_LIBC_SRC_MATH_FMAXIMUML_H
+
+namespace LIBC_NAMESPACE {
+
+long double fmaximuml(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMAXIMUML_H
diff --git a/libc/src/math/fminimum.h b/libc/src/math/fminimum.h
new file mode 100644
index 00000000000000..f7741f2cac5416
--- /dev/null
+++ b/libc/src/math/fminimum.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum -------------------------*- 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_FMINIMUM_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_H
+
+namespace LIBC_NAMESPACE {
+
+double fminimum(double x, double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_H
diff --git a/libc/src/math/fminimum_mag.h b/libc/src/math/fminimum_mag.h
new file mode 100644
index 00000000000000..9772b51f6ba02a
--- /dev/null
+++ b/libc/src/math/fminimum_mag.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_mag--------------------------*- 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_FMINIMUM_MAG_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_H
+
+namespace LIBC_NAMESPACE {
+
+double fminimum_mag(double x, double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_H
diff --git a/libc/src/math/fminimum_mag_num.h b/libc/src/math/fminimum_mag_num.h
new file mode 100644
index 00000000000000..7e6e279b5d2f8a
--- /dev/null
+++ b/libc/src/math/fminimum_mag_num.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_mag_num--------------------------*- 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_FMINIMUM_MAG_NUM_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUM_H
+
+namespace LIBC_NAMESPACE {
+
+double fminimum_mag_num(double x, double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMH
diff --git a/libc/src/math/fminimum_mag_numf.h b/libc/src/math/fminimum_mag_numf.h
new file mode 100644
index 00000000000000..006ce3a244fbc9
--- /dev/null
+++ b/libc/src/math/fminimum_mag_numf.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_mag_numf -------------------------*- 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_FMINIMUM_MAG_NUMF_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMF_H
+
+namespace LIBC_NAMESPACE {
+
+float fminimum_mag_numf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMF_H
diff --git a/libc/src/math/fminimum_mag_numf128.h b/libc/src/math/fminimum_mag_numf128.h
new file mode 100644
index 00000000000000..53e847247b2803
--- /dev/null
+++ b/libc/src/math/fminimum_mag_numf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fminimum_mag_numf128 ----------------------*- 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_FMINIMUM_MAG_NUMF128_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMF128_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float128 fminimum_mag_numf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMF128_H
diff --git a/libc/src/math/fminimum_mag_numl.h b/libc/src/math/fminimum_mag_numl.h
new file mode 100644
index 00000000000000..740b15c7facc4b
--- /dev/null
+++ b/libc/src/math/fminimum_mag_numl.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_mag_numl -------------------------*- 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_FMINIMUM_MAG_NUML_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUML_H
+
+namespace LIBC_NAMESPACE {
+
+long double fminimum_mag_numl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUML_H
diff --git a/libc/src/math/fminimum_magf.h b/libc/src/math/fminimum_magf.h
new file mode 100644
index 00000000000000..50bdf784511a2b
--- /dev/null
+++ b/libc/src/math/fminimum_magf.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_magf -------------------------*- 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_FMINIMUM_MAGF_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAGF_H
+
+namespace LIBC_NAMESPACE {
+
+float fminimum_magf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAGF_H
diff --git a/libc/src/math/fminimum_magf128.h b/libc/src/math/fminimum_magf128.h
new file mode 100644
index 00000000000000..74b293ccc80097
--- /dev/null
+++ b/libc/src/math/fminimum_magf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fminimum_magf128 ----------------------*- 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_FMINIMUM_MAGF128_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAGF128_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float128 fminimum_magf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAGF128_H
diff --git a/libc/src/math/fminimum_magl.h b/libc/src/math/fminimum_magl.h
new file mode 100644
index 00000000000000..530e080ee3bb0c
--- /dev/null
+++ b/libc/src/math/fminimum_magl.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_magl -------------------------*- 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_FMINIMUM_MAGL_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_MAGL_H
+
+namespace LIBC_NAMESPACE {
+
+long double fminimum_magl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAGL_H
diff --git a/libc/src/math/fminimum_num.h b/libc/src/math/fminimum_num.h
new file mode 100644
index 00000000000000..53114034cb2b28
--- /dev/null
+++ b/libc/src/math/fminimum_num.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_num--------------------------*- 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_FMINIMUM_NUM_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_NUM_H
+
+namespace LIBC_NAMESPACE {
+
+double fminimum_num(double x, double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_NUM_H
diff --git a/libc/src/math/fminimum_numf.h b/libc/src/math/fminimum_numf.h
new file mode 100644
index 00000000000000..d1d1762876bcc4
--- /dev/null
+++ b/libc/src/math/fminimum_numf.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_numf -------------------------*- 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_FMINIMUM_NUMF_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_NUMF_H
+
+namespace LIBC_NAMESPACE {
+
+float fminimum_numf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_NUMF_H
diff --git a/libc/src/math/fminimum_numf128.h b/libc/src/math/fminimum_numf128.h
new file mode 100644
index 00000000000000..68fcabc7f24465
--- /dev/null
+++ b/libc/src/math/fminimum_numf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fminimum_numf128 ----------------------*- 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_FMINIMUM_NUMF128_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_NUMF128_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float128 fminimum_numf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_NUMF128_H
diff --git a/libc/src/math/fminimum_numl.h b/libc/src/math/fminimum_numl.h
new file mode 100644
index 00000000000000..01851286a22ab0
--- /dev/null
+++ b/libc/src/math/fminimum_numl.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimum_numl -------------------------*- 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_FMINIMUM_NUML_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUM_NUML_H
+
+namespace LIBC_NAMESPACE {
+
+long double fminimum_numl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUM_NUML_H
diff --git a/libc/src/math/fminimumf.h b/libc/src/math/fminimumf.h
new file mode 100644
index 00000000000000..be864d9e02203f
--- /dev/null
+++ b/libc/src/math/fminimumf.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimumf -------------------------*- 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_FMINIMUMF_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUMF_H
+
+namespace LIBC_NAMESPACE {
+
+float fminimumf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUMF_H
diff --git a/libc/src/math/fminimumf128.h b/libc/src/math/fminimumf128.h
new file mode 100644
index 00000000000000..b8c16fecfdeb07
--- /dev/null
+++ b/libc/src/math/fminimumf128.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for fminimumf128 ----------------------*- 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_FMINIMUMF128_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUMF128_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float128 fminimumf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUMF128_H
diff --git a/libc/src/math/fminimuml.h b/libc/src/math/fminimuml.h
new file mode 100644
index 00000000000000..4354b3d54e5330
--- /dev/null
+++ b/libc/src/math/fminimuml.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for fminimuml -------------------------*- 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_FMINIMUML_H
+#define LLVM_LIBC_SRC_MATH_FMINIMUML_H
+
+namespace LIBC_NAMESPACE {
+
+long double fminimuml(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_FMINIMUML_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index b0a35c652cd587..b4b1dde52bee3b 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -1545,6 +1545,400 @@ add_entrypoint_object(
     -O3
 )
 
+add_entrypoint_object(
+  fmaximum
+  SRCS
+    fmaximum.cpp
+  HDRS
+    ../fmaximum.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximumf
+  SRCS
+    fmaximumf.cpp
+  HDRS
+    ../fmaximumf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximuml
+  SRCS
+    fmaximuml.cpp
+  HDRS
+    ../fmaximuml.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximumf128
+  SRCS
+    fmaximumf128.cpp
+  HDRS
+    ../fmaximumf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_entrypoint_object(
+  fmaximum_num
+  SRCS
+    fmaximum_num.cpp
+  HDRS
+    ../fmaximum_num.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_numf
+  SRCS
+    fmaximum_numf.cpp
+  HDRS
+    ../fmaximum_numf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_numl
+  SRCS
+    fmaximum_numl.cpp
+  HDRS
+    ../fmaximum_numl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_numf128
+  SRCS
+    fmaximum_numf128.cpp
+  HDRS
+    ../fmaximum_numf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_entrypoint_object(
+  fmaximum_mag
+  SRCS
+    fmaximum_mag.cpp
+  HDRS
+    ../fmaximum_mag.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_magf
+  SRCS
+    fmaximum_magf.cpp
+  HDRS
+    ../fmaximum_magf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_magl
+  SRCS
+    fmaximum_magl.cpp
+  HDRS
+    ../fmaximum_magl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_magf128
+  SRCS
+    fmaximum_magf128.cpp
+  HDRS
+    ../fmaximum_magf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O3
+)
+
+
+add_entrypoint_object(
+  fmaximum_mag_num
+  SRCS
+    fmaximum_mag_num.cpp
+  HDRS
+    ../fmaximum_mag_num.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_mag_numf
+  SRCS
+    fmaximum_mag_numf.cpp
+  HDRS
+    ../fmaximum_mag_numf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_mag_numl
+  SRCS
+    fmaximum_mag_numl.cpp
+  HDRS
+    ../fmaximum_mag_numl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fmaximum_mag_numf128
+  SRCS
+    fmaximum_mag_numf128.cpp
+  HDRS
+    ../fmaximum_mag_numf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_entrypoint_object(
+  fminimum
+  SRCS
+    fminimum.cpp
+  HDRS
+    ../fminimum.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimumf
+  SRCS
+    fminimumf.cpp
+  HDRS
+    ../fminimumf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimuml
+  SRCS
+    fminimuml.cpp
+  HDRS
+    ../fminimuml.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimumf128
+  SRCS
+    fminimumf128.cpp
+  HDRS
+    ../fminimumf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_entrypoint_object(
+  fminimum_num
+  SRCS
+    fminimum_num.cpp
+  HDRS
+    ../fminimum_num.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_numf
+  SRCS
+    fminimum_numf.cpp
+  HDRS
+    ../fminimum_numf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_numl
+  SRCS
+    fminimum_numl.cpp
+  HDRS
+    ../fminimum_numl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_numf128
+  SRCS
+    fminimum_numf128.cpp
+  HDRS
+    ../fminimum_numf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O3
+)
+
+add_entrypoint_object(
+  fminimum_mag
+  SRCS
+    fminimum_mag.cpp
+  HDRS
+    ../fminimum_mag.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_magf
+  SRCS
+    fminimum_magf.cpp
+  HDRS
+    ../fminimum_magf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_magl
+  SRCS
+    fminimum_magl.cpp
+  HDRS
+    ../fminimum_magl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_magf128
+  SRCS
+    fminimum_magf128.cpp
+  HDRS
+    ../fminimum_magf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O3
+)
+
+
+add_entrypoint_object(
+  fminimum_mag_num
+  SRCS
+    fminimum_mag_num.cpp
+  HDRS
+    ../fminimum_mag_num.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_mag_numf
+  SRCS
+    fminimum_mag_numf.cpp
+  HDRS
+    ../fminimum_mag_numf.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_mag_numl
+  SRCS
+    fminimum_mag_numl.cpp
+  HDRS
+    ../fminimum_mag_numl.h
+  DEPENDS
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_entrypoint_object(
+  fminimum_mag_numf128
+  SRCS
+    fminimum_mag_numf128.cpp
+  HDRS
+    ../fminimum_mag_numf128.h
+  DEPENDS
+    libc.src.__support.macros.properties.types
+    libc.src.__support.FPUtil.basic_operations
+  COMPILE_OPTIONS
+    -O3
+)
+
 add_entrypoint_object(
   sqrt
   SRCS
@@ -1557,6 +1951,7 @@ add_entrypoint_object(
     -O3
 )
 
+
 add_entrypoint_object(
   sqrtf
   SRCS
diff --git a/libc/src/math/generic/fmaximum.cpp b/libc/src/math/generic/fmaximum.cpp
new file mode 100644
index 00000000000000..0e2d5f52a3dd6d
--- /dev/null
+++ b/libc/src/math/generic/fmaximum.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum 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/fmaximum.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum, (double x, double y)) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_mag.cpp b/libc/src/math/generic/fmaximum_mag.cpp
new file mode 100644
index 00000000000000..fe6c47e000159f
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_mag.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_mag 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/fmaximum_mag.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum_mag, (double x, double y)) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_mag_num.cpp b/libc/src/math/generic/fmaximum_mag_num.cpp
new file mode 100644
index 00000000000000..ac17a324cf3d35
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_mag_num.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_mag_num 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/fmaximum_mag_num.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum_mag_num, (double x, double y)) {
+  return fputil::fmaximum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_mag_numf.cpp b/libc/src/math/generic/fmaximum_mag_numf.cpp
new file mode 100644
index 00000000000000..fc0122d42357e9
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_mag_numf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_mag_numf 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/fmaximum_mag_numf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximum_mag_numf, (float x, float y)) {
+  return fputil::fmaximum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_mag_numf128.cpp b/libc/src/math/generic/fmaximum_mag_numf128.cpp
new file mode 100644
index 00000000000000..54b02436d2d87e
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_mag_numf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_mag_numf128 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/fmaximum_mag_numf128.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float128, fmaximum_mag_numf128, (float128 x, float128 y)) {
+  return fputil::fmaximum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_mag_numl.cpp b/libc/src/math/generic/fmaximum_mag_numl.cpp
new file mode 100644
index 00000000000000..c124cf0d2ac534
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_mag_numl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fmaximum_mag_numl 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/fmaximum_mag_numl.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fmaximum_mag_numl, (long double x, long double y)) {
+  return fputil::fmaximum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
+
diff --git a/libc/src/math/generic/fmaximum_magf.cpp b/libc/src/math/generic/fmaximum_magf.cpp
new file mode 100644
index 00000000000000..23aa6c3408933a
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_magf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_magf 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/fmaximum_magf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximum_magf, (float x, float y)) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_magf128.cpp b/libc/src/math/generic/fmaximum_magf128.cpp
new file mode 100644
index 00000000000000..93413714dd9c9a
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_magf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_magf128 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/fmaximum_magf128.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float128, fmaximum_magf128, (float128 x, float128 y)) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_magl.cpp b/libc/src/math/generic/fmaximum_magl.cpp
new file mode 100644
index 00000000000000..0c7cab2e230ef2
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_magl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fmaximum_magl 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/fmaximum_magl.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fmaximum_magl, (long double x, long double y)) {
+  return fputil::fmaximum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
+
diff --git a/libc/src/math/generic/fmaximum_num.cpp b/libc/src/math/generic/fmaximum_num.cpp
new file mode 100644
index 00000000000000..1dc2b7b68f4cbd
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_num.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_num 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/fmaximum_num.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum_num, (double x, double y)) {
+  return fputil::fmaximum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_numf.cpp b/libc/src/math/generic/fmaximum_numf.cpp
new file mode 100644
index 00000000000000..fa0e71a9791241
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_numf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_numf 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/fmaximum_numf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximum_numf, (float x, float y)) {
+  return fputil::fmaximum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_numf128.cpp b/libc/src/math/generic/fmaximum_numf128.cpp
new file mode 100644
index 00000000000000..8cbbc995b877a1
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_numf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximum_numf128 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/fmaximum_numf128.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float128, fmaximum_numf128, (float128 x, float128 y)) {
+  return fputil::fmaximum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximum_numl.cpp b/libc/src/math/generic/fmaximum_numl.cpp
new file mode 100644
index 00000000000000..18518947c869a4
--- /dev/null
+++ b/libc/src/math/generic/fmaximum_numl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fmaximum_numl 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/fmaximum_numl.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fmaximum_numl, (long double x, long double y)) {
+  return fputil::fmaximum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
+
diff --git a/libc/src/math/generic/fmaximumf.cpp b/libc/src/math/generic/fmaximumf.cpp
new file mode 100644
index 00000000000000..c3782ee8654193
--- /dev/null
+++ b/libc/src/math/generic/fmaximumf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximumf 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/fmaximumf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximumf, (float x, float y)) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximumf128.cpp b/libc/src/math/generic/fmaximumf128.cpp
new file mode 100644
index 00000000000000..5e59144bae87fa
--- /dev/null
+++ b/libc/src/math/generic/fmaximumf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fmaximumf128 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/fmaximumf128.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float128, fmaximumf128, (float128 x, float128 y)) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fmaximuml.cpp b/libc/src/math/generic/fmaximuml.cpp
new file mode 100644
index 00000000000000..94a61f2b3ab494
--- /dev/null
+++ b/libc/src/math/generic/fmaximuml.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fmaximuml 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/fmaximuml.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fmaximuml, (long double x, long double y)) {
+  return fputil::fmaximum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
+
diff --git a/libc/src/math/generic/fminimum.cpp b/libc/src/math/generic/fminimum.cpp
new file mode 100644
index 00000000000000..7d11f5bb616cfc
--- /dev/null
+++ b/libc/src/math/generic/fminimum.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum 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/fminimum.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum, (double x, double y)) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_mag.cpp b/libc/src/math/generic/fminimum_mag.cpp
new file mode 100644
index 00000000000000..f952edca6025dd
--- /dev/null
+++ b/libc/src/math/generic/fminimum_mag.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_mag 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/fminimum_mag.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum_mag, (double x, double y)) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_mag_num.cpp b/libc/src/math/generic/fminimum_mag_num.cpp
new file mode 100644
index 00000000000000..1afb6239371a5c
--- /dev/null
+++ b/libc/src/math/generic/fminimum_mag_num.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_mag_num 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/fminimum_mag_num.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum_mag_num, (double x, double y)) {
+  return fputil::fminimum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_mag_numf.cpp b/libc/src/math/generic/fminimum_mag_numf.cpp
new file mode 100644
index 00000000000000..660578de3ef958
--- /dev/null
+++ b/libc/src/math/generic/fminimum_mag_numf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_mag_numf 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/fminimum_mag_numf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fminimum_mag_numf, (float x, float y)) {
+  return fputil::fminimum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_mag_numf128.cpp b/libc/src/math/generic/fminimum_mag_numf128.cpp
new file mode 100644
index 00000000000000..911ce5a4cff7c7
--- /dev/null
+++ b/libc/src/math/generic/fminimum_mag_numf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_mag_numf128 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/fminimum_mag_numf128.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float128, fminimum_mag_numf128, (float128 x, float128 y)) {
+  return fputil::fminimum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_mag_numl.cpp b/libc/src/math/generic/fminimum_mag_numl.cpp
new file mode 100644
index 00000000000000..81e1e2db0f0e38
--- /dev/null
+++ b/libc/src/math/generic/fminimum_mag_numl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fminimum_mag_numl 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/fminimum_mag_numl.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fminimum_mag_numl, (long double x, long double y)) {
+  return fputil::fminimum_mag_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
+
diff --git a/libc/src/math/generic/fminimum_magf.cpp b/libc/src/math/generic/fminimum_magf.cpp
new file mode 100644
index 00000000000000..32f128eaafb216
--- /dev/null
+++ b/libc/src/math/generic/fminimum_magf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_magf 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/fminimum_magf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fminimum_magf, (float x, float y)) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_magf128.cpp b/libc/src/math/generic/fminimum_magf128.cpp
new file mode 100644
index 00000000000000..32488880a224c9
--- /dev/null
+++ b/libc/src/math/generic/fminimum_magf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_magf128 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/fminimum_magf128.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float128, fminimum_magf128, (float128 x, float128 y)) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_magl.cpp b/libc/src/math/generic/fminimum_magl.cpp
new file mode 100644
index 00000000000000..9c9f3e5d249098
--- /dev/null
+++ b/libc/src/math/generic/fminimum_magl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fminimum_magl 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/fminimum_magl.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fminimum_magl, (long double x, long double y)) {
+  return fputil::fminimum_mag(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
+
diff --git a/libc/src/math/generic/fminimum_num.cpp b/libc/src/math/generic/fminimum_num.cpp
new file mode 100644
index 00000000000000..0f0651b621454f
--- /dev/null
+++ b/libc/src/math/generic/fminimum_num.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_num 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/fminimum_num.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fminimum_num, (double x, double y)) {
+  return fputil::fminimum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_numf.cpp b/libc/src/math/generic/fminimum_numf.cpp
new file mode 100644
index 00000000000000..cc4d1b48336d83
--- /dev/null
+++ b/libc/src/math/generic/fminimum_numf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_numf 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/fminimum_numf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fminimum_numf, (float x, float y)) {
+  return fputil::fminimum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_numf128.cpp b/libc/src/math/generic/fminimum_numf128.cpp
new file mode 100644
index 00000000000000..de2a7584a170f8
--- /dev/null
+++ b/libc/src/math/generic/fminimum_numf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimum_numf128 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/fminimum_numf128.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float128, fminimum_numf128, (float128 x, float128 y)) {
+  return fputil::fminimum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimum_numl.cpp b/libc/src/math/generic/fminimum_numl.cpp
new file mode 100644
index 00000000000000..d60468b59e94d7
--- /dev/null
+++ b/libc/src/math/generic/fminimum_numl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fminimum_numl 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/fminimum_numl.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fminimum_numl, (long double x, long double y)) {
+  return fputil::fminimum_num(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
+
diff --git a/libc/src/math/generic/fminimumf.cpp b/libc/src/math/generic/fminimumf.cpp
new file mode 100644
index 00000000000000..ec65a64504694f
--- /dev/null
+++ b/libc/src/math/generic/fminimumf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimumf 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/fminimumf.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fminimumf, (float x, float y)) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimumf128.cpp b/libc/src/math/generic/fminimumf128.cpp
new file mode 100644
index 00000000000000..198428a4432a31
--- /dev/null
+++ b/libc/src/math/generic/fminimumf128.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of fminimumf128 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/fminimumf128.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float128, fminimumf128, (float128 x, float128 y)) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/fminimuml.cpp b/libc/src/math/generic/fminimuml.cpp
new file mode 100644
index 00000000000000..cc9da63c1b01c4
--- /dev/null
+++ b/libc/src/math/generic/fminimuml.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of fminimuml 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/fminimuml.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(long double, fminimuml, (long double x, long double y)) {
+  return fputil::fminimum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
+
diff --git a/libc/src/math/nvptx/fmaximum.cpp b/libc/src/math/nvptx/fmaximum.cpp
new file mode 100644
index 00000000000000..30dbc0e3e4653a
--- /dev/null
+++ b/libc/src/math/nvptx/fmaximum.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the fmaximum function for GPU -----------------------===//
+//
+// 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/fmaximum.h"
+
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(double, fmaximum, (double x, double y)) {
+  return __builtin_fmaximum(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/nvptx/fmaximumf.cpp b/libc/src/math/nvptx/fmaximumf.cpp
new file mode 100644
index 00000000000000..1e9b54bf5771ff
--- /dev/null
+++ b/libc/src/math/nvptx/fmaximumf.cpp
@@ -0,0 +1,21 @@
+//===-- Implementation of the fmaximumf function for GPU ----------------------===//
+//
+// 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/fmaximumf.h"
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float, fmaximumf, (float x, float y)) {
+  return __builtin_fmaximumf(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 85dacce3b21dca..674be9e76b66f0 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -1285,6 +1285,424 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
+add_fp_unittest(
+  fmaximuml_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximuml_test.cpp
+  HDRS
+    FMaximumTest.h
+  DEPENDS
+    libc.src.math.fmaximuml
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximumf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximumf128_test.cpp
+  HDRS
+    FMaximumTest.h
+  DEPENDS
+    libc.src.math.fmaximumf128
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_test.cpp
+  HDRS
+    FMaximumTest.h
+  DEPENDS
+    libc.src.math.fmaximum
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximumf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximumf_test.cpp
+  HDRS
+    FMaximumTest.h
+  DEPENDS
+    libc.src.math.fmaximumf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_numf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_numf_test.cpp
+  HDRS
+    FMaximumNumTest.h
+  DEPENDS
+    libc.src.math.fmaximum_numf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_num_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_num_test.cpp
+  HDRS
+    FMaximumNumTest.h
+  DEPENDS
+    libc.src.math.fmaximum_num
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_numl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_numl_test.cpp
+  HDRS
+    FMaximumNumTest.h
+  DEPENDS
+    libc.src.math.fmaximum_numl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_numf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_numf128_test.cpp
+  HDRS
+    FMaximumNumTest.h
+  DEPENDS
+    libc.src.math.fmaximum_numf128
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_magf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_magf_test.cpp
+  HDRS
+    FMaximumMagTest.h
+  DEPENDS
+    libc.src.math.fmaximum_magf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_mag_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_mag_test.cpp
+  HDRS
+    FMaximumMagTest.h
+  DEPENDS
+    libc.src.math.fmaximum_mag
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_magl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_magl_test.cpp
+  HDRS
+    FMaximumMagTest.h
+  DEPENDS
+    libc.src.math.fmaximum_magl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_magf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_magf128_test.cpp
+  HDRS
+    FMaximumMagTest.h
+  DEPENDS
+    libc.src.math.fmaximum_magf128
+    libc.src.__support.FPUtil.fp_bits
+)
+
+
+add_fp_unittest(
+  fmaximum_mag_numf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_mag_numf_test.cpp
+  HDRS
+    FMaximumMagNumTest.h
+  DEPENDS
+    libc.src.math.fmaximum_mag_numf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_mag_num_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_mag_num_test.cpp
+  HDRS
+    FMaximumMagNumTest.h
+  DEPENDS
+    libc.src.math.fmaximum_mag_num
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_mag_numl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_mag_numl_test.cpp
+  HDRS
+    FMaximumMagNumTest.h
+  DEPENDS
+    libc.src.math.fmaximum_mag_numl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fmaximum_mag_numf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fmaximum_mag_numf128_test.cpp
+  HDRS
+    FMaximumMagNumTest.h
+  DEPENDS
+    libc.src.math.fmaximum_mag_numf128
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimuml_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimuml_test.cpp
+  HDRS
+    FMinimumTest.h
+  DEPENDS
+    libc.src.math.fminimuml
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimumf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimumf128_test.cpp
+  HDRS
+    FMinimumTest.h
+  DEPENDS
+    libc.src.math.fminimumf128
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_test.cpp
+  HDRS
+    FMinimumTest.h
+  DEPENDS
+    libc.src.math.fminimum
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimumf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimumf_test.cpp
+  HDRS
+    FMinimumTest.h
+  DEPENDS
+    libc.src.math.fminimumf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_numf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_numf_test.cpp
+  HDRS
+    FMinimumNumTest.h
+  DEPENDS
+    libc.src.math.fminimum_numf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_num_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_num_test.cpp
+  HDRS
+    FMinimumNumTest.h
+  DEPENDS
+    libc.src.math.fminimum_num
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_numl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_numl_test.cpp
+  HDRS
+    FMinimumNumTest.h
+  DEPENDS
+    libc.src.math.fminimum_numl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_numf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_numf128_test.cpp
+  HDRS
+    FMinimumNumTest.h
+  DEPENDS
+    libc.src.math.fminimum_numf128
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_magf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_magf_test.cpp
+  HDRS
+    FMinimumMagTest.h
+  DEPENDS
+    libc.src.math.fminimum_magf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_mag_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_mag_test.cpp
+  HDRS
+    FMinimumMagTest.h
+  DEPENDS
+    libc.src.math.fminimum_mag
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_magl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_magl_test.cpp
+  HDRS
+    FMinimumMagTest.h
+  DEPENDS
+    libc.src.math.fminimum_magl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_magf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_magf128_test.cpp
+  HDRS
+    FMinimumMagTest.h
+  DEPENDS
+    libc.src.math.fminimum_magf128
+    libc.src.__support.FPUtil.fp_bits
+)
+
+
+add_fp_unittest(
+  fminimum_mag_numf_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_mag_numf_test.cpp
+  HDRS
+    FMinimumMagNumTest.h
+  DEPENDS
+    libc.src.math.fminimum_mag_numf
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_mag_num_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_mag_num_test.cpp
+  HDRS
+    FMinimumMagNumTest.h
+  DEPENDS
+    libc.src.math.fminimum_mag_num
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_mag_numl_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_mag_numl_test.cpp
+  HDRS
+    FMinimumMagNumTest.h
+  DEPENDS
+    libc.src.math.fminimum_mag_numl
+    libc.src.__support.FPUtil.fp_bits
+)
+
+add_fp_unittest(
+  fminimum_mag_numf128_test
+  SUITE
+    libc-math-smoke-tests
+  SRCS
+    fminimum_mag_numf128_test.cpp
+  HDRS
+    FMinimumMagNumTest.h
+  DEPENDS
+    libc.src.math.fminimum_mag_numf128
+    libc.src.__support.FPUtil.fp_bits
+)
+
 add_fp_unittest(
   sqrtf_test
   SUITE
diff --git a/libc/test/src/math/smoke/FMaxTest.h b/libc/test/src/math/smoke/FMaxTest.h
index 98fae06ee2a0fd..b8781a85d10f4f 100644
--- a/libc/test/src/math/smoke/FMaxTest.h
+++ b/libc/test/src/math/smoke/FMaxTest.h
@@ -1,4 +1,4 @@
-//===-- Utility class to test fmin[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fmax[f|l] -------------------------*- 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/test/src/math/smoke/FMaximumMagNumTest.h b/libc/test/src/math/smoke/FMaximumMagNumTest.h
new file mode 100644
index 00000000000000..ec08afe5ba10cd
--- /dev/null
+++ b/libc/test/src/math/smoke/FMaximumMagNumTest.h
@@ -0,0 +1,88 @@
+//===-- Utility class to test fmaximum_mag_num[f|l] -------------------------*- 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_TEST_SRC_MATH_SMOKE_FMAXIMUMMAG_NUMTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMMAG_NUMTEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+
+template <typename T> class FMaximumMagNumTest : public LIBC_NAMESPACE::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMaximumMagNumFunc)(T, T);
+
+  void testNaN(FMaximumMagNumFunc func) {
+    EXPECT_FP_EQ(inf, func(aNaN, inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
+    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMaximumMagNumFunc func) {
+    EXPECT_FP_EQ(inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(inf, func(inf, 0.0));
+    EXPECT_FP_EQ(inf, func(-0.0, inf));
+    EXPECT_FP_EQ(inf, func(inf, T(1.2345)));
+    EXPECT_FP_EQ(inf, func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMaximumMagNumFunc func) {
+    EXPECT_FP_EQ(inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(neg_inf, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(neg_inf, func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMaximumMagNumFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMaximumMagNumFunc func) {
+    constexpr StorageType COUNT = 100'001;
+    constexpr StorageType STEP = STORAGE_MAX / COUNT;
+    for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      FPBits xbits(v), ybits(w);
+      if (xbits.is_inf_or_nan())
+        continue;
+      if (ybits.is_inf_or_nan())
+        continue;
+      T x = xbits.get_val();
+      T y = ybits.get_val();
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (abs(x) > abs(y)) {
+        EXPECT_FP_EQ(x, func(x, y));
+      } else {
+        EXPECT_FP_EQ(y, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMAXIMUM_MAG_NUM_TESTS(T, func)                                               \
+  using LlvmLibcFMaximumMagNumTest = FMaximumMagNumTest<T>;                                        \
+  TEST_F(LlvmLibcFMaximumMagNumTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMaximumMagNumTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMaximumMagNumTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMaximumMagNumTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMaximumMagNumTest, Range) { testRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMMAG_NUMTEST_H
diff --git a/libc/test/src/math/smoke/FMaximumMagTest.h b/libc/test/src/math/smoke/FMaximumMagTest.h
new file mode 100644
index 00000000000000..d8cafc0aa0f067
--- /dev/null
+++ b/libc/test/src/math/smoke/FMaximumMagTest.h
@@ -0,0 +1,88 @@
+//===-- Utility class to test fmaximum_mag[f|l] -------------------------*- 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_TEST_SRC_MATH_SMOKE_FMAXIMUM_MAGTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUM_MAGTEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+
+template <typename T> class FMaximumMagTest : public LIBC_NAMESPACE::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMaximumMagFunc)(T, T);
+
+  void testNaN(FMaximumMagFunc func) {
+    EXPECT_FP_EQ(aNaN, func(aNaN, inf));
+    EXPECT_FP_EQ(aNaN, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, 0.0));
+    EXPECT_FP_EQ(aNaN, func(-0.0, aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(aNaN, func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMaximumMagFunc func) {
+    EXPECT_FP_EQ(inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(inf, func(inf, 0.0));
+    EXPECT_FP_EQ(inf, func(-0.0, inf));
+    EXPECT_FP_EQ(inf, func(inf, T(1.2345)));
+    EXPECT_FP_EQ(inf, func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMaximumMagFunc func) {
+    EXPECT_FP_EQ(inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(neg_inf, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(neg_inf, func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMaximumMagFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMaximumMagFunc func) {
+    constexpr StorageType COUNT = 100'001;
+    constexpr StorageType STEP = STORAGE_MAX / COUNT;
+    for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      FPBits xbits(v), ybits(w);
+      if (xbits.is_inf_or_nan())
+        continue;
+      if (ybits.is_inf_or_nan())
+        continue;
+      T x = xbits.get_val();
+      T y = ybits.get_val();
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (abs(x) > abs(y)) {
+        EXPECT_FP_EQ(x, func(x, y));
+      } else {
+        EXPECT_FP_EQ(y, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMAXIMUM_MAG_TESTS(T, func)                                               \
+  using LlvmLibcFMaximumMagTest = FMaximumMagTest<T>;                                        \
+  TEST_F(LlvmLibcFMaximumMagTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMaximumMagTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMaximumMagTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMaximumMagTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMaximumMagTest, Range) { testRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUM_MAGTEST_H
diff --git a/libc/test/src/math/smoke/FMaximumNumTest.h b/libc/test/src/math/smoke/FMaximumNumTest.h
new file mode 100644
index 00000000000000..3ca6c179043a1b
--- /dev/null
+++ b/libc/test/src/math/smoke/FMaximumNumTest.h
@@ -0,0 +1,87 @@
+//===-- Utility class to test fmaximum_num[f|l] -------------------------*- 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_TEST_SRC_MATH_SMOKE_FMAXIMUMNUMTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMNUMTEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename T> class FMaximumNumTest : public LIBC_NAMESPACE::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMaximumNumFunc)(T, T);
+
+  void testNaN(FMaximumNumFunc func) {
+    EXPECT_FP_EQ(inf, func(aNaN, inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
+    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMaximumNumFunc func) {
+    EXPECT_FP_EQ(inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(inf, func(inf, 0.0));
+    EXPECT_FP_EQ(inf, func(-0.0, inf));
+    EXPECT_FP_EQ(inf, func(inf, T(1.2345)));
+    EXPECT_FP_EQ(inf, func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMaximumNumFunc func) {
+    EXPECT_FP_EQ(inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(0.0, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(T(-1.2345), func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMaximumNumFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMaximumNumFunc func) {
+    constexpr StorageType COUNT = 100'001;
+    constexpr StorageType STEP = STORAGE_MAX/ COUNT;
+    for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      FPBits xbits(v), ybits(w);
+      if (xbits.is_inf_or_nan())
+        continue;
+      if (ybits.is_inf_or_nan())
+        continue;
+      T x = xbits.get_val();
+      T y = ybits.get_val();
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (x > y) {
+        EXPECT_FP_EQ(x, func(x, y));
+      } else {
+        EXPECT_FP_EQ(y, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMAXIMUM_NUM_TESTS(T, func)                                               \
+  using LlvmLibcFMaximumNumTest = FMaximumNumTest<T>;                                        \
+  TEST_F(LlvmLibcFMaximumNumTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMaximumNumTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMaximumNumTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMaximumNumTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMaximumNumTest, Range) { testRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMNUMTEST_H
diff --git a/libc/test/src/math/smoke/FMaximumTest.h b/libc/test/src/math/smoke/FMaximumTest.h
new file mode 100644
index 00000000000000..7ba1173907a2fe
--- /dev/null
+++ b/libc/test/src/math/smoke/FMaximumTest.h
@@ -0,0 +1,87 @@
+//===-- Utility class to test fmaximum[f|l] -------------------------*- 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_TEST_SRC_MATH_SMOKE_FMAXIMUMTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMTEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename T> class FMaximumTest : public LIBC_NAMESPACE::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMaximumFunc)(T, T);
+
+  void testNaN(FMaximumFunc func) {
+    EXPECT_FP_EQ(aNaN, func(aNaN, inf));
+    EXPECT_FP_EQ(aNaN, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, 0.0));
+    EXPECT_FP_EQ(aNaN, func(-0.0, aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(aNaN, func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMaximumFunc func) {
+    EXPECT_FP_EQ(inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(inf, func(inf, 0.0));
+    EXPECT_FP_EQ(inf, func(-0.0, inf));
+    EXPECT_FP_EQ(inf, func(inf, T(1.2345)));
+    EXPECT_FP_EQ(inf, func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMaximumFunc func) {
+    EXPECT_FP_EQ(inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(0.0, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(T(-1.2345), func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMaximumFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMaximumFunc func) {
+    constexpr StorageType COUNT = 100'001;
+    constexpr StorageType STEP = STORAGE_MAX / COUNT;
+    for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      FPBits xbits(v), ybits(w);
+      if (xbits.is_inf_or_nan())
+        continue;
+      if (ybits.is_inf_or_nan())
+        continue;
+      T x = xbits.get_val();
+      T y = ybits.get_val();
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (x > y) {
+        EXPECT_FP_EQ(x, func(x, y));
+      } else {
+        EXPECT_FP_EQ(y, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMAXIMUM_TESTS(T, func)                                               \
+  using LlvmLibcFMaximumTest = FMaximumTest<T>;                                        \
+  TEST_F(LlvmLibcFMaximumTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMaximumTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMaximumTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMaximumTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMaximumTest, Range) { testRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMTEST_H
diff --git a/libc/test/src/math/smoke/FMinimumMagNumTest.h b/libc/test/src/math/smoke/FMinimumMagNumTest.h
new file mode 100644
index 00000000000000..e8af72c90684b7
--- /dev/null
+++ b/libc/test/src/math/smoke/FMinimumMagNumTest.h
@@ -0,0 +1,88 @@
+//===-- Utility class to test fminimum_mag_num[f|l] -------------------------*- 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_TEST_SRC_MATH_SMOKE_FMINIMUMMAG_NUMTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMMAG_NUMTEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+
+template <typename T> class FMinimumMagNumTest : public LIBC_NAMESPACE::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMinimumMagNumFunc)(T, T);
+
+  void testNaN(FMinimumMagNumFunc func) {
+    EXPECT_FP_EQ(inf, func(aNaN, inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
+    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMinimumMagNumFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(0.0, func(inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, inf));
+    EXPECT_FP_EQ(T(1.2345), func(inf, T(1.2345)));
+    EXPECT_FP_EQ(T(-1.2345), func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMinimumMagNumFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(0.0, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(T(-1.2345), func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMinimumMagNumFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMinimumMagNumFunc func) {
+    constexpr StorageType COUNT = 100'001;
+    constexpr StorageType STEP = STORAGE_MAX / COUNT;
+    for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      FPBits xbits(v), ybits(w);
+      if (xbits.is_inf_or_nan())
+        continue;
+      if (ybits.is_inf_or_nan())
+        continue;
+      T x = xbits.get_val();
+      T y = ybits.get_val();
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (abs(x) < abs(y)) {
+        EXPECT_FP_EQ(x, func(x, y));
+      } else {
+        EXPECT_FP_EQ(y, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMINIMUM_MAG_NUM_TESTS(T, func)                                               \
+  using LlvmLibcFMinimumMagNumTest = FMinimumMagNumTest<T>;                                        \
+  TEST_F(LlvmLibcFMinimumMagNumTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMinimumMagNumTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMinimumMagNumTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMinimumMagNumTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMinimumMagNumTest, Range) { testRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMMAG_NUMTEST_H
diff --git a/libc/test/src/math/smoke/FMinimumMagTest.h b/libc/test/src/math/smoke/FMinimumMagTest.h
new file mode 100644
index 00000000000000..5cbe2685b458d3
--- /dev/null
+++ b/libc/test/src/math/smoke/FMinimumMagTest.h
@@ -0,0 +1,88 @@
+//===-- Utility class to test fminimum_mag[f|l] -------------------------*- 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_TEST_SRC_MATH_SMOKE_FMINIMUM_MAGTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUM_MAGTEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+
+template <typename T> class FMinimumMagTest : public LIBC_NAMESPACE::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMinimumMagFunc)(T, T);
+
+  void testNaN(FMinimumMagFunc func) {
+    EXPECT_FP_EQ(aNaN, func(aNaN, inf));
+    EXPECT_FP_EQ(aNaN, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, 0.0));
+    EXPECT_FP_EQ(aNaN, func(-0.0, aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(aNaN, func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMinimumMagFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(0.0, func(inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, inf));
+    EXPECT_FP_EQ(T(1.2345), func(inf, T(1.2345)));
+    EXPECT_FP_EQ(T(-1.2345), func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMinimumMagFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(0.0, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(T(-1.2345), func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMinimumMagFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMinimumMagFunc func) {
+    constexpr StorageType COUNT = 100'001;
+    constexpr StorageType STEP = STORAGE_MAX / COUNT;
+    for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      FPBits xbits(v), ybits(w);
+      if (xbits.is_inf_or_nan())
+        continue;
+      if (ybits.is_inf_or_nan())
+        continue;
+      T x = xbits.get_val();
+      T y = ybits.get_val();
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (abs(x) < abs(y)) {
+        EXPECT_FP_EQ(x, func(x, y));
+      } else {
+        EXPECT_FP_EQ(y, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMINIMUM_MAG_TESTS(T, func)                                               \
+  using LlvmLibcFMinimumMagTest = FMinimumMagTest<T>;                                        \
+  TEST_F(LlvmLibcFMinimumMagTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMinimumMagTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMinimumMagTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMinimumMagTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMinimumMagTest, Range) { testRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUM_MAGTEST_H
diff --git a/libc/test/src/math/smoke/FMinimumNumTest.h b/libc/test/src/math/smoke/FMinimumNumTest.h
new file mode 100644
index 00000000000000..d73d4838a935e7
--- /dev/null
+++ b/libc/test/src/math/smoke/FMinimumNumTest.h
@@ -0,0 +1,87 @@
+//===-- Utility class to test fminimum_num[f|l] -------------------------*- 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_TEST_SRC_MATH_SMOKE_FMINIMUMNUMTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMNUMTEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename T> class FMinimumNumTest : public LIBC_NAMESPACE::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMinimumNumFunc)(T, T);
+
+  void testNaN(FMinimumNumFunc func) {
+    EXPECT_FP_EQ(inf, func(aNaN, inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
+    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMinimumNumFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(0.0, func(inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, inf));
+    EXPECT_FP_EQ(T(1.2345), func(inf, T(1.2345)));
+    EXPECT_FP_EQ(T(-1.2345), func(T(-1.2345), inf));
+  }
+
+  void testNegInfArg(FMinimumNumFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(neg_inf, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(neg_inf, func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMinimumNumFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMinimumNumFunc func) {
+    constexpr StorageType COUNT = 100'001;
+    constexpr StorageType STEP = STORAGE_MAX/ COUNT;
+    for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      FPBits xbits(v), ybits(w);
+      if (xbits.is_inf_or_nan())
+        continue;
+      if (ybits.is_inf_or_nan())
+        continue;
+      T x = xbits.get_val();
+      T y = ybits.get_val();
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (x > y) {
+        EXPECT_FP_EQ(y, func(x, y));
+      } else {
+        EXPECT_FP_EQ(x, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMINIMUM_NUM_TESTS(T, func)                                               \
+  using LlvmLibcFMinimumNumTest = FMinimumNumTest<T>;                                        \
+  TEST_F(LlvmLibcFMinimumNumTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMinimumNumTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMinimumNumTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMinimumNumTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMinimumNumTest, Range) { testRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMNUMTEST_H
diff --git a/libc/test/src/math/smoke/FMinimumTest.h b/libc/test/src/math/smoke/FMinimumTest.h
new file mode 100644
index 00000000000000..91e1fb9d580afe
--- /dev/null
+++ b/libc/test/src/math/smoke/FMinimumTest.h
@@ -0,0 +1,87 @@
+//===-- Utility class to test fminimum[f|l] -------------------------*- 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_TEST_SRC_MATH_SMOKE_FMINIMUMTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMTEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename T> class FMinimumTest : public LIBC_NAMESPACE::testing::Test {
+
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef T (*FMinimumFunc)(T, T);
+
+  void testNaN(FMinimumFunc func) {
+    EXPECT_FP_EQ(aNaN, func(aNaN, inf));
+    EXPECT_FP_EQ(aNaN, func(neg_inf, aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, 0.0));
+    EXPECT_FP_EQ(aNaN, func(-0.0, aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, T(-1.2345)));
+    EXPECT_FP_EQ(aNaN, func(T(1.2345), aNaN));
+    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+  }
+
+  void testInfArg(FMinimumFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, inf));
+    EXPECT_FP_EQ(0.0, func(inf, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, inf));
+    EXPECT_FP_EQ(T(1.2345), func(inf, T(1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), inf));
+  }
+
+  void testNegInfArg(FMinimumFunc func) {
+    EXPECT_FP_EQ(neg_inf, func(inf, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, 0.0));
+    EXPECT_FP_EQ(neg_inf, func(-0.0, neg_inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, T(-1.2345)));
+    EXPECT_FP_EQ(neg_inf, func(T(1.2345), neg_inf));
+  }
+
+  void testBothZero(FMinimumFunc func) {
+    EXPECT_FP_EQ(0.0, func(0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, 0.0));
+    EXPECT_FP_EQ(-0.0, func(0.0, -0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, -0.0));
+  }
+
+  void testRange(FMinimumFunc func) {
+    constexpr StorageType COUNT = 100'001;
+    constexpr StorageType STEP = STORAGE_MAX / COUNT;
+    for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
+         ++i, v += STEP, w -= STEP) {
+      FPBits xbits(v), ybits(w);
+      if (xbits.is_inf_or_nan())
+        continue;
+      if (ybits.is_inf_or_nan())
+        continue;
+      T x = xbits.get_val();
+      T y = ybits.get_val();
+      if ((x == 0) && (y == 0))
+        continue;
+
+      if (x > y) {
+        EXPECT_FP_EQ(y, func(x, y));
+      } else {
+        EXPECT_FP_EQ(x, func(x, y));
+      }
+    }
+  }
+};
+
+#define LIST_FMINIMUM_TESTS(T, func)                                               \
+  using LlvmLibcFMinimumTest = FMinimumTest<T>;                                        \
+  TEST_F(LlvmLibcFMinimumTest, NaN) { testNaN(&func); }                            \
+  TEST_F(LlvmLibcFMinimumTest, InfArg) { testInfArg(&func); }                      \
+  TEST_F(LlvmLibcFMinimumTest, NegInfArg) { testNegInfArg(&func); }                \
+  TEST_F(LlvmLibcFMinimumTest, BothZero) { testBothZero(&func); }                  \
+  TEST_F(LlvmLibcFMinimumTest, Range) { testRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMTEST_H
diff --git a/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
new file mode 100644
index 00000000000000..7db8c69caa1418
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_mag_num -----------------------------------------------===//
+//
+// 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 "FMaximumMagNumTest.h"
+
+#include "src/math/fmaximum_mag_num.h"
+
+LIST_FMAXIMUM_MAG_NUM_TESTS(double, LIBC_NAMESPACE::fmaximum_mag_num)
diff --git a/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
new file mode 100644
index 00000000000000..5fd0beccee43c7
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_mag_numf128 --------------------------------------------===//
+//
+// 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 "FMaximumMag_NumTest.h"
+
+#include "src/math/fmaximum_mag_numf128.h"
+
+LIST_FMAXIMUM_MAG_NUM_TESTS(float128, LIBC_NAMESPACE::fmaximum_mag_numf128)
diff --git a/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
new file mode 100644
index 00000000000000..2eaa0d5110a519
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_mag_numf -----------------------------------------------===//
+//
+// 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 "FMaximumMagNumTest.h"
+
+#include "src/math/fmaximum_mag_numf.h"
+
+LIST_FMAXIMUM_MAG_NUM_TESTS(float, LIBC_NAMESPACE::fmaximum_mag_numf)
diff --git a/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
new file mode 100644
index 00000000000000..687abbf5db40a0
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_mag_numl -----------------------------------------------===//
+//
+// 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 "FMaximumMagNumTest.h"
+
+#include "src/math/fmaximum_mag_numl.h"
+
+LIST_FMAXIMUM_MAG_NUM_TESTS(long double, LIBC_NAMESPACE::fmaximum_mag_numl)
diff --git a/libc/test/src/math/smoke/fmaximum_mag_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_test.cpp
new file mode 100644
index 00000000000000..5968ebb5f938b9
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_mag_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_mag -----------------------------------------------===//
+//
+// 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 "FMaximumMagTest.h"
+
+#include "src/math/fmaximum_mag.h"
+
+LIST_FMAXIMUM_MAG_TESTS(double, LIBC_NAMESPACE::fmaximum_mag)
diff --git a/libc/test/src/math/smoke/fmaximum_magf128_test.cpp b/libc/test/src/math/smoke/fmaximum_magf128_test.cpp
new file mode 100644
index 00000000000000..7c93c94cbedfff
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_magf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_magf128 --------------------------------------------===//
+//
+// 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 "FMaximumMagTest.h"
+
+#include "src/math/fmaximum_magf128.h"
+
+LIST_FMAXIMUM_MAG_TESTS(float128, LIBC_NAMESPACE::fmaximum_magf128)
diff --git a/libc/test/src/math/smoke/fmaximum_magf_test.cpp b/libc/test/src/math/smoke/fmaximum_magf_test.cpp
new file mode 100644
index 00000000000000..8347c4a443b99b
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_magf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_magf -----------------------------------------------===//
+//
+// 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 "FMaximumMagTest.h"
+
+#include "src/math/fmaximum_magf.h"
+
+LIST_FMAXIMUM_MAG_TESTS(float, LIBC_NAMESPACE::fmaximum_magf)
diff --git a/libc/test/src/math/smoke/fmaximum_magl_test.cpp b/libc/test/src/math/smoke/fmaximum_magl_test.cpp
new file mode 100644
index 00000000000000..21224514cb9dff
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_magl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_magl -----------------------------------------------===//
+//
+// 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 "FMaximumMagTest.h"
+
+#include "src/math/fmaximum_magl.h"
+
+LIST_FMAXIMUM_MAG_TESTS(long double, LIBC_NAMESPACE::fmaximum_magl)
diff --git a/libc/test/src/math/smoke/fmaximum_num_test.cpp b/libc/test/src/math/smoke/fmaximum_num_test.cpp
new file mode 100644
index 00000000000000..d50cf32bcdc257
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_num_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_num -----------------------------------------------===//
+//
+// 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 "FMaximumNumTest.h"
+
+#include "src/math/fmaximum_num.h"
+
+LIST_FMAXIMUM_NUM_TESTS(double, LIBC_NAMESPACE::fmaximum_num)
diff --git a/libc/test/src/math/smoke/fmaximum_numf128_test.cpp b/libc/test/src/math/smoke/fmaximum_numf128_test.cpp
new file mode 100644
index 00000000000000..d15b2b9b966ca9
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_numf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_numf128 --------------------------------------------===//
+//
+// 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 "FMaximumNumTest.h"
+
+#include "src/math/fmaximum_numf128.h"
+
+LIST_FMAXIMUM_NUM_TESTS(float128, LIBC_NAMESPACE::fmaximum_numf128)
diff --git a/libc/test/src/math/smoke/fmaximum_numf_test.cpp b/libc/test/src/math/smoke/fmaximum_numf_test.cpp
new file mode 100644
index 00000000000000..98595ed1df4355
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_numf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_numf -----------------------------------------------===//
+//
+// 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 "FMaximumNumTest.h"
+
+#include "src/math/fmaximum_numf.h"
+
+LIST_FMAXIMUM_NUM_TESTS(float, LIBC_NAMESPACE::fmaximum_numf)
diff --git a/libc/test/src/math/smoke/fmaximum_numl_test.cpp b/libc/test/src/math/smoke/fmaximum_numl_test.cpp
new file mode 100644
index 00000000000000..0f73981d2096e8
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_numl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum_numl -----------------------------------------------===//
+//
+// 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 "FMaximumNumTest.h"
+
+#include "src/math/fmaximum_numl.h"
+
+LIST_FMAXIMUM_NUM_TESTS(long double, LIBC_NAMESPACE::fmaximum_numl)
diff --git a/libc/test/src/math/smoke/fmaximum_test.cpp b/libc/test/src/math/smoke/fmaximum_test.cpp
new file mode 100644
index 00000000000000..21be2023e1b4b1
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximum_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximum -----------------------------------------------===//
+//
+// 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 "FMaximumTest.h"
+
+#include "src/math/fmaximum.h"
+
+LIST_FMAXIMUM_TESTS(double, LIBC_NAMESPACE::fmaximum)
diff --git a/libc/test/src/math/smoke/fmaximumf128_test.cpp b/libc/test/src/math/smoke/fmaximumf128_test.cpp
new file mode 100644
index 00000000000000..040c6ee6291f80
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximumf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximumf128 --------------------------------------------===//
+//
+// 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 "FMaximumTest.h"
+
+#include "src/math/fmaximumf128.h"
+
+LIST_FMAXIMUM_TESTS(float128, LIBC_NAMESPACE::fmaximumf128)
diff --git a/libc/test/src/math/smoke/fmaximumf_test.cpp b/libc/test/src/math/smoke/fmaximumf_test.cpp
new file mode 100644
index 00000000000000..5ea2efa0b7ce5b
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximumf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximumf -----------------------------------------------===//
+//
+// 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 "FMaximumTest.h"
+
+#include "src/math/fmaximumf.h"
+
+LIST_FMAXIMUM_TESTS(float, LIBC_NAMESPACE::fmaximumf)
diff --git a/libc/test/src/math/smoke/fmaximuml_test.cpp b/libc/test/src/math/smoke/fmaximuml_test.cpp
new file mode 100644
index 00000000000000..fd780c2719603d
--- /dev/null
+++ b/libc/test/src/math/smoke/fmaximuml_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmaximuml -----------------------------------------------===//
+//
+// 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 "FMaximumTest.h"
+
+#include "src/math/fmaximuml.h"
+
+LIST_FMAXIMUM_TESTS(long double, LIBC_NAMESPACE::fmaximuml)
diff --git a/libc/test/src/math/smoke/fminimum_mag_num_test.cpp b/libc/test/src/math/smoke/fminimum_mag_num_test.cpp
new file mode 100644
index 00000000000000..e3b8de746b271c
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_mag_num_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_mag_num -----------------------------------------------===//
+//
+// 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 "FMinimumMagNumTest.h"
+
+#include "src/math/fminimum_mag_num.h"
+
+LIST_FMINIMUM_MAG_NUM_TESTS(double, LIBC_NAMESPACE::fminimum_mag_num)
diff --git a/libc/test/src/math/smoke/fminimum_mag_numf128.cpp b/libc/test/src/math/smoke/fminimum_mag_numf128.cpp
new file mode 100644
index 00000000000000..752d3ebe99d95f
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_mag_numf128.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_mag_numf128 --------------------------------------------===//
+//
+// 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 "FMinimumMagNumTest.h"
+
+#include "src/math/fminimum_mag_numf128.h"
+
+LIST_FMINIMUM_MAG_NUM_TESTS(float128, LIBC_NAMESPACE::fminimum_mag_numf128)
diff --git a/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp b/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
new file mode 100644
index 00000000000000..ffb0086e85d398
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_mag_numf -----------------------------------------------===//
+//
+// 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 "FMinimumMagNumTest.h"
+
+#include "src/math/fminimum_mag_numf.h"
+
+LIST_FMINIMUM_MAG_NUM_TESTS(float, LIBC_NAMESPACE::fminimum_mag_numf)
diff --git a/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp b/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
new file mode 100644
index 00000000000000..e539d8711680a6
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_mag_numl -----------------------------------------------===//
+//
+// 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 "FMinimumMagNumTest.h"
+
+#include "src/math/fminimum_mag_numl.h"
+
+LIST_FMINIMUM_MAG_NUM_TESTS(long double, LIBC_NAMESPACE::fminimum_mag_numl)
diff --git a/libc/test/src/math/smoke/fminimum_mag_test.cpp b/libc/test/src/math/smoke/fminimum_mag_test.cpp
new file mode 100644
index 00000000000000..5c13385a4db734
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_mag_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_mag -----------------------------------------------===//
+//
+// 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 "FMinimumMagTest.h"
+
+#include "src/math/fminimum_mag.h"
+
+LIST_FMINIMUM_MAG_TESTS(double, LIBC_NAMESPACE::fminimum_mag)
diff --git a/libc/test/src/math/smoke/fminimum_magf128_test.cpp b/libc/test/src/math/smoke/fminimum_magf128_test.cpp
new file mode 100644
index 00000000000000..746159c28baa6e
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_magf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_magf128 --------------------------------------------===//
+//
+// 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 "FMinimumMagTest.h"
+
+#include "src/math/fminimum_magf128.h"
+
+LIST_FMINIMUM_MAG_TESTS(float128, LIBC_NAMESPACE::fminimum_magf128)
diff --git a/libc/test/src/math/smoke/fminimum_magf_test.cpp b/libc/test/src/math/smoke/fminimum_magf_test.cpp
new file mode 100644
index 00000000000000..081a36e318046c
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_magf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_magf -----------------------------------------------===//
+//
+// 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 "FMinimumMagTest.h"
+
+#include "src/math/fminimum_magf.h"
+
+LIST_FMINIMUM_MAG_TESTS(float, LIBC_NAMESPACE::fminimum_magf)
diff --git a/libc/test/src/math/smoke/fminimum_magl_test.cpp b/libc/test/src/math/smoke/fminimum_magl_test.cpp
new file mode 100644
index 00000000000000..865bb3ff4f4fd4
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_magl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_magl -----------------------------------------------===//
+//
+// 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 "FMinimumMagTest.h"
+
+#include "src/math/fminimum_magl.h"
+
+LIST_FMINIMUM_MAG_TESTS(long double, LIBC_NAMESPACE::fminimum_magl)
diff --git a/libc/test/src/math/smoke/fminimum_num_test.cpp b/libc/test/src/math/smoke/fminimum_num_test.cpp
new file mode 100644
index 00000000000000..fdeff15624be94
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_num_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_num -----------------------------------------------===//
+//
+// 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 "FMinimumNumTest.h"
+
+#include "src/math/fminimum_num.h"
+
+LIST_FMINIMUM_NUM_TESTS(double, LIBC_NAMESPACE::fminimum_num)
diff --git a/libc/test/src/math/smoke/fminimum_numf128_test.cpp b/libc/test/src/math/smoke/fminimum_numf128_test.cpp
new file mode 100644
index 00000000000000..f61981331c33b0
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_numf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_numf128 --------------------------------------------===//
+//
+// 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 "FMinimumNumTest.h"
+
+#include "src/math/fminimum_numf128.h"
+
+LIST_FMINIMUM_NUM_TESTS(float128, LIBC_NAMESPACE::fminimum_numf128)
diff --git a/libc/test/src/math/smoke/fminimum_numf_test.cpp b/libc/test/src/math/smoke/fminimum_numf_test.cpp
new file mode 100644
index 00000000000000..36929565fb900c
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_numf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_numf -----------------------------------------------===//
+//
+// 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 "FMinimumNumTest.h"
+
+#include "src/math/fminimum_numf.h"
+
+LIST_FMINIMUM_NUM_TESTS(float, LIBC_NAMESPACE::fminimum_numf)
diff --git a/libc/test/src/math/smoke/fminimum_numl_test.cpp b/libc/test/src/math/smoke/fminimum_numl_test.cpp
new file mode 100644
index 00000000000000..5ead7b6af8f1ab
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_numl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum_numl -----------------------------------------------===//
+//
+// 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 "FMinimumNumTest.h"
+
+#include "src/math/fminimum_numl.h"
+
+LIST_FMINIMUM_NUM_TESTS(long double, LIBC_NAMESPACE::fminimum_numl)
diff --git a/libc/test/src/math/smoke/fminimum_test.cpp b/libc/test/src/math/smoke/fminimum_test.cpp
new file mode 100644
index 00000000000000..74366477cde121
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimum_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimum -----------------------------------------------===//
+//
+// 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 "FMinimumTest.h"
+
+#include "src/math/fminimum.h"
+
+LIST_FMINIMUM_TESTS(double, LIBC_NAMESPACE::fminimum)
diff --git a/libc/test/src/math/smoke/fminimumf128_test.cpp b/libc/test/src/math/smoke/fminimumf128_test.cpp
new file mode 100644
index 00000000000000..842e2ef2ad7633
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimumf128_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimumf128 --------------------------------------------===//
+//
+// 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 "FMinimumTest.h"
+
+#include "src/math/fminimumf128.h"
+
+LIST_FMINIMUM_TESTS(float128, LIBC_NAMESPACE::fminimumf128)
diff --git a/libc/test/src/math/smoke/fminimumf_test.cpp b/libc/test/src/math/smoke/fminimumf_test.cpp
new file mode 100644
index 00000000000000..e9817d62b1c692
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimumf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimumf -----------------------------------------------===//
+//
+// 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 "FMinimumTest.h"
+
+#include "src/math/fminimumf.h"
+
+LIST_FMINIMUM_TESTS(float, LIBC_NAMESPACE::fminimumf)
diff --git a/libc/test/src/math/smoke/fminimuml_test.cpp b/libc/test/src/math/smoke/fminimuml_test.cpp
new file mode 100644
index 00000000000000..846b0cc02bae68
--- /dev/null
+++ b/libc/test/src/math/smoke/fminimuml_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fminimuml -----------------------------------------------===//
+//
+// 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 "FMinimumTest.h"
+
+#include "src/math/fminimuml.h"
+
+LIST_FMINIMUM_TESTS(long double, LIBC_NAMESPACE::fminimuml)

>From 1f82128bcec7d8bf45c8d37c13b41f955f6cefab Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Wed, 20 Mar 2024 15:18:25 -0700
Subject: [PATCH 2/9] format code using clang-format

---
 libc/src/__support/FPUtil/BasicOperations.h   | 50 +++++++++----------
 libc/src/math/amdgpu/fmaximum.cpp             |  3 +-
 libc/src/math/amdgpu/fmaximum_mag.cpp         |  3 +-
 libc/src/math/amdgpu/fmaximum_mag_num.cpp     |  3 +-
 libc/src/math/amdgpu/fmaximum_mag_numf.cpp    |  3 +-
 libc/src/math/amdgpu/fmaximum_mag_numl.cpp    |  6 ++-
 libc/src/math/amdgpu/fmaximum_magf.cpp        |  3 +-
 libc/src/math/amdgpu/fmaximum_magl.cpp        |  3 +-
 libc/src/math/amdgpu/fmaximum_num.cpp         |  3 +-
 libc/src/math/amdgpu/fmaximum_numf.cpp        |  3 +-
 libc/src/math/amdgpu/fmaximum_numl.cpp        |  3 +-
 libc/src/math/amdgpu/fmaximumf.cpp            |  3 +-
 libc/src/math/amdgpu/fmaximuml.cpp            |  3 +-
 libc/src/math/amdgpu/fminimum.cpp             |  3 +-
 libc/src/math/amdgpu/fminimum_mag.cpp         |  3 +-
 libc/src/math/amdgpu/fminimum_mag_num.cpp     |  3 +-
 libc/src/math/amdgpu/fminimum_mag_numf.cpp    |  3 +-
 libc/src/math/amdgpu/fminimum_mag_numl.cpp    |  6 ++-
 libc/src/math/amdgpu/fminimum_magf.cpp        |  3 +-
 libc/src/math/amdgpu/fminimum_magl.cpp        |  3 +-
 libc/src/math/amdgpu/fminimum_num.cpp         |  3 +-
 libc/src/math/amdgpu/fminimum_numf.cpp        |  3 +-
 libc/src/math/amdgpu/fminimum_numl.cpp        |  3 +-
 libc/src/math/amdgpu/fminimumf.cpp            |  3 +-
 libc/src/math/amdgpu/fminimuml.cpp            |  3 +-
 libc/src/math/fmaximum.h                      |  3 +-
 libc/src/math/fmaximum_mag.h                  |  3 +-
 libc/src/math/fmaximum_mag_num.h              |  3 +-
 libc/src/math/fmaximum_mag_numf.h             |  3 +-
 libc/src/math/fmaximum_mag_numf128.h          |  3 +-
 libc/src/math/fmaximum_mag_numl.h             |  3 +-
 libc/src/math/fmaximum_magf.h                 |  3 +-
 libc/src/math/fmaximum_magf128.h              |  3 +-
 libc/src/math/fmaximum_magl.h                 |  3 +-
 libc/src/math/fmaximum_num.h                  |  3 +-
 libc/src/math/fmaximum_numf.h                 |  3 +-
 libc/src/math/fmaximum_numf128.h              |  3 +-
 libc/src/math/fmaximum_numl.h                 |  3 +-
 libc/src/math/fmaximumf.h                     |  3 +-
 libc/src/math/fmaximumf128.h                  |  3 +-
 libc/src/math/fmaximuml.h                     |  3 +-
 libc/src/math/fminimum.h                      |  3 +-
 libc/src/math/fminimum_mag.h                  |  3 +-
 libc/src/math/fminimum_mag_num.h              |  3 +-
 libc/src/math/fminimum_mag_numf.h             |  3 +-
 libc/src/math/fminimum_mag_numf128.h          |  3 +-
 libc/src/math/fminimum_mag_numl.h             |  3 +-
 libc/src/math/fminimum_magf.h                 |  3 +-
 libc/src/math/fminimum_magf128.h              |  3 +-
 libc/src/math/fminimum_magl.h                 |  3 +-
 libc/src/math/fminimum_num.h                  |  3 +-
 libc/src/math/fminimum_numf.h                 |  3 +-
 libc/src/math/fminimum_numf128.h              |  3 +-
 libc/src/math/fminimum_numl.h                 |  3 +-
 libc/src/math/fminimumf.h                     |  3 +-
 libc/src/math/fminimumf128.h                  |  3 +-
 libc/src/math/fminimuml.h                     |  3 +-
 libc/src/math/generic/fmaximum.cpp            |  3 +-
 libc/src/math/generic/fmaximum_mag.cpp        |  3 +-
 libc/src/math/generic/fmaximum_mag_num.cpp    |  3 +-
 libc/src/math/generic/fmaximum_mag_numf.cpp   |  3 +-
 .../src/math/generic/fmaximum_mag_numf128.cpp |  3 +-
 libc/src/math/generic/fmaximum_mag_numl.cpp   |  7 +--
 libc/src/math/generic/fmaximum_magf.cpp       |  3 +-
 libc/src/math/generic/fmaximum_magf128.cpp    |  3 +-
 libc/src/math/generic/fmaximum_magl.cpp       |  4 +-
 libc/src/math/generic/fmaximum_num.cpp        |  3 +-
 libc/src/math/generic/fmaximum_numf.cpp       |  3 +-
 libc/src/math/generic/fmaximum_numf128.cpp    |  3 +-
 libc/src/math/generic/fmaximum_numl.cpp       |  4 +-
 libc/src/math/generic/fmaximumf.cpp           |  3 +-
 libc/src/math/generic/fmaximumf128.cpp        |  3 +-
 libc/src/math/generic/fmaximuml.cpp           |  4 +-
 libc/src/math/generic/fminimum.cpp            |  3 +-
 libc/src/math/generic/fminimum_mag.cpp        |  3 +-
 libc/src/math/generic/fminimum_mag_num.cpp    |  3 +-
 libc/src/math/generic/fminimum_mag_numf.cpp   |  3 +-
 .../src/math/generic/fminimum_mag_numf128.cpp |  3 +-
 libc/src/math/generic/fminimum_mag_numl.cpp   |  7 +--
 libc/src/math/generic/fminimum_magf.cpp       |  3 +-
 libc/src/math/generic/fminimum_magf128.cpp    |  3 +-
 libc/src/math/generic/fminimum_magl.cpp       |  4 +-
 libc/src/math/generic/fminimum_num.cpp        |  3 +-
 libc/src/math/generic/fminimum_numf.cpp       |  3 +-
 libc/src/math/generic/fminimum_numf128.cpp    |  3 +-
 libc/src/math/generic/fminimum_numl.cpp       |  4 +-
 libc/src/math/generic/fminimumf.cpp           |  3 +-
 libc/src/math/generic/fminimumf128.cpp        |  3 +-
 libc/src/math/generic/fminimuml.cpp           |  4 +-
 libc/src/math/nvptx/fmaximum.cpp              |  3 +-
 libc/src/math/nvptx/fmaximumf.cpp             |  3 +-
 libc/test/src/math/smoke/FMaximumMagNumTest.h | 20 ++++----
 libc/test/src/math/smoke/FMaximumMagTest.h    | 20 ++++----
 libc/test/src/math/smoke/FMaximumNumTest.h    | 20 ++++----
 libc/test/src/math/smoke/FMaximumTest.h       | 18 ++++---
 libc/test/src/math/smoke/FMinimumMagNumTest.h | 20 ++++----
 libc/test/src/math/smoke/FMinimumMagTest.h    | 20 ++++----
 libc/test/src/math/smoke/FMinimumNumTest.h    | 20 ++++----
 libc/test/src/math/smoke/FMinimumTest.h       | 18 ++++---
 .../src/math/smoke/fmaximum_mag_num_test.cpp  |  3 +-
 .../math/smoke/fmaximum_mag_numf128_test.cpp  |  3 +-
 .../src/math/smoke/fmaximum_mag_numf_test.cpp |  3 +-
 .../src/math/smoke/fmaximum_mag_numl_test.cpp |  3 +-
 .../test/src/math/smoke/fmaximum_mag_test.cpp |  3 +-
 .../src/math/smoke/fmaximum_magf128_test.cpp  |  3 +-
 .../src/math/smoke/fmaximum_magf_test.cpp     |  3 +-
 .../src/math/smoke/fmaximum_magl_test.cpp     |  3 +-
 .../test/src/math/smoke/fmaximum_num_test.cpp |  3 +-
 .../src/math/smoke/fmaximum_numf128_test.cpp  |  3 +-
 .../src/math/smoke/fmaximum_numf_test.cpp     |  3 +-
 .../src/math/smoke/fmaximum_numl_test.cpp     |  3 +-
 libc/test/src/math/smoke/fmaximum_test.cpp    |  3 +-
 .../test/src/math/smoke/fmaximumf128_test.cpp |  3 +-
 libc/test/src/math/smoke/fmaximumf_test.cpp   |  3 +-
 libc/test/src/math/smoke/fmaximuml_test.cpp   |  3 +-
 .../src/math/smoke/fminimum_mag_num_test.cpp  |  3 +-
 .../src/math/smoke/fminimum_mag_numf128.cpp   |  3 +-
 .../src/math/smoke/fminimum_mag_numf_test.cpp |  3 +-
 .../src/math/smoke/fminimum_mag_numl_test.cpp |  3 +-
 .../test/src/math/smoke/fminimum_mag_test.cpp |  3 +-
 .../src/math/smoke/fminimum_magf128_test.cpp  |  3 +-
 .../src/math/smoke/fminimum_magf_test.cpp     |  3 +-
 .../src/math/smoke/fminimum_magl_test.cpp     |  3 +-
 .../test/src/math/smoke/fminimum_num_test.cpp |  3 +-
 .../src/math/smoke/fminimum_numf128_test.cpp  |  3 +-
 .../src/math/smoke/fminimum_numf_test.cpp     |  3 +-
 .../src/math/smoke/fminimum_numl_test.cpp     |  3 +-
 libc/test/src/math/smoke/fminimum_test.cpp    |  3 +-
 .../test/src/math/smoke/fminimumf128_test.cpp |  3 +-
 libc/test/src/math/smoke/fminimumf_test.cpp   |  3 +-
 libc/test/src/math/smoke/fminimuml_test.cpp   |  3 +-
 131 files changed, 363 insertions(+), 229 deletions(-)

diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index de04f6d0a353b5..c269da69791fdd 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -135,12 +135,12 @@ LIBC_INLINE T fmaximum_mag(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
   if (abs(x) > abs(y)) {
-      return x;
-    } else if (abs(y) > abs(x)) {
-      return y;
-    } else {
-      return fmaximum(x, y);
-    }
+    return x;
+  } else if (abs(y) > abs(x)) {
+    return y;
+  } else {
+    return fmaximum(x, y);
+  }
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -148,12 +148,12 @@ LIBC_INLINE T fminimum_mag(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
   if (abs(x) < abs(y)) {
-      return x;
-    } else if (abs(y) < abs(x)) {
-      return y;
-    } else {
-      return fminimum(x, y);
-    }
+    return x;
+  } else if (abs(y) < abs(x)) {
+    return y;
+  } else {
+    return fminimum(x, y);
+  }
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -161,12 +161,12 @@ LIBC_INLINE T fmaximum_mag_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
   if (abs(x) > abs(y)) {
-      return x;
-    } else if (abs(y) > abs(x)) {
-      return y;
-    } else {
-      return fmaximum_num(x, y);
-    }
+    return x;
+  } else if (abs(y) > abs(x)) {
+    return y;
+  } else {
+    return fmaximum_num(x, y);
+  }
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -174,14 +174,14 @@ LIBC_INLINE T fminimum_mag_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
   if (abs(x) < abs(y)) {
-      return x;
-    } else if (abs(y) < abs(x)) {
-      return y;
-    } else {
-      return fminimum_num(x, y);
-    }
+    return x;
+  } else if (abs(y) < abs(x)) {
+    return y;
+  } else {
+    return fminimum_num(x, y);
+  }
 }
-  
+
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fdim(T x, T y) {
   FPBits<T> bitx(x), bity(y);
diff --git a/libc/src/math/amdgpu/fmaximum.cpp b/libc/src/math/amdgpu/fmaximum.cpp
index a121feb79addce..3b27b272cfa760 100644
--- a/libc/src/math/amdgpu/fmaximum.cpp
+++ b/libc/src/math/amdgpu/fmaximum.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum function for GPU -----------------------===//
+//===-- Implementation of the fmaximum function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximum_mag.cpp b/libc/src/math/amdgpu/fmaximum_mag.cpp
index 99e277f108e02e..ca59f53017bb55 100644
--- a/libc/src/math/amdgpu/fmaximum_mag.cpp
+++ b/libc/src/math/amdgpu/fmaximum_mag.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_mag function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_mag function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximum_mag_num.cpp b/libc/src/math/amdgpu/fmaximum_mag_num.cpp
index bde427903ad60b..1325d8a7bc14a7 100644
--- a/libc/src/math/amdgpu/fmaximum_mag_num.cpp
+++ b/libc/src/math/amdgpu/fmaximum_mag_num.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_mag_num function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_mag_num function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximum_mag_numf.cpp b/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
index 52f7d1413a1cc2..95fc9d1b32eeb2 100644
--- a/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
+++ b/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_mag_numf function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_mag_numf function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximum_mag_numl.cpp b/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
index 33acb0dbdb1b8d..35d6d03dca3237 100644
--- a/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
+++ b/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_mag_numl function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_mag_numl function for GPU
+//-----------------------===//
 //
 // 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 +15,8 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(long double, fmaximum_mag_numl, (long double x, long double y)) {
+LLVM_LIBC_FUNCTION(long double, fmaximum_mag_numl,
+                   (long double x, long double y)) {
   return __builtin_fmaximum_mag_num(x, y);
 }
 
diff --git a/libc/src/math/amdgpu/fmaximum_magf.cpp b/libc/src/math/amdgpu/fmaximum_magf.cpp
index 9b057437e8137f..e4cf49eff8bc28 100644
--- a/libc/src/math/amdgpu/fmaximum_magf.cpp
+++ b/libc/src/math/amdgpu/fmaximum_magf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_magf function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_magf function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximum_magl.cpp b/libc/src/math/amdgpu/fmaximum_magl.cpp
index 06fe8bf1c406c3..b6e15f7b31092e 100644
--- a/libc/src/math/amdgpu/fmaximum_magl.cpp
+++ b/libc/src/math/amdgpu/fmaximum_magl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_magl function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_magl function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximum_num.cpp b/libc/src/math/amdgpu/fmaximum_num.cpp
index ec0b1b6a575587..036fb39c44f6ff 100644
--- a/libc/src/math/amdgpu/fmaximum_num.cpp
+++ b/libc/src/math/amdgpu/fmaximum_num.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_num function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_num function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximum_numf.cpp b/libc/src/math/amdgpu/fmaximum_numf.cpp
index 81a0653730f7e5..6a0c76be098314 100644
--- a/libc/src/math/amdgpu/fmaximum_numf.cpp
+++ b/libc/src/math/amdgpu/fmaximum_numf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_numf function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_numf function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximum_numl.cpp b/libc/src/math/amdgpu/fmaximum_numl.cpp
index c378c4f9b8bb7f..4b9fc891cd45e9 100644
--- a/libc/src/math/amdgpu/fmaximum_numl.cpp
+++ b/libc/src/math/amdgpu/fmaximum_numl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum_numl function for GPU -----------------------===//
+//===-- Implementation of the fmaximum_numl function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fmaximumf.cpp b/libc/src/math/amdgpu/fmaximumf.cpp
index 842c9865bc790c..aec326312c5a60 100644
--- a/libc/src/math/amdgpu/fmaximumf.cpp
+++ b/libc/src/math/amdgpu/fmaximumf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximumf function for GPU ----------------------===//
+//===-- Implementation of the fmaximumf function for GPU
+//----------------------===//
 //
 // 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/amdgpu/fmaximuml.cpp b/libc/src/math/amdgpu/fmaximuml.cpp
index 6d0206f01beb33..74f794368f4a50 100644
--- a/libc/src/math/amdgpu/fmaximuml.cpp
+++ b/libc/src/math/amdgpu/fmaximuml.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximuml function for GPU ----------------------===//
+//===-- Implementation of the fmaximuml function for GPU
+//----------------------===//
 //
 // 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/amdgpu/fminimum.cpp b/libc/src/math/amdgpu/fminimum.cpp
index f787a4ca11ad5c..f2bf6470ff3840 100644
--- a/libc/src/math/amdgpu/fminimum.cpp
+++ b/libc/src/math/amdgpu/fminimum.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum function for GPU -----------------------===//
+//===-- Implementation of the fminimum function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimum_mag.cpp b/libc/src/math/amdgpu/fminimum_mag.cpp
index c5e95a5340c0d4..c693de73584fe8 100644
--- a/libc/src/math/amdgpu/fminimum_mag.cpp
+++ b/libc/src/math/amdgpu/fminimum_mag.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_mag function for GPU -----------------------===//
+//===-- Implementation of the fminimum_mag function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimum_mag_num.cpp b/libc/src/math/amdgpu/fminimum_mag_num.cpp
index f09e137ca99948..723b98bee81094 100644
--- a/libc/src/math/amdgpu/fminimum_mag_num.cpp
+++ b/libc/src/math/amdgpu/fminimum_mag_num.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_mag_num function for GPU -----------------------===//
+//===-- Implementation of the fminimum_mag_num function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimum_mag_numf.cpp b/libc/src/math/amdgpu/fminimum_mag_numf.cpp
index 6bd32166443c9a..9d61d91edfd446 100644
--- a/libc/src/math/amdgpu/fminimum_mag_numf.cpp
+++ b/libc/src/math/amdgpu/fminimum_mag_numf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_mag_numf function for GPU -----------------------===//
+//===-- Implementation of the fminimum_mag_numf function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimum_mag_numl.cpp b/libc/src/math/amdgpu/fminimum_mag_numl.cpp
index b5ac91dcfc771c..8a835418552fab 100644
--- a/libc/src/math/amdgpu/fminimum_mag_numl.cpp
+++ b/libc/src/math/amdgpu/fminimum_mag_numl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_mag_numl function for GPU -----------------------===//
+//===-- Implementation of the fminimum_mag_numl function for GPU
+//-----------------------===//
 //
 // 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 +15,8 @@
 
 namespace LIBC_NAMESPACE {
 
-  LLVM_LIBC_FUNCTION(long double, fminimum_mag_numl, (long double x, long double y)) {
+LLVM_LIBC_FUNCTION(long double, fminimum_mag_numl,
+                   (long double x, long double y)) {
   return __builtin_fminimum_mag_num(x, y);
 }
 
diff --git a/libc/src/math/amdgpu/fminimum_magf.cpp b/libc/src/math/amdgpu/fminimum_magf.cpp
index 1603258a2e1836..07efb0e4b07942 100644
--- a/libc/src/math/amdgpu/fminimum_magf.cpp
+++ b/libc/src/math/amdgpu/fminimum_magf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_magf function for GPU -----------------------===//
+//===-- Implementation of the fminimum_magf function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimum_magl.cpp b/libc/src/math/amdgpu/fminimum_magl.cpp
index af16dc07cee97c..3609fe5f8a6c2d 100644
--- a/libc/src/math/amdgpu/fminimum_magl.cpp
+++ b/libc/src/math/amdgpu/fminimum_magl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_magl function for GPU -----------------------===//
+//===-- Implementation of the fminimum_magl function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimum_num.cpp b/libc/src/math/amdgpu/fminimum_num.cpp
index 6411d38804db33..2f7482fc09edc0 100644
--- a/libc/src/math/amdgpu/fminimum_num.cpp
+++ b/libc/src/math/amdgpu/fminimum_num.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_num function for GPU -----------------------===//
+//===-- Implementation of the fminimum_num function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimum_numf.cpp b/libc/src/math/amdgpu/fminimum_numf.cpp
index fd39e4da0c74aa..85fded8413e95d 100644
--- a/libc/src/math/amdgpu/fminimum_numf.cpp
+++ b/libc/src/math/amdgpu/fminimum_numf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_numf function for GPU -----------------------===//
+//===-- Implementation of the fminimum_numf function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimum_numl.cpp b/libc/src/math/amdgpu/fminimum_numl.cpp
index cfa08b97b885b6..96ece96f92356e 100644
--- a/libc/src/math/amdgpu/fminimum_numl.cpp
+++ b/libc/src/math/amdgpu/fminimum_numl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimum_numl function for GPU -----------------------===//
+//===-- Implementation of the fminimum_numl function for GPU
+//-----------------------===//
 //
 // 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/amdgpu/fminimumf.cpp b/libc/src/math/amdgpu/fminimumf.cpp
index 032da034a0ec6f..baf6c06d62d6dc 100644
--- a/libc/src/math/amdgpu/fminimumf.cpp
+++ b/libc/src/math/amdgpu/fminimumf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimumf function for GPU ----------------------===//
+//===-- Implementation of the fminimumf function for GPU
+//----------------------===//
 //
 // 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/amdgpu/fminimuml.cpp b/libc/src/math/amdgpu/fminimuml.cpp
index 493392b37bc3d4..8e1dbe9ecbd3bd 100644
--- a/libc/src/math/amdgpu/fminimuml.cpp
+++ b/libc/src/math/amdgpu/fminimuml.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fminimuml function for GPU ----------------------===//
+//===-- Implementation of the fminimuml function for GPU
+//----------------------===//
 //
 // 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/fmaximum.h b/libc/src/math/fmaximum.h
index 62b4dcf4a9be92..8eac02b17b79ab 100644
--- a/libc/src/math/fmaximum.h
+++ b/libc/src/math/fmaximum.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum --------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum --------------------------*- 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/fmaximum_mag.h b/libc/src/math/fmaximum_mag.h
index 6be9ddd08c0655..b338d08d54937b 100644
--- a/libc/src/math/fmaximum_mag.h
+++ b/libc/src/math/fmaximum_mag.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_mag--------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_mag--------------------------*- 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/fmaximum_mag_num.h b/libc/src/math/fmaximum_mag_num.h
index e5605e76f01114..6a04737eb92313 100644
--- a/libc/src/math/fmaximum_mag_num.h
+++ b/libc/src/math/fmaximum_mag_num.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_mag_num--------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_mag_num--------------------------*-
+//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/fmaximum_mag_numf.h b/libc/src/math/fmaximum_mag_numf.h
index 0c670963170c1f..5eac2dde1faa3d 100644
--- a/libc/src/math/fmaximum_mag_numf.h
+++ b/libc/src/math/fmaximum_mag_numf.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_mag_numf -------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_mag_numf -------------------------*-
+//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/fmaximum_mag_numf128.h b/libc/src/math/fmaximum_mag_numf128.h
index b1fdaa6f7d48de..a98502cdf0a671 100644
--- a/libc/src/math/fmaximum_mag_numf128.h
+++ b/libc/src/math/fmaximum_mag_numf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_mag_numf128 ----------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_mag_numf128 ----------------------*-
+//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/fmaximum_mag_numl.h b/libc/src/math/fmaximum_mag_numl.h
index 6b69688a8e4751..0114d0acffb42a 100644
--- a/libc/src/math/fmaximum_mag_numl.h
+++ b/libc/src/math/fmaximum_mag_numl.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_mag_numl -------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_mag_numl -------------------------*-
+//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/fmaximum_magf.h b/libc/src/math/fmaximum_magf.h
index 69ef82ae2b8867..1bfcc795f8f81c 100644
--- a/libc/src/math/fmaximum_magf.h
+++ b/libc/src/math/fmaximum_magf.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_magf -------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_magf -------------------------*- 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/fmaximum_magf128.h b/libc/src/math/fmaximum_magf128.h
index a9a4cc387c192c..23c466b74cce89 100644
--- a/libc/src/math/fmaximum_magf128.h
+++ b/libc/src/math/fmaximum_magf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_magf128 ----------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_magf128 ----------------------*- 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/fmaximum_magl.h b/libc/src/math/fmaximum_magl.h
index c9483e4ff3cf00..23b283cb5dbc24 100644
--- a/libc/src/math/fmaximum_magl.h
+++ b/libc/src/math/fmaximum_magl.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_magl -------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_magl -------------------------*- 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/fmaximum_num.h b/libc/src/math/fmaximum_num.h
index 4781a1392b625b..ce3ce12ca64b4c 100644
--- a/libc/src/math/fmaximum_num.h
+++ b/libc/src/math/fmaximum_num.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_num--------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_num--------------------------*- 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/fmaximum_numf.h b/libc/src/math/fmaximum_numf.h
index 2e211a6b232714..b3243ed16be9f0 100644
--- a/libc/src/math/fmaximum_numf.h
+++ b/libc/src/math/fmaximum_numf.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_numf -------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_numf -------------------------*- 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/fmaximum_numf128.h b/libc/src/math/fmaximum_numf128.h
index b3ef91dd6f0536..d55183ce88cc61 100644
--- a/libc/src/math/fmaximum_numf128.h
+++ b/libc/src/math/fmaximum_numf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_numf128 ----------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_numf128 ----------------------*- 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/fmaximum_numl.h b/libc/src/math/fmaximum_numl.h
index 0e3a8fcba7bbaf..f668cbdf73151b 100644
--- a/libc/src/math/fmaximum_numl.h
+++ b/libc/src/math/fmaximum_numl.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximum_numl -------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximum_numl -------------------------*- 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/fmaximumf.h b/libc/src/math/fmaximumf.h
index d341f249f8634a..4eee696ce15217 100644
--- a/libc/src/math/fmaximumf.h
+++ b/libc/src/math/fmaximumf.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximumf -------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximumf -------------------------*- 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/fmaximumf128.h b/libc/src/math/fmaximumf128.h
index 533617c54abbde..4a214ef096e10e 100644
--- a/libc/src/math/fmaximumf128.h
+++ b/libc/src/math/fmaximumf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximumf128 ----------------------*- C++ -*-===//
+//===-- Implementation header for fmaximumf128 ----------------------*- 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/fmaximuml.h b/libc/src/math/fmaximuml.h
index abce56e4e71d0f..ba8a8b12110c70 100644
--- a/libc/src/math/fmaximuml.h
+++ b/libc/src/math/fmaximuml.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fmaximuml -------------------------*- C++ -*-===//
+//===-- Implementation header for fmaximuml -------------------------*- 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/fminimum.h b/libc/src/math/fminimum.h
index f7741f2cac5416..9d39b1bdd3db2d 100644
--- a/libc/src/math/fminimum.h
+++ b/libc/src/math/fminimum.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum -------------------------*- 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/fminimum_mag.h b/libc/src/math/fminimum_mag.h
index 9772b51f6ba02a..10b242e6026e83 100644
--- a/libc/src/math/fminimum_mag.h
+++ b/libc/src/math/fminimum_mag.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_mag--------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_mag--------------------------*- 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/fminimum_mag_num.h b/libc/src/math/fminimum_mag_num.h
index 7e6e279b5d2f8a..af6b9c3dbc1f9e 100644
--- a/libc/src/math/fminimum_mag_num.h
+++ b/libc/src/math/fminimum_mag_num.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_mag_num--------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_mag_num--------------------------*-
+//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/fminimum_mag_numf.h b/libc/src/math/fminimum_mag_numf.h
index 006ce3a244fbc9..f5fc54afdeb193 100644
--- a/libc/src/math/fminimum_mag_numf.h
+++ b/libc/src/math/fminimum_mag_numf.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_mag_numf -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_mag_numf -------------------------*-
+//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/fminimum_mag_numf128.h b/libc/src/math/fminimum_mag_numf128.h
index 53e847247b2803..e644095868bd96 100644
--- a/libc/src/math/fminimum_mag_numf128.h
+++ b/libc/src/math/fminimum_mag_numf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_mag_numf128 ----------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_mag_numf128 ----------------------*-
+//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/fminimum_mag_numl.h b/libc/src/math/fminimum_mag_numl.h
index 740b15c7facc4b..ce96abcad14432 100644
--- a/libc/src/math/fminimum_mag_numl.h
+++ b/libc/src/math/fminimum_mag_numl.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_mag_numl -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_mag_numl -------------------------*-
+//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/fminimum_magf.h b/libc/src/math/fminimum_magf.h
index 50bdf784511a2b..6209340074d2dc 100644
--- a/libc/src/math/fminimum_magf.h
+++ b/libc/src/math/fminimum_magf.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_magf -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_magf -------------------------*- 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/fminimum_magf128.h b/libc/src/math/fminimum_magf128.h
index 74b293ccc80097..05bd163be97c81 100644
--- a/libc/src/math/fminimum_magf128.h
+++ b/libc/src/math/fminimum_magf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_magf128 ----------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_magf128 ----------------------*- 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/fminimum_magl.h b/libc/src/math/fminimum_magl.h
index 530e080ee3bb0c..bcda35ce3bd2a3 100644
--- a/libc/src/math/fminimum_magl.h
+++ b/libc/src/math/fminimum_magl.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_magl -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_magl -------------------------*- 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/fminimum_num.h b/libc/src/math/fminimum_num.h
index 53114034cb2b28..4c864cba84872e 100644
--- a/libc/src/math/fminimum_num.h
+++ b/libc/src/math/fminimum_num.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_num--------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_num--------------------------*- 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/fminimum_numf.h b/libc/src/math/fminimum_numf.h
index d1d1762876bcc4..ac4b08b292be82 100644
--- a/libc/src/math/fminimum_numf.h
+++ b/libc/src/math/fminimum_numf.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_numf -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_numf -------------------------*- 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/fminimum_numf128.h b/libc/src/math/fminimum_numf128.h
index 68fcabc7f24465..00f8960ff12797 100644
--- a/libc/src/math/fminimum_numf128.h
+++ b/libc/src/math/fminimum_numf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_numf128 ----------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_numf128 ----------------------*- 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/fminimum_numl.h b/libc/src/math/fminimum_numl.h
index 01851286a22ab0..0da204e72c74d4 100644
--- a/libc/src/math/fminimum_numl.h
+++ b/libc/src/math/fminimum_numl.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimum_numl -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimum_numl -------------------------*- 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/fminimumf.h b/libc/src/math/fminimumf.h
index be864d9e02203f..424309f3a5313e 100644
--- a/libc/src/math/fminimumf.h
+++ b/libc/src/math/fminimumf.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimumf -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimumf -------------------------*- 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/fminimumf128.h b/libc/src/math/fminimumf128.h
index b8c16fecfdeb07..7ff0190727379a 100644
--- a/libc/src/math/fminimumf128.h
+++ b/libc/src/math/fminimumf128.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimumf128 ----------------------*- C++ -*-===//
+//===-- Implementation header for fminimumf128 ----------------------*- 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/fminimuml.h b/libc/src/math/fminimuml.h
index 4354b3d54e5330..b9cc321354a283 100644
--- a/libc/src/math/fminimuml.h
+++ b/libc/src/math/fminimuml.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for fminimuml -------------------------*- C++ -*-===//
+//===-- Implementation header for fminimuml -------------------------*- 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/fmaximum.cpp b/libc/src/math/generic/fmaximum.cpp
index 0e2d5f52a3dd6d..c2ade3ddc1ee91 100644
--- a/libc/src/math/generic/fmaximum.cpp
+++ b/libc/src/math/generic/fmaximum.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum function -----------------------------------===//
+//===-- Implementation of fmaximum 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/fmaximum_mag.cpp b/libc/src/math/generic/fmaximum_mag.cpp
index fe6c47e000159f..c8aa6e4d49a9ea 100644
--- a/libc/src/math/generic/fmaximum_mag.cpp
+++ b/libc/src/math/generic/fmaximum_mag.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_mag function -----------------------------------===//
+//===-- Implementation of fmaximum_mag 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/fmaximum_mag_num.cpp b/libc/src/math/generic/fmaximum_mag_num.cpp
index ac17a324cf3d35..2cd1c9901796c4 100644
--- a/libc/src/math/generic/fmaximum_mag_num.cpp
+++ b/libc/src/math/generic/fmaximum_mag_num.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_mag_num function -----------------------------------===//
+//===-- Implementation of fmaximum_mag_num 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/fmaximum_mag_numf.cpp b/libc/src/math/generic/fmaximum_mag_numf.cpp
index fc0122d42357e9..ec8f8a790105cd 100644
--- a/libc/src/math/generic/fmaximum_mag_numf.cpp
+++ b/libc/src/math/generic/fmaximum_mag_numf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_mag_numf function ----------------------------------===//
+//===-- Implementation of fmaximum_mag_numf 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/fmaximum_mag_numf128.cpp b/libc/src/math/generic/fmaximum_mag_numf128.cpp
index 54b02436d2d87e..ead2b74ba29f61 100644
--- a/libc/src/math/generic/fmaximum_mag_numf128.cpp
+++ b/libc/src/math/generic/fmaximum_mag_numf128.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_mag_numf128 function -------------------------------===//
+//===-- Implementation of fmaximum_mag_numf128 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/fmaximum_mag_numl.cpp b/libc/src/math/generic/fmaximum_mag_numl.cpp
index c124cf0d2ac534..d952487dffd808 100644
--- a/libc/src/math/generic/fmaximum_mag_numl.cpp
+++ b/libc/src/math/generic/fmaximum_mag_numl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_mag_numl function ----------------------------------===//
+//===-- Implementation of fmaximum_mag_numl function
+//----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -12,9 +13,9 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(long double, fmaximum_mag_numl, (long double x, long double y)) {
+LLVM_LIBC_FUNCTION(long double, fmaximum_mag_numl,
+                   (long double x, long double y)) {
   return fputil::fmaximum_mag_num(x, y);
 }
 
 } // namespace LIBC_NAMESPACE
-
diff --git a/libc/src/math/generic/fmaximum_magf.cpp b/libc/src/math/generic/fmaximum_magf.cpp
index 23aa6c3408933a..54c0dddb39cf91 100644
--- a/libc/src/math/generic/fmaximum_magf.cpp
+++ b/libc/src/math/generic/fmaximum_magf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_magf function ----------------------------------===//
+//===-- Implementation of fmaximum_magf 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/fmaximum_magf128.cpp b/libc/src/math/generic/fmaximum_magf128.cpp
index 93413714dd9c9a..67123c71d8cf7f 100644
--- a/libc/src/math/generic/fmaximum_magf128.cpp
+++ b/libc/src/math/generic/fmaximum_magf128.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_magf128 function -------------------------------===//
+//===-- Implementation of fmaximum_magf128 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/fmaximum_magl.cpp b/libc/src/math/generic/fmaximum_magl.cpp
index 0c7cab2e230ef2..e242f320103b87 100644
--- a/libc/src/math/generic/fmaximum_magl.cpp
+++ b/libc/src/math/generic/fmaximum_magl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_magl function ----------------------------------===//
+//===-- Implementation of fmaximum_magl function
+//----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -17,4 +18,3 @@ LLVM_LIBC_FUNCTION(long double, fmaximum_magl, (long double x, long double y)) {
 }
 
 } // namespace LIBC_NAMESPACE
-
diff --git a/libc/src/math/generic/fmaximum_num.cpp b/libc/src/math/generic/fmaximum_num.cpp
index 1dc2b7b68f4cbd..011e7c35fe263d 100644
--- a/libc/src/math/generic/fmaximum_num.cpp
+++ b/libc/src/math/generic/fmaximum_num.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_num function -----------------------------------===//
+//===-- Implementation of fmaximum_num 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/fmaximum_numf.cpp b/libc/src/math/generic/fmaximum_numf.cpp
index fa0e71a9791241..96242d75de329e 100644
--- a/libc/src/math/generic/fmaximum_numf.cpp
+++ b/libc/src/math/generic/fmaximum_numf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_numf function ----------------------------------===//
+//===-- Implementation of fmaximum_numf 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/fmaximum_numf128.cpp b/libc/src/math/generic/fmaximum_numf128.cpp
index 8cbbc995b877a1..9b4ccb0d93fdc4 100644
--- a/libc/src/math/generic/fmaximum_numf128.cpp
+++ b/libc/src/math/generic/fmaximum_numf128.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_numf128 function -------------------------------===//
+//===-- Implementation of fmaximum_numf128 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/fmaximum_numl.cpp b/libc/src/math/generic/fmaximum_numl.cpp
index 18518947c869a4..91812c0d65a782 100644
--- a/libc/src/math/generic/fmaximum_numl.cpp
+++ b/libc/src/math/generic/fmaximum_numl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximum_numl function ----------------------------------===//
+//===-- Implementation of fmaximum_numl function
+//----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -17,4 +18,3 @@ LLVM_LIBC_FUNCTION(long double, fmaximum_numl, (long double x, long double y)) {
 }
 
 } // namespace LIBC_NAMESPACE
-
diff --git a/libc/src/math/generic/fmaximumf.cpp b/libc/src/math/generic/fmaximumf.cpp
index c3782ee8654193..cf4975bf11f5c2 100644
--- a/libc/src/math/generic/fmaximumf.cpp
+++ b/libc/src/math/generic/fmaximumf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximumf function ----------------------------------===//
+//===-- Implementation of fmaximumf 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/fmaximumf128.cpp b/libc/src/math/generic/fmaximumf128.cpp
index 5e59144bae87fa..cf07b375980a2e 100644
--- a/libc/src/math/generic/fmaximumf128.cpp
+++ b/libc/src/math/generic/fmaximumf128.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximumf128 function -------------------------------===//
+//===-- Implementation of fmaximumf128 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/fmaximuml.cpp b/libc/src/math/generic/fmaximuml.cpp
index 94a61f2b3ab494..a927e611b8134b 100644
--- a/libc/src/math/generic/fmaximuml.cpp
+++ b/libc/src/math/generic/fmaximuml.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fmaximuml function ----------------------------------===//
+//===-- Implementation of fmaximuml function
+//----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -17,4 +18,3 @@ LLVM_LIBC_FUNCTION(long double, fmaximuml, (long double x, long double y)) {
 }
 
 } // namespace LIBC_NAMESPACE
-
diff --git a/libc/src/math/generic/fminimum.cpp b/libc/src/math/generic/fminimum.cpp
index 7d11f5bb616cfc..54ab2438514b82 100644
--- a/libc/src/math/generic/fminimum.cpp
+++ b/libc/src/math/generic/fminimum.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum function -----------------------------------===//
+//===-- Implementation of fminimum 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/fminimum_mag.cpp b/libc/src/math/generic/fminimum_mag.cpp
index f952edca6025dd..b9466b3f00f782 100644
--- a/libc/src/math/generic/fminimum_mag.cpp
+++ b/libc/src/math/generic/fminimum_mag.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_mag function -----------------------------------===//
+//===-- Implementation of fminimum_mag 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/fminimum_mag_num.cpp b/libc/src/math/generic/fminimum_mag_num.cpp
index 1afb6239371a5c..a78d1b16c05949 100644
--- a/libc/src/math/generic/fminimum_mag_num.cpp
+++ b/libc/src/math/generic/fminimum_mag_num.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_mag_num function -----------------------------------===//
+//===-- Implementation of fminimum_mag_num 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/fminimum_mag_numf.cpp b/libc/src/math/generic/fminimum_mag_numf.cpp
index 660578de3ef958..f362a9f3de0906 100644
--- a/libc/src/math/generic/fminimum_mag_numf.cpp
+++ b/libc/src/math/generic/fminimum_mag_numf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_mag_numf function ----------------------------------===//
+//===-- Implementation of fminimum_mag_numf 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/fminimum_mag_numf128.cpp b/libc/src/math/generic/fminimum_mag_numf128.cpp
index 911ce5a4cff7c7..9d1a55ac3ac78c 100644
--- a/libc/src/math/generic/fminimum_mag_numf128.cpp
+++ b/libc/src/math/generic/fminimum_mag_numf128.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_mag_numf128 function -------------------------------===//
+//===-- Implementation of fminimum_mag_numf128 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/fminimum_mag_numl.cpp b/libc/src/math/generic/fminimum_mag_numl.cpp
index 81e1e2db0f0e38..68221345306e2c 100644
--- a/libc/src/math/generic/fminimum_mag_numl.cpp
+++ b/libc/src/math/generic/fminimum_mag_numl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_mag_numl function ----------------------------------===//
+//===-- Implementation of fminimum_mag_numl function
+//----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -12,9 +13,9 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(long double, fminimum_mag_numl, (long double x, long double y)) {
+LLVM_LIBC_FUNCTION(long double, fminimum_mag_numl,
+                   (long double x, long double y)) {
   return fputil::fminimum_mag_num(x, y);
 }
 
 } // namespace LIBC_NAMESPACE
-
diff --git a/libc/src/math/generic/fminimum_magf.cpp b/libc/src/math/generic/fminimum_magf.cpp
index 32f128eaafb216..3dbac66bd11c27 100644
--- a/libc/src/math/generic/fminimum_magf.cpp
+++ b/libc/src/math/generic/fminimum_magf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_magf function ----------------------------------===//
+//===-- Implementation of fminimum_magf 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/fminimum_magf128.cpp b/libc/src/math/generic/fminimum_magf128.cpp
index 32488880a224c9..111577614669a6 100644
--- a/libc/src/math/generic/fminimum_magf128.cpp
+++ b/libc/src/math/generic/fminimum_magf128.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_magf128 function -------------------------------===//
+//===-- Implementation of fminimum_magf128 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/fminimum_magl.cpp b/libc/src/math/generic/fminimum_magl.cpp
index 9c9f3e5d249098..e2cb92e665b935 100644
--- a/libc/src/math/generic/fminimum_magl.cpp
+++ b/libc/src/math/generic/fminimum_magl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_magl function ----------------------------------===//
+//===-- Implementation of fminimum_magl function
+//----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -17,4 +18,3 @@ LLVM_LIBC_FUNCTION(long double, fminimum_magl, (long double x, long double y)) {
 }
 
 } // namespace LIBC_NAMESPACE
-
diff --git a/libc/src/math/generic/fminimum_num.cpp b/libc/src/math/generic/fminimum_num.cpp
index 0f0651b621454f..d5f855d0e57fcb 100644
--- a/libc/src/math/generic/fminimum_num.cpp
+++ b/libc/src/math/generic/fminimum_num.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_num function -----------------------------------===//
+//===-- Implementation of fminimum_num 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/fminimum_numf.cpp b/libc/src/math/generic/fminimum_numf.cpp
index cc4d1b48336d83..f74447bddc3e27 100644
--- a/libc/src/math/generic/fminimum_numf.cpp
+++ b/libc/src/math/generic/fminimum_numf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_numf function ----------------------------------===//
+//===-- Implementation of fminimum_numf 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/fminimum_numf128.cpp b/libc/src/math/generic/fminimum_numf128.cpp
index de2a7584a170f8..fe6ab79308a1b6 100644
--- a/libc/src/math/generic/fminimum_numf128.cpp
+++ b/libc/src/math/generic/fminimum_numf128.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_numf128 function -------------------------------===//
+//===-- Implementation of fminimum_numf128 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/fminimum_numl.cpp b/libc/src/math/generic/fminimum_numl.cpp
index d60468b59e94d7..e85d0d51b67e6d 100644
--- a/libc/src/math/generic/fminimum_numl.cpp
+++ b/libc/src/math/generic/fminimum_numl.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimum_numl function ----------------------------------===//
+//===-- Implementation of fminimum_numl function
+//----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -17,4 +18,3 @@ LLVM_LIBC_FUNCTION(long double, fminimum_numl, (long double x, long double y)) {
 }
 
 } // namespace LIBC_NAMESPACE
-
diff --git a/libc/src/math/generic/fminimumf.cpp b/libc/src/math/generic/fminimumf.cpp
index ec65a64504694f..968e2e008b18be 100644
--- a/libc/src/math/generic/fminimumf.cpp
+++ b/libc/src/math/generic/fminimumf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimumf function ----------------------------------===//
+//===-- Implementation of fminimumf 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/fminimumf128.cpp b/libc/src/math/generic/fminimumf128.cpp
index 198428a4432a31..7047f903abdaa6 100644
--- a/libc/src/math/generic/fminimumf128.cpp
+++ b/libc/src/math/generic/fminimumf128.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimumf128 function -------------------------------===//
+//===-- Implementation of fminimumf128 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/fminimuml.cpp b/libc/src/math/generic/fminimuml.cpp
index cc9da63c1b01c4..a18e76c843befe 100644
--- a/libc/src/math/generic/fminimuml.cpp
+++ b/libc/src/math/generic/fminimuml.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of fminimuml function ----------------------------------===//
+//===-- Implementation of fminimuml function
+//----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -17,4 +18,3 @@ LLVM_LIBC_FUNCTION(long double, fminimuml, (long double x, long double y)) {
 }
 
 } // namespace LIBC_NAMESPACE
-
diff --git a/libc/src/math/nvptx/fmaximum.cpp b/libc/src/math/nvptx/fmaximum.cpp
index 30dbc0e3e4653a..d09b40205db89f 100644
--- a/libc/src/math/nvptx/fmaximum.cpp
+++ b/libc/src/math/nvptx/fmaximum.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximum function for GPU -----------------------===//
+//===-- Implementation of the fmaximum function for GPU
+//-----------------------===//
 //
 // 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/nvptx/fmaximumf.cpp b/libc/src/math/nvptx/fmaximumf.cpp
index 1e9b54bf5771ff..e0d36a65b3bc68 100644
--- a/libc/src/math/nvptx/fmaximumf.cpp
+++ b/libc/src/math/nvptx/fmaximumf.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of the fmaximumf function for GPU ----------------------===//
+//===-- Implementation of the fmaximumf function for GPU
+//----------------------===//
 //
 // 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/FMaximumMagNumTest.h b/libc/test/src/math/smoke/FMaximumMagNumTest.h
index ec08afe5ba10cd..9c32f835a58833 100644
--- a/libc/test/src/math/smoke/FMaximumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMaximumMagNumTest.h
@@ -1,4 +1,5 @@
-//===-- Utility class to test fmaximum_mag_num[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fmaximum_mag_num[f|l] -------------------------*-
+//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,11 +10,12 @@
 #ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMMAG_NUMTEST_H
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMMAG_NUMTEST_H
 
+#include "src/__support/FPUtil/BasicOperations.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
-#include "src/__support/FPUtil/BasicOperations.h"
 
-template <typename T> class FMaximumMagNumTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class FMaximumMagNumTest : public LIBC_NAMESPACE::testing::Test {
 
   DECLARE_SPECIAL_CONSTANTS(T)
 
@@ -77,12 +79,12 @@ template <typename T> class FMaximumMagNumTest : public LIBC_NAMESPACE::testing:
   }
 };
 
-#define LIST_FMAXIMUM_MAG_NUM_TESTS(T, func)                                               \
-  using LlvmLibcFMaximumMagNumTest = FMaximumMagNumTest<T>;                                        \
-  TEST_F(LlvmLibcFMaximumMagNumTest, NaN) { testNaN(&func); }                            \
-  TEST_F(LlvmLibcFMaximumMagNumTest, InfArg) { testInfArg(&func); }                      \
-  TEST_F(LlvmLibcFMaximumMagNumTest, NegInfArg) { testNegInfArg(&func); }                \
-  TEST_F(LlvmLibcFMaximumMagNumTest, BothZero) { testBothZero(&func); }                  \
+#define LIST_FMAXIMUM_MAG_NUM_TESTS(T, func)                                   \
+  using LlvmLibcFMaximumMagNumTest = FMaximumMagNumTest<T>;                    \
+  TEST_F(LlvmLibcFMaximumMagNumTest, NaN) { testNaN(&func); }                  \
+  TEST_F(LlvmLibcFMaximumMagNumTest, InfArg) { testInfArg(&func); }            \
+  TEST_F(LlvmLibcFMaximumMagNumTest, NegInfArg) { testNegInfArg(&func); }      \
+  TEST_F(LlvmLibcFMaximumMagNumTest, BothZero) { testBothZero(&func); }        \
   TEST_F(LlvmLibcFMaximumMagNumTest, Range) { testRange(&func); }
 
 #endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMMAG_NUMTEST_H
diff --git a/libc/test/src/math/smoke/FMaximumMagTest.h b/libc/test/src/math/smoke/FMaximumMagTest.h
index d8cafc0aa0f067..40106032a487b8 100644
--- a/libc/test/src/math/smoke/FMaximumMagTest.h
+++ b/libc/test/src/math/smoke/FMaximumMagTest.h
@@ -1,4 +1,5 @@
-//===-- Utility class to test fmaximum_mag[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fmaximum_mag[f|l] -------------------------*- 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,11 +10,12 @@
 #ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUM_MAGTEST_H
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUM_MAGTEST_H
 
+#include "src/__support/FPUtil/BasicOperations.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
-#include "src/__support/FPUtil/BasicOperations.h"
 
-template <typename T> class FMaximumMagTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class FMaximumMagTest : public LIBC_NAMESPACE::testing::Test {
 
   DECLARE_SPECIAL_CONSTANTS(T)
 
@@ -77,12 +79,12 @@ template <typename T> class FMaximumMagTest : public LIBC_NAMESPACE::testing::Te
   }
 };
 
-#define LIST_FMAXIMUM_MAG_TESTS(T, func)                                               \
-  using LlvmLibcFMaximumMagTest = FMaximumMagTest<T>;                                        \
-  TEST_F(LlvmLibcFMaximumMagTest, NaN) { testNaN(&func); }                            \
-  TEST_F(LlvmLibcFMaximumMagTest, InfArg) { testInfArg(&func); }                      \
-  TEST_F(LlvmLibcFMaximumMagTest, NegInfArg) { testNegInfArg(&func); }                \
-  TEST_F(LlvmLibcFMaximumMagTest, BothZero) { testBothZero(&func); }                  \
+#define LIST_FMAXIMUM_MAG_TESTS(T, func)                                       \
+  using LlvmLibcFMaximumMagTest = FMaximumMagTest<T>;                          \
+  TEST_F(LlvmLibcFMaximumMagTest, NaN) { testNaN(&func); }                     \
+  TEST_F(LlvmLibcFMaximumMagTest, InfArg) { testInfArg(&func); }               \
+  TEST_F(LlvmLibcFMaximumMagTest, NegInfArg) { testNegInfArg(&func); }         \
+  TEST_F(LlvmLibcFMaximumMagTest, BothZero) { testBothZero(&func); }           \
   TEST_F(LlvmLibcFMaximumMagTest, Range) { testRange(&func); }
 
 #endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUM_MAGTEST_H
diff --git a/libc/test/src/math/smoke/FMaximumNumTest.h b/libc/test/src/math/smoke/FMaximumNumTest.h
index 3ca6c179043a1b..24ae084db768e0 100644
--- a/libc/test/src/math/smoke/FMaximumNumTest.h
+++ b/libc/test/src/math/smoke/FMaximumNumTest.h
@@ -1,4 +1,5 @@
-//===-- Utility class to test fmaximum_num[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fmaximum_num[f|l] -------------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -12,7 +13,8 @@
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
 
-template <typename T> class FMaximumNumTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class FMaximumNumTest : public LIBC_NAMESPACE::testing::Test {
 
   DECLARE_SPECIAL_CONSTANTS(T)
 
@@ -54,7 +56,7 @@ template <typename T> class FMaximumNumTest : public LIBC_NAMESPACE::testing::Te
 
   void testRange(FMaximumNumFunc func) {
     constexpr StorageType COUNT = 100'001;
-    constexpr StorageType STEP = STORAGE_MAX/ COUNT;
+    constexpr StorageType STEP = STORAGE_MAX / COUNT;
     for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
          ++i, v += STEP, w -= STEP) {
       FPBits xbits(v), ybits(w);
@@ -76,12 +78,12 @@ template <typename T> class FMaximumNumTest : public LIBC_NAMESPACE::testing::Te
   }
 };
 
-#define LIST_FMAXIMUM_NUM_TESTS(T, func)                                               \
-  using LlvmLibcFMaximumNumTest = FMaximumNumTest<T>;                                        \
-  TEST_F(LlvmLibcFMaximumNumTest, NaN) { testNaN(&func); }                            \
-  TEST_F(LlvmLibcFMaximumNumTest, InfArg) { testInfArg(&func); }                      \
-  TEST_F(LlvmLibcFMaximumNumTest, NegInfArg) { testNegInfArg(&func); }                \
-  TEST_F(LlvmLibcFMaximumNumTest, BothZero) { testBothZero(&func); }                  \
+#define LIST_FMAXIMUM_NUM_TESTS(T, func)                                       \
+  using LlvmLibcFMaximumNumTest = FMaximumNumTest<T>;                          \
+  TEST_F(LlvmLibcFMaximumNumTest, NaN) { testNaN(&func); }                     \
+  TEST_F(LlvmLibcFMaximumNumTest, InfArg) { testInfArg(&func); }               \
+  TEST_F(LlvmLibcFMaximumNumTest, NegInfArg) { testNegInfArg(&func); }         \
+  TEST_F(LlvmLibcFMaximumNumTest, BothZero) { testBothZero(&func); }           \
   TEST_F(LlvmLibcFMaximumNumTest, Range) { testRange(&func); }
 
 #endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMNUMTEST_H
diff --git a/libc/test/src/math/smoke/FMaximumTest.h b/libc/test/src/math/smoke/FMaximumTest.h
index 7ba1173907a2fe..6333c2619bfb19 100644
--- a/libc/test/src/math/smoke/FMaximumTest.h
+++ b/libc/test/src/math/smoke/FMaximumTest.h
@@ -1,4 +1,5 @@
-//===-- Utility class to test fmaximum[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fmaximum[f|l] -------------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -12,7 +13,8 @@
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
 
-template <typename T> class FMaximumTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class FMaximumTest : public LIBC_NAMESPACE::testing::Test {
 
   DECLARE_SPECIAL_CONSTANTS(T)
 
@@ -76,12 +78,12 @@ template <typename T> class FMaximumTest : public LIBC_NAMESPACE::testing::Test
   }
 };
 
-#define LIST_FMAXIMUM_TESTS(T, func)                                               \
-  using LlvmLibcFMaximumTest = FMaximumTest<T>;                                        \
-  TEST_F(LlvmLibcFMaximumTest, NaN) { testNaN(&func); }                            \
-  TEST_F(LlvmLibcFMaximumTest, InfArg) { testInfArg(&func); }                      \
-  TEST_F(LlvmLibcFMaximumTest, NegInfArg) { testNegInfArg(&func); }                \
-  TEST_F(LlvmLibcFMaximumTest, BothZero) { testBothZero(&func); }                  \
+#define LIST_FMAXIMUM_TESTS(T, func)                                           \
+  using LlvmLibcFMaximumTest = FMaximumTest<T>;                                \
+  TEST_F(LlvmLibcFMaximumTest, NaN) { testNaN(&func); }                        \
+  TEST_F(LlvmLibcFMaximumTest, InfArg) { testInfArg(&func); }                  \
+  TEST_F(LlvmLibcFMaximumTest, NegInfArg) { testNegInfArg(&func); }            \
+  TEST_F(LlvmLibcFMaximumTest, BothZero) { testBothZero(&func); }              \
   TEST_F(LlvmLibcFMaximumTest, Range) { testRange(&func); }
 
 #endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMTEST_H
diff --git a/libc/test/src/math/smoke/FMinimumMagNumTest.h b/libc/test/src/math/smoke/FMinimumMagNumTest.h
index e8af72c90684b7..2e5d53fc3d6db6 100644
--- a/libc/test/src/math/smoke/FMinimumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumMagNumTest.h
@@ -1,4 +1,5 @@
-//===-- Utility class to test fminimum_mag_num[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fminimum_mag_num[f|l] -------------------------*-
+//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,11 +10,12 @@
 #ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMMAG_NUMTEST_H
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMMAG_NUMTEST_H
 
+#include "src/__support/FPUtil/BasicOperations.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
-#include "src/__support/FPUtil/BasicOperations.h"
 
-template <typename T> class FMinimumMagNumTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class FMinimumMagNumTest : public LIBC_NAMESPACE::testing::Test {
 
   DECLARE_SPECIAL_CONSTANTS(T)
 
@@ -77,12 +79,12 @@ template <typename T> class FMinimumMagNumTest : public LIBC_NAMESPACE::testing:
   }
 };
 
-#define LIST_FMINIMUM_MAG_NUM_TESTS(T, func)                                               \
-  using LlvmLibcFMinimumMagNumTest = FMinimumMagNumTest<T>;                                        \
-  TEST_F(LlvmLibcFMinimumMagNumTest, NaN) { testNaN(&func); }                            \
-  TEST_F(LlvmLibcFMinimumMagNumTest, InfArg) { testInfArg(&func); }                      \
-  TEST_F(LlvmLibcFMinimumMagNumTest, NegInfArg) { testNegInfArg(&func); }                \
-  TEST_F(LlvmLibcFMinimumMagNumTest, BothZero) { testBothZero(&func); }                  \
+#define LIST_FMINIMUM_MAG_NUM_TESTS(T, func)                                   \
+  using LlvmLibcFMinimumMagNumTest = FMinimumMagNumTest<T>;                    \
+  TEST_F(LlvmLibcFMinimumMagNumTest, NaN) { testNaN(&func); }                  \
+  TEST_F(LlvmLibcFMinimumMagNumTest, InfArg) { testInfArg(&func); }            \
+  TEST_F(LlvmLibcFMinimumMagNumTest, NegInfArg) { testNegInfArg(&func); }      \
+  TEST_F(LlvmLibcFMinimumMagNumTest, BothZero) { testBothZero(&func); }        \
   TEST_F(LlvmLibcFMinimumMagNumTest, Range) { testRange(&func); }
 
 #endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMMAG_NUMTEST_H
diff --git a/libc/test/src/math/smoke/FMinimumMagTest.h b/libc/test/src/math/smoke/FMinimumMagTest.h
index 5cbe2685b458d3..20382d27635ba2 100644
--- a/libc/test/src/math/smoke/FMinimumMagTest.h
+++ b/libc/test/src/math/smoke/FMinimumMagTest.h
@@ -1,4 +1,5 @@
-//===-- Utility class to test fminimum_mag[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fminimum_mag[f|l] -------------------------*- 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,11 +10,12 @@
 #ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUM_MAGTEST_H
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUM_MAGTEST_H
 
+#include "src/__support/FPUtil/BasicOperations.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
-#include "src/__support/FPUtil/BasicOperations.h"
 
-template <typename T> class FMinimumMagTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class FMinimumMagTest : public LIBC_NAMESPACE::testing::Test {
 
   DECLARE_SPECIAL_CONSTANTS(T)
 
@@ -77,12 +79,12 @@ template <typename T> class FMinimumMagTest : public LIBC_NAMESPACE::testing::Te
   }
 };
 
-#define LIST_FMINIMUM_MAG_TESTS(T, func)                                               \
-  using LlvmLibcFMinimumMagTest = FMinimumMagTest<T>;                                        \
-  TEST_F(LlvmLibcFMinimumMagTest, NaN) { testNaN(&func); }                            \
-  TEST_F(LlvmLibcFMinimumMagTest, InfArg) { testInfArg(&func); }                      \
-  TEST_F(LlvmLibcFMinimumMagTest, NegInfArg) { testNegInfArg(&func); }                \
-  TEST_F(LlvmLibcFMinimumMagTest, BothZero) { testBothZero(&func); }                  \
+#define LIST_FMINIMUM_MAG_TESTS(T, func)                                       \
+  using LlvmLibcFMinimumMagTest = FMinimumMagTest<T>;                          \
+  TEST_F(LlvmLibcFMinimumMagTest, NaN) { testNaN(&func); }                     \
+  TEST_F(LlvmLibcFMinimumMagTest, InfArg) { testInfArg(&func); }               \
+  TEST_F(LlvmLibcFMinimumMagTest, NegInfArg) { testNegInfArg(&func); }         \
+  TEST_F(LlvmLibcFMinimumMagTest, BothZero) { testBothZero(&func); }           \
   TEST_F(LlvmLibcFMinimumMagTest, Range) { testRange(&func); }
 
 #endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUM_MAGTEST_H
diff --git a/libc/test/src/math/smoke/FMinimumNumTest.h b/libc/test/src/math/smoke/FMinimumNumTest.h
index d73d4838a935e7..1419786d3d3353 100644
--- a/libc/test/src/math/smoke/FMinimumNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumNumTest.h
@@ -1,4 +1,5 @@
-//===-- Utility class to test fminimum_num[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fminimum_num[f|l] -------------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -12,7 +13,8 @@
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
 
-template <typename T> class FMinimumNumTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class FMinimumNumTest : public LIBC_NAMESPACE::testing::Test {
 
   DECLARE_SPECIAL_CONSTANTS(T)
 
@@ -54,7 +56,7 @@ template <typename T> class FMinimumNumTest : public LIBC_NAMESPACE::testing::Te
 
   void testRange(FMinimumNumFunc func) {
     constexpr StorageType COUNT = 100'001;
-    constexpr StorageType STEP = STORAGE_MAX/ COUNT;
+    constexpr StorageType STEP = STORAGE_MAX / COUNT;
     for (StorageType i = 0, v = 0, w = STORAGE_MAX; i <= COUNT;
          ++i, v += STEP, w -= STEP) {
       FPBits xbits(v), ybits(w);
@@ -76,12 +78,12 @@ template <typename T> class FMinimumNumTest : public LIBC_NAMESPACE::testing::Te
   }
 };
 
-#define LIST_FMINIMUM_NUM_TESTS(T, func)                                               \
-  using LlvmLibcFMinimumNumTest = FMinimumNumTest<T>;                                        \
-  TEST_F(LlvmLibcFMinimumNumTest, NaN) { testNaN(&func); }                            \
-  TEST_F(LlvmLibcFMinimumNumTest, InfArg) { testInfArg(&func); }                      \
-  TEST_F(LlvmLibcFMinimumNumTest, NegInfArg) { testNegInfArg(&func); }                \
-  TEST_F(LlvmLibcFMinimumNumTest, BothZero) { testBothZero(&func); }                  \
+#define LIST_FMINIMUM_NUM_TESTS(T, func)                                       \
+  using LlvmLibcFMinimumNumTest = FMinimumNumTest<T>;                          \
+  TEST_F(LlvmLibcFMinimumNumTest, NaN) { testNaN(&func); }                     \
+  TEST_F(LlvmLibcFMinimumNumTest, InfArg) { testInfArg(&func); }               \
+  TEST_F(LlvmLibcFMinimumNumTest, NegInfArg) { testNegInfArg(&func); }         \
+  TEST_F(LlvmLibcFMinimumNumTest, BothZero) { testBothZero(&func); }           \
   TEST_F(LlvmLibcFMinimumNumTest, Range) { testRange(&func); }
 
 #endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMNUMTEST_H
diff --git a/libc/test/src/math/smoke/FMinimumTest.h b/libc/test/src/math/smoke/FMinimumTest.h
index 91e1fb9d580afe..496aa566419307 100644
--- a/libc/test/src/math/smoke/FMinimumTest.h
+++ b/libc/test/src/math/smoke/FMinimumTest.h
@@ -1,4 +1,5 @@
-//===-- Utility class to test fminimum[f|l] -------------------------*- C++ -*-===//
+//===-- Utility class to test fminimum[f|l] -------------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -12,7 +13,8 @@
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
 
-template <typename T> class FMinimumTest : public LIBC_NAMESPACE::testing::Test {
+template <typename T>
+class FMinimumTest : public LIBC_NAMESPACE::testing::Test {
 
   DECLARE_SPECIAL_CONSTANTS(T)
 
@@ -76,12 +78,12 @@ template <typename T> class FMinimumTest : public LIBC_NAMESPACE::testing::Test
   }
 };
 
-#define LIST_FMINIMUM_TESTS(T, func)                                               \
-  using LlvmLibcFMinimumTest = FMinimumTest<T>;                                        \
-  TEST_F(LlvmLibcFMinimumTest, NaN) { testNaN(&func); }                            \
-  TEST_F(LlvmLibcFMinimumTest, InfArg) { testInfArg(&func); }                      \
-  TEST_F(LlvmLibcFMinimumTest, NegInfArg) { testNegInfArg(&func); }                \
-  TEST_F(LlvmLibcFMinimumTest, BothZero) { testBothZero(&func); }                  \
+#define LIST_FMINIMUM_TESTS(T, func)                                           \
+  using LlvmLibcFMinimumTest = FMinimumTest<T>;                                \
+  TEST_F(LlvmLibcFMinimumTest, NaN) { testNaN(&func); }                        \
+  TEST_F(LlvmLibcFMinimumTest, InfArg) { testInfArg(&func); }                  \
+  TEST_F(LlvmLibcFMinimumTest, NegInfArg) { testNegInfArg(&func); }            \
+  TEST_F(LlvmLibcFMinimumTest, BothZero) { testBothZero(&func); }              \
   TEST_F(LlvmLibcFMinimumTest, Range) { testRange(&func); }
 
 #endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMTEST_H
diff --git a/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
index 7db8c69caa1418..aa83f1d7d47ecb 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_mag_num -----------------------------------------------===//
+//===-- Unittests for fmaximum_mag_num
+//-----------------------------------------------===//
 //
 // 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/fmaximum_mag_numf128_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
index 5fd0beccee43c7..5473b9b0edf329 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_mag_numf128 --------------------------------------------===//
+//===-- Unittests for fmaximum_mag_numf128
+//--------------------------------------------===//
 //
 // 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/fmaximum_mag_numf_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
index 2eaa0d5110a519..86ce1d4d39764f 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_mag_numf -----------------------------------------------===//
+//===-- Unittests for fmaximum_mag_numf
+//-----------------------------------------------===//
 //
 // 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/fmaximum_mag_numl_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
index 687abbf5db40a0..811490f72143b9 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_mag_numl -----------------------------------------------===//
+//===-- Unittests for fmaximum_mag_numl
+//-----------------------------------------------===//
 //
 // 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/fmaximum_mag_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_test.cpp
index 5968ebb5f938b9..5e419da731e036 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_mag -----------------------------------------------===//
+//===-- Unittests for fmaximum_mag
+//-----------------------------------------------===//
 //
 // 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/fmaximum_magf128_test.cpp b/libc/test/src/math/smoke/fmaximum_magf128_test.cpp
index 7c93c94cbedfff..362644a7f24f22 100644
--- a/libc/test/src/math/smoke/fmaximum_magf128_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_magf128_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_magf128 --------------------------------------------===//
+//===-- Unittests for fmaximum_magf128
+//--------------------------------------------===//
 //
 // 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/fmaximum_magf_test.cpp b/libc/test/src/math/smoke/fmaximum_magf_test.cpp
index 8347c4a443b99b..fb40bb7ab75a67 100644
--- a/libc/test/src/math/smoke/fmaximum_magf_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_magf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_magf -----------------------------------------------===//
+//===-- Unittests for fmaximum_magf
+//-----------------------------------------------===//
 //
 // 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/fmaximum_magl_test.cpp b/libc/test/src/math/smoke/fmaximum_magl_test.cpp
index 21224514cb9dff..b8d52323739074 100644
--- a/libc/test/src/math/smoke/fmaximum_magl_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_magl_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_magl -----------------------------------------------===//
+//===-- Unittests for fmaximum_magl
+//-----------------------------------------------===//
 //
 // 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/fmaximum_num_test.cpp b/libc/test/src/math/smoke/fmaximum_num_test.cpp
index d50cf32bcdc257..a24953960020fa 100644
--- a/libc/test/src/math/smoke/fmaximum_num_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_num_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_num -----------------------------------------------===//
+//===-- Unittests for fmaximum_num
+//-----------------------------------------------===//
 //
 // 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/fmaximum_numf128_test.cpp b/libc/test/src/math/smoke/fmaximum_numf128_test.cpp
index d15b2b9b966ca9..3e866510874dce 100644
--- a/libc/test/src/math/smoke/fmaximum_numf128_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_numf128_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_numf128 --------------------------------------------===//
+//===-- Unittests for fmaximum_numf128
+//--------------------------------------------===//
 //
 // 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/fmaximum_numf_test.cpp b/libc/test/src/math/smoke/fmaximum_numf_test.cpp
index 98595ed1df4355..9e1b62043d73f0 100644
--- a/libc/test/src/math/smoke/fmaximum_numf_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_numf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_numf -----------------------------------------------===//
+//===-- Unittests for fmaximum_numf
+//-----------------------------------------------===//
 //
 // 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/fmaximum_numl_test.cpp b/libc/test/src/math/smoke/fmaximum_numl_test.cpp
index 0f73981d2096e8..8695a406499052 100644
--- a/libc/test/src/math/smoke/fmaximum_numl_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_numl_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum_numl -----------------------------------------------===//
+//===-- Unittests for fmaximum_numl
+//-----------------------------------------------===//
 //
 // 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/fmaximum_test.cpp b/libc/test/src/math/smoke/fmaximum_test.cpp
index 21be2023e1b4b1..ceb877a3b0d39c 100644
--- a/libc/test/src/math/smoke/fmaximum_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximum -----------------------------------------------===//
+//===-- Unittests for fmaximum
+//-----------------------------------------------===//
 //
 // 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/fmaximumf128_test.cpp b/libc/test/src/math/smoke/fmaximumf128_test.cpp
index 040c6ee6291f80..1e629c2b8518ce 100644
--- a/libc/test/src/math/smoke/fmaximumf128_test.cpp
+++ b/libc/test/src/math/smoke/fmaximumf128_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximumf128 --------------------------------------------===//
+//===-- Unittests for fmaximumf128
+//--------------------------------------------===//
 //
 // 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/fmaximumf_test.cpp b/libc/test/src/math/smoke/fmaximumf_test.cpp
index 5ea2efa0b7ce5b..9b3340ac9f8062 100644
--- a/libc/test/src/math/smoke/fmaximumf_test.cpp
+++ b/libc/test/src/math/smoke/fmaximumf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximumf -----------------------------------------------===//
+//===-- Unittests for fmaximumf
+//-----------------------------------------------===//
 //
 // 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/fmaximuml_test.cpp b/libc/test/src/math/smoke/fmaximuml_test.cpp
index fd780c2719603d..fa0c9557ed5909 100644
--- a/libc/test/src/math/smoke/fmaximuml_test.cpp
+++ b/libc/test/src/math/smoke/fmaximuml_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fmaximuml -----------------------------------------------===//
+//===-- Unittests for fmaximuml
+//-----------------------------------------------===//
 //
 // 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/fminimum_mag_num_test.cpp b/libc/test/src/math/smoke/fminimum_mag_num_test.cpp
index e3b8de746b271c..88ee0b1df5de80 100644
--- a/libc/test/src/math/smoke/fminimum_mag_num_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_num_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_mag_num -----------------------------------------------===//
+//===-- Unittests for fminimum_mag_num
+//-----------------------------------------------===//
 //
 // 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/fminimum_mag_numf128.cpp b/libc/test/src/math/smoke/fminimum_mag_numf128.cpp
index 752d3ebe99d95f..4533c621b4932b 100644
--- a/libc/test/src/math/smoke/fminimum_mag_numf128.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_numf128.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_mag_numf128 --------------------------------------------===//
+//===-- Unittests for fminimum_mag_numf128
+//--------------------------------------------===//
 //
 // 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/fminimum_mag_numf_test.cpp b/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
index ffb0086e85d398..643d1f702e595d 100644
--- a/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_mag_numf -----------------------------------------------===//
+//===-- Unittests for fminimum_mag_numf
+//-----------------------------------------------===//
 //
 // 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/fminimum_mag_numl_test.cpp b/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
index e539d8711680a6..18ebcd09aeccb7 100644
--- a/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_mag_numl -----------------------------------------------===//
+//===-- Unittests for fminimum_mag_numl
+//-----------------------------------------------===//
 //
 // 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/fminimum_mag_test.cpp b/libc/test/src/math/smoke/fminimum_mag_test.cpp
index 5c13385a4db734..6f84166e831a98 100644
--- a/libc/test/src/math/smoke/fminimum_mag_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_mag -----------------------------------------------===//
+//===-- Unittests for fminimum_mag
+//-----------------------------------------------===//
 //
 // 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/fminimum_magf128_test.cpp b/libc/test/src/math/smoke/fminimum_magf128_test.cpp
index 746159c28baa6e..d6a1710db9435d 100644
--- a/libc/test/src/math/smoke/fminimum_magf128_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_magf128_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_magf128 --------------------------------------------===//
+//===-- Unittests for fminimum_magf128
+//--------------------------------------------===//
 //
 // 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/fminimum_magf_test.cpp b/libc/test/src/math/smoke/fminimum_magf_test.cpp
index 081a36e318046c..35f7f5563c9d82 100644
--- a/libc/test/src/math/smoke/fminimum_magf_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_magf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_magf -----------------------------------------------===//
+//===-- Unittests for fminimum_magf
+//-----------------------------------------------===//
 //
 // 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/fminimum_magl_test.cpp b/libc/test/src/math/smoke/fminimum_magl_test.cpp
index 865bb3ff4f4fd4..18e3c52a012bd9 100644
--- a/libc/test/src/math/smoke/fminimum_magl_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_magl_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_magl -----------------------------------------------===//
+//===-- Unittests for fminimum_magl
+//-----------------------------------------------===//
 //
 // 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/fminimum_num_test.cpp b/libc/test/src/math/smoke/fminimum_num_test.cpp
index fdeff15624be94..7cc5a699e7e7c3 100644
--- a/libc/test/src/math/smoke/fminimum_num_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_num_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_num -----------------------------------------------===//
+//===-- Unittests for fminimum_num
+//-----------------------------------------------===//
 //
 // 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/fminimum_numf128_test.cpp b/libc/test/src/math/smoke/fminimum_numf128_test.cpp
index f61981331c33b0..a01ea20e57a125 100644
--- a/libc/test/src/math/smoke/fminimum_numf128_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_numf128_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_numf128 --------------------------------------------===//
+//===-- Unittests for fminimum_numf128
+//--------------------------------------------===//
 //
 // 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/fminimum_numf_test.cpp b/libc/test/src/math/smoke/fminimum_numf_test.cpp
index 36929565fb900c..971acc51684751 100644
--- a/libc/test/src/math/smoke/fminimum_numf_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_numf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_numf -----------------------------------------------===//
+//===-- Unittests for fminimum_numf
+//-----------------------------------------------===//
 //
 // 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/fminimum_numl_test.cpp b/libc/test/src/math/smoke/fminimum_numl_test.cpp
index 5ead7b6af8f1ab..b1b22aaac50486 100644
--- a/libc/test/src/math/smoke/fminimum_numl_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_numl_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum_numl -----------------------------------------------===//
+//===-- Unittests for fminimum_numl
+//-----------------------------------------------===//
 //
 // 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/fminimum_test.cpp b/libc/test/src/math/smoke/fminimum_test.cpp
index 74366477cde121..e9e057bbd98e38 100644
--- a/libc/test/src/math/smoke/fminimum_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimum -----------------------------------------------===//
+//===-- Unittests for fminimum
+//-----------------------------------------------===//
 //
 // 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/fminimumf128_test.cpp b/libc/test/src/math/smoke/fminimumf128_test.cpp
index 842e2ef2ad7633..06302459bacc40 100644
--- a/libc/test/src/math/smoke/fminimumf128_test.cpp
+++ b/libc/test/src/math/smoke/fminimumf128_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimumf128 --------------------------------------------===//
+//===-- Unittests for fminimumf128
+//--------------------------------------------===//
 //
 // 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/fminimumf_test.cpp b/libc/test/src/math/smoke/fminimumf_test.cpp
index e9817d62b1c692..53659e9c709935 100644
--- a/libc/test/src/math/smoke/fminimumf_test.cpp
+++ b/libc/test/src/math/smoke/fminimumf_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimumf -----------------------------------------------===//
+//===-- Unittests for fminimumf
+//-----------------------------------------------===//
 //
 // 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/fminimuml_test.cpp b/libc/test/src/math/smoke/fminimuml_test.cpp
index 846b0cc02bae68..bbb979bb02ec06 100644
--- a/libc/test/src/math/smoke/fminimuml_test.cpp
+++ b/libc/test/src/math/smoke/fminimuml_test.cpp
@@ -1,4 +1,5 @@
-//===-- Unittests for fminimuml -----------------------------------------------===//
+//===-- Unittests for fminimuml
+//-----------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

>From 855925a14a4998777a5fd5b4f7ece85cc27fb291 Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Thu, 21 Mar 2024 23:27:50 -0700
Subject: [PATCH 3/9] address review

---
 libc/config/linux/aarch64/entrypoints.txt     |  8 +++
 libc/config/linux/riscv/entrypoints.txt       |  8 +++
 libc/config/linux/x86_64/entrypoints.txt      |  8 +++
 libc/config/windows/entrypoints.txt           |  2 +-
 libc/src/__support/FPUtil/BasicOperations.h   | 72 +++++++++----------
 libc/src/math/amdgpu/fmaximum.cpp             |  3 +-
 libc/src/math/amdgpu/fmaximum_mag.cpp         |  3 +-
 libc/src/math/amdgpu/fmaximum_mag_num.cpp     |  3 +-
 libc/src/math/amdgpu/fmaximum_mag_numf.cpp    |  3 +-
 libc/src/math/amdgpu/fmaximum_mag_numl.cpp    |  3 +-
 libc/src/math/amdgpu/fmaximum_magf.cpp        |  3 +-
 libc/src/math/amdgpu/fmaximum_magl.cpp        |  3 +-
 libc/src/math/amdgpu/fmaximum_num.cpp         |  3 +-
 libc/src/math/amdgpu/fmaximum_numf.cpp        |  4 +-
 libc/src/math/amdgpu/fmaximum_numl.cpp        |  3 +-
 libc/src/math/amdgpu/fmaximumf.cpp            |  3 +-
 libc/src/math/amdgpu/fmaximuml.cpp            |  3 +-
 libc/src/math/amdgpu/fminimum.cpp             |  3 +-
 libc/src/math/amdgpu/fminimum_mag.cpp         |  3 +-
 libc/src/math/amdgpu/fminimum_mag_num.cpp     |  3 +-
 libc/src/math/amdgpu/fminimum_mag_numf.cpp    |  3 +-
 libc/src/math/amdgpu/fminimum_mag_numl.cpp    |  3 +-
 libc/src/math/amdgpu/fminimum_magf.cpp        |  3 +-
 libc/src/math/amdgpu/fminimum_magl.cpp        |  3 +-
 libc/src/math/amdgpu/fminimum_num.cpp         |  4 +-
 libc/src/math/amdgpu/fminimum_numf.cpp        |  3 +-
 libc/src/math/amdgpu/fminimum_numl.cpp        |  3 +-
 libc/src/math/amdgpu/fminimumf.cpp            |  3 +-
 libc/src/math/amdgpu/fminimuml.cpp            |  3 +-
 libc/src/math/fmaximum_mag.h                  |  2 +-
 libc/src/math/fmaximum_mag_num.h              |  3 +-
 libc/src/math/fmaximum_mag_numf.h             |  4 +-
 libc/src/math/fmaximum_mag_numf128.h          |  4 +-
 libc/src/math/fmaximum_mag_numl.h             |  4 +-
 libc/src/math/fminimum_mag_num.h              |  4 +-
 libc/src/math/fminimum_mag_numf.h             |  4 +-
 libc/src/math/fminimum_mag_numf128.h          |  4 +-
 libc/src/math/fminimum_mag_numl.h             |  4 +-
 libc/src/math/generic/fmaximum.cpp            |  3 +-
 libc/src/math/generic/fmaximum_mag.cpp        |  3 +-
 libc/src/math/generic/fmaximum_mag_num.cpp    |  3 +-
 libc/src/math/generic/fmaximum_mag_numf.cpp   |  3 +-
 .../src/math/generic/fmaximum_mag_numf128.cpp |  3 +-
 libc/src/math/generic/fmaximum_mag_numl.cpp   |  3 +-
 libc/src/math/generic/fmaximum_magf.cpp       |  3 +-
 libc/src/math/generic/fmaximum_magf128.cpp    |  3 +-
 libc/src/math/generic/fmaximum_magl.cpp       |  3 +-
 libc/src/math/generic/fmaximum_num.cpp        |  3 +-
 libc/src/math/generic/fmaximum_numf.cpp       |  3 +-
 libc/src/math/generic/fmaximum_numf128.cpp    |  3 +-
 libc/src/math/generic/fmaximum_numl.cpp       |  3 +-
 libc/src/math/generic/fmaximumf.cpp           |  3 +-
 libc/src/math/generic/fmaximumf128.cpp        |  3 +-
 libc/src/math/generic/fmaximuml.cpp           |  3 +-
 libc/src/math/generic/fminimum.cpp            |  3 +-
 libc/src/math/generic/fminimum_mag.cpp        |  3 +-
 libc/src/math/generic/fminimum_mag_num.cpp    |  3 +-
 libc/src/math/generic/fminimum_mag_numf.cpp   |  3 +-
 .../src/math/generic/fminimum_mag_numf128.cpp |  3 +-
 libc/src/math/generic/fminimum_mag_numl.cpp   |  3 +-
 libc/src/math/generic/fminimum_magf.cpp       |  3 +-
 libc/src/math/generic/fminimum_magf128.cpp    |  3 +-
 libc/src/math/generic/fminimum_magl.cpp       |  3 +-
 libc/src/math/generic/fminimum_num.cpp        |  3 +-
 libc/src/math/generic/fminimum_numf.cpp       |  3 +-
 libc/src/math/generic/fminimum_numf128.cpp    |  3 +-
 libc/src/math/generic/fminimum_numl.cpp       |  3 +-
 libc/src/math/generic/fminimumf.cpp           |  3 +-
 libc/src/math/generic/fminimumf128.cpp        |  3 +-
 libc/src/math/generic/fminimuml.cpp           |  3 +-
 libc/test/src/math/smoke/FMaximumMagNumTest.h |  5 +-
 libc/test/src/math/smoke/FMaximumMagTest.h    |  5 +-
 libc/test/src/math/smoke/FMaximumNumTest.h    |  5 +-
 libc/test/src/math/smoke/FMaximumTest.h       |  3 +-
 libc/test/src/math/smoke/FMinimumMagNumTest.h |  5 +-
 libc/test/src/math/smoke/FMinimumMagTest.h    |  5 +-
 libc/test/src/math/smoke/FMinimumNumTest.h    |  3 +-
 libc/test/src/math/smoke/FMinimumTest.h       |  3 +-
 .../src/math/smoke/fmaximum_mag_num_test.cpp  |  3 +-
 .../math/smoke/fmaximum_mag_numf128_test.cpp  |  5 +-
 .../src/math/smoke/fmaximum_mag_numf_test.cpp |  3 +-
 .../src/math/smoke/fmaximum_mag_numl_test.cpp |  3 +-
 .../test/src/math/smoke/fmaximum_mag_test.cpp |  3 +-
 .../src/math/smoke/fmaximum_magf128_test.cpp  |  3 +-
 .../src/math/smoke/fmaximum_magf_test.cpp     |  3 +-
 .../src/math/smoke/fmaximum_magl_test.cpp     |  3 +-
 .../test/src/math/smoke/fmaximum_num_test.cpp |  3 +-
 .../src/math/smoke/fmaximum_numf128_test.cpp  |  3 +-
 .../src/math/smoke/fmaximum_numf_test.cpp     |  3 +-
 .../src/math/smoke/fmaximum_numl_test.cpp     |  3 +-
 libc/test/src/math/smoke/fmaximum_test.cpp    |  3 +-
 .../test/src/math/smoke/fmaximumf128_test.cpp |  3 +-
 libc/test/src/math/smoke/fmaximumf_test.cpp   |  3 +-
 libc/test/src/math/smoke/fmaximuml_test.cpp   |  3 +-
 .../src/math/smoke/fminimum_mag_num_test.cpp  |  3 +-
 ...f128.cpp => fminimum_mag_numf128_test.cpp} |  3 +-
 .../src/math/smoke/fminimum_mag_numf_test.cpp |  3 +-
 .../src/math/smoke/fminimum_mag_numl_test.cpp |  3 +-
 .../test/src/math/smoke/fminimum_mag_test.cpp |  3 +-
 .../src/math/smoke/fminimum_magf128_test.cpp  |  3 +-
 .../src/math/smoke/fminimum_magf_test.cpp     |  3 +-
 .../src/math/smoke/fminimum_magl_test.cpp     |  3 +-
 .../test/src/math/smoke/fminimum_num_test.cpp |  3 +-
 .../src/math/smoke/fminimum_numf128_test.cpp  |  3 +-
 .../src/math/smoke/fminimum_numf_test.cpp     |  3 +-
 .../src/math/smoke/fminimum_numl_test.cpp     |  3 +-
 libc/test/src/math/smoke/fminimum_test.cpp    |  3 +-
 .../test/src/math/smoke/fminimumf128_test.cpp |  3 +-
 libc/test/src/math/smoke/fminimumf_test.cpp   |  3 +-
 libc/test/src/math/smoke/fminimuml_test.cpp   |  3 +-
 110 files changed, 177 insertions(+), 256 deletions(-)
 rename libc/test/src/math/smoke/{fminimum_mag_numf128.cpp => fminimum_mag_numf128_test.cpp} (82%)

diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 56fb490104f67b..0e6df30f55cc1f 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -481,6 +481,14 @@ if(LIBC_TYPES_HAS_FLOAT128)
     libc.src.math.floorf128
     libc.src.math.fmaxf128
     libc.src.math.fminf128
+    libc.src.math.fmaximumf128
+    libc.src.math.fmaximum_numf128
+    libc.src.math.fmaximum_magf128
+    libc.src.math.fmaximum_mag_numf128
+    libc.src.math.fminimumf128
+    libc.src.math.fminimum_numf128
+    libc.src.math.fminimum_magf128
+    libc.src.math.fminimum_mag_numf128
     libc.src.math.fmodf128
     libc.src.math.frexpf128
     libc.src.math.ilogbf128
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 456baff250e101..d51214ae4e37ce 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -489,6 +489,14 @@ if(LIBC_TYPES_HAS_FLOAT128)
     libc.src.math.floorf128
     libc.src.math.fmaxf128
     libc.src.math.fminf128
+    libc.src.math.fmaximumf128
+    libc.src.math.fmaximum_numf128
+    libc.src.math.fmaximum_magf128
+    libc.src.math.fmaximum_mag_numf128
+    libc.src.math.fminimumf128
+    libc.src.math.fminimum_numf128
+    libc.src.math.fminimum_magf128
+    libc.src.math.fminimum_mag_numf128
     libc.src.math.fmodf128
     libc.src.math.frexpf128
     libc.src.math.ilogbf128
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 65f95a92a538ff..6f3bf9372503bb 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -500,6 +500,14 @@ if(LIBC_TYPES_HAS_FLOAT128)
     libc.src.math.floorf128
     libc.src.math.fmaxf128
     libc.src.math.fminf128
+    libc.src.math.fmaximumf128
+    libc.src.math.fmaximum_numf128
+    libc.src.math.fmaximum_magf128
+    libc.src.math.fmaximum_mag_numf128
+    libc.src.math.fminimumf128
+    libc.src.math.fminimum_numf128
+    libc.src.math.fminimum_magf128
+    libc.src.math.fminimum_mag_numf128
     libc.src.math.fmodf128
     libc.src.math.frexpf128
     libc.src.math.ilogbf128
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index 1a1d92b1f2afe7..f4456f561ec017 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -1,4 +1,4 @@
-fset(TARGET_LIBC_ENTRYPOINTS
+set(TARGET_LIBC_ENTRYPOINTS
     # ctype.h entrypoints
     libc.src.ctype.isalnum
     libc.src.ctype.isalpha
diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index c269da69791fdd..5c35b55178fd5c 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -64,16 +64,14 @@ LIBC_INLINE T fmaximum(T x, T y) {
 
   if (bitx.is_nan()) {
     return x;
-  } else if (bity.is_nan()) {
+  }
+  if (bity.is_nan()) {
     return y;
-  } else if (bitx.sign() != bity.sign()) {
-    // To make sure that fmax(+0, -0) == +0 == fmax(-0, +0), whenever x and
-    // y has different signs and both are not NaNs, we return the number
-    // with positive sign.
+  }
+  if (bitx.sign() != bity.sign()) {
     return (bitx.is_neg() ? y : x);
-  } else {
-    return (x > y ? x : y);
   }
+  return x > y ? x : y;
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -82,16 +80,14 @@ LIBC_INLINE T fminimum(T x, T y) {
 
   if (bitx.is_nan()) {
     return x;
-  } else if (bity.is_nan()) {
+  }
+  if (bity.is_nan()) {
     return y;
-  } else if (bitx.sign() != bity.sign()) {
-    // To make sure that fmin(+0, -0) == -0 == fmin(-0, +0), whenever x and
-    // y has different signs and both are not NaNs, we return the number
-    // with negative sign.
+  }
+  if (bitx.sign() != bity.sign()) {
     return (bitx.is_neg()) ? x : y;
-  } else {
-    return (x < y ? x : y);
   }
+  return x < y ? x : y;
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -100,16 +96,14 @@ LIBC_INLINE T fmaximum_num(T x, T y) {
 
   if (bitx.is_nan()) {
     return y;
-  } else if (bity.is_nan()) {
+  }
+  if (bity.is_nan()) {
     return x;
-  } else if (bitx.sign() != bity.sign()) {
-    // To make sure that fmax(+0, -0) == +0 == fmax(-0, +0), whenever x and
-    // y has different signs and both are not NaNs, we return the number
-    // with positive sign.
+  }
+  if (bitx.sign() != bity.sign()) {
     return (bitx.is_neg() ? y : x);
-  } else {
-    return (x > y ? x : y);
   }
+  return x > y ? x : y;
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -118,16 +112,14 @@ LIBC_INLINE T fminimum_num(T x, T y) {
 
   if (bitx.is_nan()) {
     return y;
-  } else if (bity.is_nan()) {
+  }
+  if (bity.is_nan()) {
     return x;
-  } else if (bitx.sign() != bity.sign()) {
-    // To make sure that fmin(+0, -0) == -0 == fmin(-0, +0), whenever x and
-    // y has different signs and both are not NaNs, we return the number
-    // with negative sign.
+  }
+  if (bitx.sign() != bity.sign()) {
     return (bitx.is_neg()) ? x : y;
-  } else {
-    return (x < y ? x : y);
   }
+  return x < y ? x : y;
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -136,11 +128,11 @@ LIBC_INLINE T fmaximum_mag(T x, T y) {
 
   if (abs(x) > abs(y)) {
     return x;
-  } else if (abs(y) > abs(x)) {
+  }
+  if (abs(y) > abs(x)) {
     return y;
-  } else {
-    return fmaximum(x, y);
   }
+  return fmaximum(x, y);
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -149,11 +141,11 @@ LIBC_INLINE T fminimum_mag(T x, T y) {
 
   if (abs(x) < abs(y)) {
     return x;
-  } else if (abs(y) < abs(x)) {
+  }
+  if (abs(y) < abs(x)) {
     return y;
-  } else {
-    return fminimum(x, y);
   }
+  return fminimum(x, y);
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -162,11 +154,11 @@ LIBC_INLINE T fmaximum_mag_num(T x, T y) {
 
   if (abs(x) > abs(y)) {
     return x;
-  } else if (abs(y) > abs(x)) {
+  }
+  if (abs(y) > abs(x)) {
     return y;
-  } else {
-    return fmaximum_num(x, y);
   }
+  return fmaximum_num(x, y);
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
@@ -175,11 +167,11 @@ LIBC_INLINE T fminimum_mag_num(T x, T y) {
 
   if (abs(x) < abs(y)) {
     return x;
-  } else if (abs(y) < abs(x)) {
+  }
+  if (abs(y) < abs(x)) {
     return y;
-  } else {
-    return fminimum_num(x, y);
   }
+  return fminimum_num(x, y);
 }
 
 template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
diff --git a/libc/src/math/amdgpu/fmaximum.cpp b/libc/src/math/amdgpu/fmaximum.cpp
index 3b27b272cfa760..5ded0caa1c62fb 100644
--- a/libc/src/math/amdgpu/fmaximum.cpp
+++ b/libc/src/math/amdgpu/fmaximum.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum function for GPU--------------------===//
 //
 // 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/amdgpu/fmaximum_mag.cpp b/libc/src/math/amdgpu/fmaximum_mag.cpp
index ca59f53017bb55..66d120a4b861df 100644
--- a/libc/src/math/amdgpu/fmaximum_mag.cpp
+++ b/libc/src/math/amdgpu/fmaximum_mag.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum_mag function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_mag function for GPU----------------===//
 //
 // 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/amdgpu/fmaximum_mag_num.cpp b/libc/src/math/amdgpu/fmaximum_mag_num.cpp
index 1325d8a7bc14a7..3c9d39e7c61730 100644
--- a/libc/src/math/amdgpu/fmaximum_mag_num.cpp
+++ b/libc/src/math/amdgpu/fmaximum_mag_num.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum_mag_num function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_mag_num function for GPU------------===//
 //
 // 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/amdgpu/fmaximum_mag_numf.cpp b/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
index 95fc9d1b32eeb2..32cf879309d381 100644
--- a/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
+++ b/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum_mag_numf function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_mag_numf function for GPU-----------===//
 //
 // 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/amdgpu/fmaximum_mag_numl.cpp b/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
index 35d6d03dca3237..65f5d6d1a2b131 100644
--- a/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
+++ b/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum_mag_numl function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_mag_numl function for GPU-----------===//
 //
 // 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/amdgpu/fmaximum_magf.cpp b/libc/src/math/amdgpu/fmaximum_magf.cpp
index e4cf49eff8bc28..d3785b46a1aadc 100644
--- a/libc/src/math/amdgpu/fmaximum_magf.cpp
+++ b/libc/src/math/amdgpu/fmaximum_magf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum_magf function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_magf function for GPU---------------===//
 //
 // 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/amdgpu/fmaximum_magl.cpp b/libc/src/math/amdgpu/fmaximum_magl.cpp
index b6e15f7b31092e..c864afd5c177a5 100644
--- a/libc/src/math/amdgpu/fmaximum_magl.cpp
+++ b/libc/src/math/amdgpu/fmaximum_magl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum_magl function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_magl function for GPU---------------===//
 //
 // 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/amdgpu/fmaximum_num.cpp b/libc/src/math/amdgpu/fmaximum_num.cpp
index 036fb39c44f6ff..8ccc262dc70eb2 100644
--- a/libc/src/math/amdgpu/fmaximum_num.cpp
+++ b/libc/src/math/amdgpu/fmaximum_num.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum_num function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_num function for GPU----------------===//
 //
 // 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/amdgpu/fmaximum_numf.cpp b/libc/src/math/amdgpu/fmaximum_numf.cpp
index 6a0c76be098314..69379f15e9ac12 100644
--- a/libc/src/math/amdgpu/fmaximum_numf.cpp
+++ b/libc/src/math/amdgpu/fmaximum_numf.cpp
@@ -1,5 +1,5 @@
-//===-- Implementation of the fmaximum_numf function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_numf function for GPU---------------===//
+//
 //
 // 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/amdgpu/fmaximum_numl.cpp b/libc/src/math/amdgpu/fmaximum_numl.cpp
index 4b9fc891cd45e9..0929a8420d113b 100644
--- a/libc/src/math/amdgpu/fmaximum_numl.cpp
+++ b/libc/src/math/amdgpu/fmaximum_numl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximum_numl function for GPU
-//-----------------------===//
+//===-- Implementation of the fmaximum_numl function for GPU---------------===//
 //
 // 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/amdgpu/fmaximumf.cpp b/libc/src/math/amdgpu/fmaximumf.cpp
index aec326312c5a60..f0a3196b89ac79 100644
--- a/libc/src/math/amdgpu/fmaximumf.cpp
+++ b/libc/src/math/amdgpu/fmaximumf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximumf function for GPU
-//----------------------===//
+//===-- Implementation of the fmaximumf function for GPU-------------------===//
 //
 // 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/amdgpu/fmaximuml.cpp b/libc/src/math/amdgpu/fmaximuml.cpp
index 74f794368f4a50..a8df64c47e1a2d 100644
--- a/libc/src/math/amdgpu/fmaximuml.cpp
+++ b/libc/src/math/amdgpu/fmaximuml.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fmaximuml function for GPU
-//----------------------===//
+//===-- Implementation of the fmaximuml function for GPU-------------------===//
 //
 // 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/amdgpu/fminimum.cpp b/libc/src/math/amdgpu/fminimum.cpp
index f2bf6470ff3840..cc4cd689d8b37b 100644
--- a/libc/src/math/amdgpu/fminimum.cpp
+++ b/libc/src/math/amdgpu/fminimum.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum function for GPU--------------------===//
 //
 // 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/amdgpu/fminimum_mag.cpp b/libc/src/math/amdgpu/fminimum_mag.cpp
index c693de73584fe8..81467d48a5ea51 100644
--- a/libc/src/math/amdgpu/fminimum_mag.cpp
+++ b/libc/src/math/amdgpu/fminimum_mag.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum_mag function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_mag function for GPU----------------===//
 //
 // 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/amdgpu/fminimum_mag_num.cpp b/libc/src/math/amdgpu/fminimum_mag_num.cpp
index 723b98bee81094..9e6c816bfb1301 100644
--- a/libc/src/math/amdgpu/fminimum_mag_num.cpp
+++ b/libc/src/math/amdgpu/fminimum_mag_num.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum_mag_num function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_mag_num function for GPU------------===//
 //
 // 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/amdgpu/fminimum_mag_numf.cpp b/libc/src/math/amdgpu/fminimum_mag_numf.cpp
index 9d61d91edfd446..9ada6137b0aaf5 100644
--- a/libc/src/math/amdgpu/fminimum_mag_numf.cpp
+++ b/libc/src/math/amdgpu/fminimum_mag_numf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum_mag_numf function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_mag_numf function for GPU-----------===//
 //
 // 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/amdgpu/fminimum_mag_numl.cpp b/libc/src/math/amdgpu/fminimum_mag_numl.cpp
index 8a835418552fab..5ff7eaa8147c7f 100644
--- a/libc/src/math/amdgpu/fminimum_mag_numl.cpp
+++ b/libc/src/math/amdgpu/fminimum_mag_numl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum_mag_numl function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_mag_numl function for GPU-----------===//
 //
 // 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/amdgpu/fminimum_magf.cpp b/libc/src/math/amdgpu/fminimum_magf.cpp
index 07efb0e4b07942..c91a12e2f009e5 100644
--- a/libc/src/math/amdgpu/fminimum_magf.cpp
+++ b/libc/src/math/amdgpu/fminimum_magf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum_magf function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_magf function for GPU---------------===//
 //
 // 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/amdgpu/fminimum_magl.cpp b/libc/src/math/amdgpu/fminimum_magl.cpp
index 3609fe5f8a6c2d..40e8b985e5aa94 100644
--- a/libc/src/math/amdgpu/fminimum_magl.cpp
+++ b/libc/src/math/amdgpu/fminimum_magl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum_magl function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_magl function for GPU---------------===//
 //
 // 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/amdgpu/fminimum_num.cpp b/libc/src/math/amdgpu/fminimum_num.cpp
index 2f7482fc09edc0..7f5bde44b4bacb 100644
--- a/libc/src/math/amdgpu/fminimum_num.cpp
+++ b/libc/src/math/amdgpu/fminimum_num.cpp
@@ -1,5 +1,5 @@
-//===-- Implementation of the fminimum_num function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_num function for GPU----------------===//
+//
 //
 // 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/amdgpu/fminimum_numf.cpp b/libc/src/math/amdgpu/fminimum_numf.cpp
index 85fded8413e95d..574a73fc622c50 100644
--- a/libc/src/math/amdgpu/fminimum_numf.cpp
+++ b/libc/src/math/amdgpu/fminimum_numf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum_numf function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_numf function for GPU---------------===//
 //
 // 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/amdgpu/fminimum_numl.cpp b/libc/src/math/amdgpu/fminimum_numl.cpp
index 96ece96f92356e..2d00626479472a 100644
--- a/libc/src/math/amdgpu/fminimum_numl.cpp
+++ b/libc/src/math/amdgpu/fminimum_numl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimum_numl function for GPU
-//-----------------------===//
+//===-- Implementation of the fminimum_numl function for GPU---------------===//
 //
 // 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/amdgpu/fminimumf.cpp b/libc/src/math/amdgpu/fminimumf.cpp
index baf6c06d62d6dc..1128ff410cee55 100644
--- a/libc/src/math/amdgpu/fminimumf.cpp
+++ b/libc/src/math/amdgpu/fminimumf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimumf function for GPU
-//----------------------===//
+//===-- Implementation of the fminimumf function for GPU-------------------===//
 //
 // 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/amdgpu/fminimuml.cpp b/libc/src/math/amdgpu/fminimuml.cpp
index 8e1dbe9ecbd3bd..9dc114048b63ef 100644
--- a/libc/src/math/amdgpu/fminimuml.cpp
+++ b/libc/src/math/amdgpu/fminimuml.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of the fminimuml function for GPU
-//----------------------===//
+//===-- Implementation of the fminimuml function for GPU-------------------===//
 //
 // 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/fmaximum_mag.h b/libc/src/math/fmaximum_mag.h
index b338d08d54937b..31b7c0fcf7ee3e 100644
--- a/libc/src/math/fmaximum_mag.h
+++ b/libc/src/math/fmaximum_mag.h
@@ -1,4 +1,4 @@
-//===-- Implementation header for fmaximum_mag--------------------------*- C++
+//===-- Implementation header for fmaximum_mag------------------------*- C++
 //-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
diff --git a/libc/src/math/fmaximum_mag_num.h b/libc/src/math/fmaximum_mag_num.h
index 6a04737eb92313..c4ff243846e037 100644
--- a/libc/src/math/fmaximum_mag_num.h
+++ b/libc/src/math/fmaximum_mag_num.h
@@ -1,5 +1,4 @@
-//===-- Implementation header for fmaximum_mag_num--------------------------*-
-//C++ -*-===//
+//===-- Implementation header for fmaximum_mag_num---------------*- 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/fmaximum_mag_numf.h b/libc/src/math/fmaximum_mag_numf.h
index 5eac2dde1faa3d..702903ab8bcfe3 100644
--- a/libc/src/math/fmaximum_mag_numf.h
+++ b/libc/src/math/fmaximum_mag_numf.h
@@ -1,5 +1,5 @@
-//===-- Implementation header for fmaximum_mag_numf -------------------------*-
-//C++ -*-===//
+//===-- Implementation header for fmaximum_mag_numf ----------------------*- 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/fmaximum_mag_numf128.h b/libc/src/math/fmaximum_mag_numf128.h
index a98502cdf0a671..2afae7fc37c46a 100644
--- a/libc/src/math/fmaximum_mag_numf128.h
+++ b/libc/src/math/fmaximum_mag_numf128.h
@@ -1,5 +1,5 @@
-//===-- Implementation header for fmaximum_mag_numf128 ----------------------*-
-//C++ -*-===//
+//===-- Implementation header for fmaximum_mag_numf128 -------------------*- 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/fmaximum_mag_numl.h b/libc/src/math/fmaximum_mag_numl.h
index 0114d0acffb42a..32f9ae9708a655 100644
--- a/libc/src/math/fmaximum_mag_numl.h
+++ b/libc/src/math/fmaximum_mag_numl.h
@@ -1,5 +1,5 @@
-//===-- Implementation header for fmaximum_mag_numl -------------------------*-
-//C++ -*-===//
+//===-- Implementation header for fmaximum_mag_numl ----------------------*- 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/fminimum_mag_num.h b/libc/src/math/fminimum_mag_num.h
index af6b9c3dbc1f9e..eb1823018851c1 100644
--- a/libc/src/math/fminimum_mag_num.h
+++ b/libc/src/math/fminimum_mag_num.h
@@ -1,5 +1,5 @@
-//===-- Implementation header for fminimum_mag_num--------------------------*-
-//C++ -*-===//
+//===-- Implementation header for fminimum_mag_num------------------------*- 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/fminimum_mag_numf.h b/libc/src/math/fminimum_mag_numf.h
index f5fc54afdeb193..80919909113999 100644
--- a/libc/src/math/fminimum_mag_numf.h
+++ b/libc/src/math/fminimum_mag_numf.h
@@ -1,5 +1,5 @@
-//===-- Implementation header for fminimum_mag_numf -------------------------*-
-//C++ -*-===//
+//===-- Implementation header for fminimum_mag_numf ----------------------*- 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/fminimum_mag_numf128.h b/libc/src/math/fminimum_mag_numf128.h
index e644095868bd96..803c5e641d170c 100644
--- a/libc/src/math/fminimum_mag_numf128.h
+++ b/libc/src/math/fminimum_mag_numf128.h
@@ -1,5 +1,5 @@
-//===-- Implementation header for fminimum_mag_numf128 ----------------------*-
-//C++ -*-===//
+//===-- Implementation header for fminimum_mag_numf128 -------------------*- 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/fminimum_mag_numl.h b/libc/src/math/fminimum_mag_numl.h
index ce96abcad14432..fdbb183280692a 100644
--- a/libc/src/math/fminimum_mag_numl.h
+++ b/libc/src/math/fminimum_mag_numl.h
@@ -1,5 +1,5 @@
-//===-- Implementation header for fminimum_mag_numl -------------------------*-
-//C++ -*-===//
+//===-- Implementation header for fminimum_mag_numl ----------------------*- 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/fmaximum.cpp b/libc/src/math/generic/fmaximum.cpp
index c2ade3ddc1ee91..ac9593b325d4bf 100644
--- a/libc/src/math/generic/fmaximum.cpp
+++ b/libc/src/math/generic/fmaximum.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum function
-//-----------------------------------===//
+//===-- Implementation of fmaximum 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/fmaximum_mag.cpp b/libc/src/math/generic/fmaximum_mag.cpp
index c8aa6e4d49a9ea..0deb0c2835f932 100644
--- a/libc/src/math/generic/fmaximum_mag.cpp
+++ b/libc/src/math/generic/fmaximum_mag.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_mag function
-//-----------------------------------===//
+//===-- Implementation of fmaximum_mag 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/fmaximum_mag_num.cpp b/libc/src/math/generic/fmaximum_mag_num.cpp
index 2cd1c9901796c4..d0b1096b88bc66 100644
--- a/libc/src/math/generic/fmaximum_mag_num.cpp
+++ b/libc/src/math/generic/fmaximum_mag_num.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_mag_num function
-//-----------------------------------===//
+//===-- Implementation of fmaximum_mag_num 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/fmaximum_mag_numf.cpp b/libc/src/math/generic/fmaximum_mag_numf.cpp
index ec8f8a790105cd..672d3fd3b263a4 100644
--- a/libc/src/math/generic/fmaximum_mag_numf.cpp
+++ b/libc/src/math/generic/fmaximum_mag_numf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_mag_numf function
-//----------------------------------===//
+//===-- Implementation of fmaximum_mag_numf 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/fmaximum_mag_numf128.cpp b/libc/src/math/generic/fmaximum_mag_numf128.cpp
index ead2b74ba29f61..e7d13f13a09826 100644
--- a/libc/src/math/generic/fmaximum_mag_numf128.cpp
+++ b/libc/src/math/generic/fmaximum_mag_numf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_mag_numf128 function
-//-------------------------------===//
+//===-- Implementation of fmaximum_mag_numf128 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/fmaximum_mag_numl.cpp b/libc/src/math/generic/fmaximum_mag_numl.cpp
index d952487dffd808..a8499ca473b365 100644
--- a/libc/src/math/generic/fmaximum_mag_numl.cpp
+++ b/libc/src/math/generic/fmaximum_mag_numl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_mag_numl function
-//----------------------------------===//
+//===-- Implementation of fmaximum_mag_numl 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/fmaximum_magf.cpp b/libc/src/math/generic/fmaximum_magf.cpp
index 54c0dddb39cf91..380aca05a5255c 100644
--- a/libc/src/math/generic/fmaximum_magf.cpp
+++ b/libc/src/math/generic/fmaximum_magf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_magf function
-//----------------------------------===//
+//===-- Implementation of fmaximum_magf 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/fmaximum_magf128.cpp b/libc/src/math/generic/fmaximum_magf128.cpp
index 67123c71d8cf7f..301938fb7ffd3e 100644
--- a/libc/src/math/generic/fmaximum_magf128.cpp
+++ b/libc/src/math/generic/fmaximum_magf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_magf128 function
-//-------------------------------===//
+//===-- Implementation of fmaximum_magf128 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/fmaximum_magl.cpp b/libc/src/math/generic/fmaximum_magl.cpp
index e242f320103b87..283a11eda9aab6 100644
--- a/libc/src/math/generic/fmaximum_magl.cpp
+++ b/libc/src/math/generic/fmaximum_magl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_magl function
-//----------------------------------===//
+//===-- Implementation of fmaximum_magl 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/fmaximum_num.cpp b/libc/src/math/generic/fmaximum_num.cpp
index 011e7c35fe263d..23553dbcae7edb 100644
--- a/libc/src/math/generic/fmaximum_num.cpp
+++ b/libc/src/math/generic/fmaximum_num.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_num function
-//-----------------------------------===//
+//===-- Implementation of fmaximum_num 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/fmaximum_numf.cpp b/libc/src/math/generic/fmaximum_numf.cpp
index 96242d75de329e..f946ff43f543ca 100644
--- a/libc/src/math/generic/fmaximum_numf.cpp
+++ b/libc/src/math/generic/fmaximum_numf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_numf function
-//----------------------------------===//
+//===-- Implementation of fmaximum_numf 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/fmaximum_numf128.cpp b/libc/src/math/generic/fmaximum_numf128.cpp
index 9b4ccb0d93fdc4..f33a5e195bf25f 100644
--- a/libc/src/math/generic/fmaximum_numf128.cpp
+++ b/libc/src/math/generic/fmaximum_numf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_numf128 function
-//-------------------------------===//
+//===-- Implementation of fmaximum_numf128 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/fmaximum_numl.cpp b/libc/src/math/generic/fmaximum_numl.cpp
index 91812c0d65a782..503fc41409f683 100644
--- a/libc/src/math/generic/fmaximum_numl.cpp
+++ b/libc/src/math/generic/fmaximum_numl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximum_numl function
-//----------------------------------===//
+//===-- Implementation of fmaximum_numl 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/fmaximumf.cpp b/libc/src/math/generic/fmaximumf.cpp
index cf4975bf11f5c2..3b2a60931bf630 100644
--- a/libc/src/math/generic/fmaximumf.cpp
+++ b/libc/src/math/generic/fmaximumf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximumf function
-//----------------------------------===//
+//===-- Implementation of fmaximumf 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/fmaximumf128.cpp b/libc/src/math/generic/fmaximumf128.cpp
index cf07b375980a2e..0099c913b05261 100644
--- a/libc/src/math/generic/fmaximumf128.cpp
+++ b/libc/src/math/generic/fmaximumf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximumf128 function
-//-------------------------------===//
+//===-- Implementation of fmaximumf128 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/fmaximuml.cpp b/libc/src/math/generic/fmaximuml.cpp
index a927e611b8134b..ecd698300458f1 100644
--- a/libc/src/math/generic/fmaximuml.cpp
+++ b/libc/src/math/generic/fmaximuml.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fmaximuml function
-//----------------------------------===//
+//===-- Implementation of fmaximuml 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/fminimum.cpp b/libc/src/math/generic/fminimum.cpp
index 54ab2438514b82..28b257d950f439 100644
--- a/libc/src/math/generic/fminimum.cpp
+++ b/libc/src/math/generic/fminimum.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum function
-//-----------------------------------===//
+//===-- Implementation of fminimum 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/fminimum_mag.cpp b/libc/src/math/generic/fminimum_mag.cpp
index b9466b3f00f782..6af99570e1ea4e 100644
--- a/libc/src/math/generic/fminimum_mag.cpp
+++ b/libc/src/math/generic/fminimum_mag.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_mag function
-//-----------------------------------===//
+//===-- Implementation of fminimum_mag 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/fminimum_mag_num.cpp b/libc/src/math/generic/fminimum_mag_num.cpp
index a78d1b16c05949..fc5431ae279942 100644
--- a/libc/src/math/generic/fminimum_mag_num.cpp
+++ b/libc/src/math/generic/fminimum_mag_num.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_mag_num function
-//-----------------------------------===//
+//===-- Implementation of fminimum_mag_num 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/fminimum_mag_numf.cpp b/libc/src/math/generic/fminimum_mag_numf.cpp
index f362a9f3de0906..71179a6f03c213 100644
--- a/libc/src/math/generic/fminimum_mag_numf.cpp
+++ b/libc/src/math/generic/fminimum_mag_numf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_mag_numf function
-//----------------------------------===//
+//===-- Implementation of fminimum_mag_numf 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/fminimum_mag_numf128.cpp b/libc/src/math/generic/fminimum_mag_numf128.cpp
index 9d1a55ac3ac78c..d6ac83fdb1e5b8 100644
--- a/libc/src/math/generic/fminimum_mag_numf128.cpp
+++ b/libc/src/math/generic/fminimum_mag_numf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_mag_numf128 function
-//-------------------------------===//
+//===-- Implementation of fminimum_mag_numf128 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/fminimum_mag_numl.cpp b/libc/src/math/generic/fminimum_mag_numl.cpp
index 68221345306e2c..c97ce6ead0425b 100644
--- a/libc/src/math/generic/fminimum_mag_numl.cpp
+++ b/libc/src/math/generic/fminimum_mag_numl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_mag_numl function
-//----------------------------------===//
+//===-- Implementation of fminimum_mag_numl 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/fminimum_magf.cpp b/libc/src/math/generic/fminimum_magf.cpp
index 3dbac66bd11c27..834f6a4a97101a 100644
--- a/libc/src/math/generic/fminimum_magf.cpp
+++ b/libc/src/math/generic/fminimum_magf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_magf function
-//----------------------------------===//
+//===-- Implementation of fminimum_magf 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/fminimum_magf128.cpp b/libc/src/math/generic/fminimum_magf128.cpp
index 111577614669a6..2828e28bb0a401 100644
--- a/libc/src/math/generic/fminimum_magf128.cpp
+++ b/libc/src/math/generic/fminimum_magf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_magf128 function
-//-------------------------------===//
+//===-- Implementation of fminimum_magf128 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/fminimum_magl.cpp b/libc/src/math/generic/fminimum_magl.cpp
index e2cb92e665b935..50e328fd92d1f9 100644
--- a/libc/src/math/generic/fminimum_magl.cpp
+++ b/libc/src/math/generic/fminimum_magl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_magl function
-//----------------------------------===//
+//===-- Implementation of fminimum_magl 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/fminimum_num.cpp b/libc/src/math/generic/fminimum_num.cpp
index d5f855d0e57fcb..e89c7f5acf9b18 100644
--- a/libc/src/math/generic/fminimum_num.cpp
+++ b/libc/src/math/generic/fminimum_num.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_num function
-//-----------------------------------===//
+//===-- Implementation of fminimum_num 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/fminimum_numf.cpp b/libc/src/math/generic/fminimum_numf.cpp
index f74447bddc3e27..c37c8bd423a1a6 100644
--- a/libc/src/math/generic/fminimum_numf.cpp
+++ b/libc/src/math/generic/fminimum_numf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_numf function
-//----------------------------------===//
+//===-- Implementation of fminimum_numf 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/fminimum_numf128.cpp b/libc/src/math/generic/fminimum_numf128.cpp
index fe6ab79308a1b6..6b1f77bb447cf8 100644
--- a/libc/src/math/generic/fminimum_numf128.cpp
+++ b/libc/src/math/generic/fminimum_numf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_numf128 function
-//-------------------------------===//
+//===-- Implementation of fminimum_numf128 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/fminimum_numl.cpp b/libc/src/math/generic/fminimum_numl.cpp
index e85d0d51b67e6d..22045f83f2a733 100644
--- a/libc/src/math/generic/fminimum_numl.cpp
+++ b/libc/src/math/generic/fminimum_numl.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimum_numl function
-//----------------------------------===//
+//===-- Implementation of fminimum_numl 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/fminimumf.cpp b/libc/src/math/generic/fminimumf.cpp
index 968e2e008b18be..c937fb0ea01d0d 100644
--- a/libc/src/math/generic/fminimumf.cpp
+++ b/libc/src/math/generic/fminimumf.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimumf function
-//----------------------------------===//
+//===-- Implementation of fminimumf 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/fminimumf128.cpp b/libc/src/math/generic/fminimumf128.cpp
index 7047f903abdaa6..24e02b8ff537f0 100644
--- a/libc/src/math/generic/fminimumf128.cpp
+++ b/libc/src/math/generic/fminimumf128.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimumf128 function
-//-------------------------------===//
+//===-- Implementation of fminimumf128 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/fminimuml.cpp b/libc/src/math/generic/fminimuml.cpp
index a18e76c843befe..43319503661aae 100644
--- a/libc/src/math/generic/fminimuml.cpp
+++ b/libc/src/math/generic/fminimuml.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of fminimuml function
-//----------------------------------===//
+//===-- Implementation of fminimuml 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/smoke/FMaximumMagNumTest.h b/libc/test/src/math/smoke/FMaximumMagNumTest.h
index 9c32f835a58833..8bb967cc142fa8 100644
--- a/libc/test/src/math/smoke/FMaximumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMaximumMagNumTest.h
@@ -1,5 +1,4 @@
-//===-- Utility class to test fmaximum_mag_num[f|l] -------------------------*-
-//C++ -*-===//
+//===-- Utility class to test fmaximum_mag_num[f|l] -------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -70,7 +69,7 @@ class FMaximumMagNumTest : public LIBC_NAMESPACE::testing::Test {
       if ((x == 0) && (y == 0))
         continue;
 
-      if (abs(x) > abs(y)) {
+      if (LIBC_NAMESPACE::fputil::abs(x) > LIBC_NAMESPACE::fputil::abs(y)) {
         EXPECT_FP_EQ(x, func(x, y));
       } else {
         EXPECT_FP_EQ(y, func(x, y));
diff --git a/libc/test/src/math/smoke/FMaximumMagTest.h b/libc/test/src/math/smoke/FMaximumMagTest.h
index 40106032a487b8..38276e0fe2fdb0 100644
--- a/libc/test/src/math/smoke/FMaximumMagTest.h
+++ b/libc/test/src/math/smoke/FMaximumMagTest.h
@@ -1,5 +1,4 @@
-//===-- Utility class to test fmaximum_mag[f|l] -------------------------*- C++
-//-*-===//
+//===-- Utility class to test fmaximum_mag[f|l] -----------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -70,7 +69,7 @@ class FMaximumMagTest : public LIBC_NAMESPACE::testing::Test {
       if ((x == 0) && (y == 0))
         continue;
 
-      if (abs(x) > abs(y)) {
+      if (LIBC_NAMESPACE::fputil::abs(x) > LIBC_NAMESPACE::fputil::abs(y)) {
         EXPECT_FP_EQ(x, func(x, y));
       } else {
         EXPECT_FP_EQ(y, func(x, y));
diff --git a/libc/test/src/math/smoke/FMaximumNumTest.h b/libc/test/src/math/smoke/FMaximumNumTest.h
index 24ae084db768e0..0812dda980f548 100644
--- a/libc/test/src/math/smoke/FMaximumNumTest.h
+++ b/libc/test/src/math/smoke/FMaximumNumTest.h
@@ -1,7 +1,6 @@
-//===-- Utility class to test fmaximum_num[f|l] -------------------------*- C++
-//-*-===//
+//===-- Utility class to test fmaximum_num[f|l] -----------------*- C++ -*-===//
 //
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// 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
 //
diff --git a/libc/test/src/math/smoke/FMaximumTest.h b/libc/test/src/math/smoke/FMaximumTest.h
index 6333c2619bfb19..4db8bb93baaeef 100644
--- a/libc/test/src/math/smoke/FMaximumTest.h
+++ b/libc/test/src/math/smoke/FMaximumTest.h
@@ -1,5 +1,4 @@
-//===-- Utility class to test fmaximum[f|l] -------------------------*- C++
-//-*-===//
+//===-- Utility class to test fmaximum[f|l] ---------------------*- 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/test/src/math/smoke/FMinimumMagNumTest.h b/libc/test/src/math/smoke/FMinimumMagNumTest.h
index 2e5d53fc3d6db6..23c8161b845a60 100644
--- a/libc/test/src/math/smoke/FMinimumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumMagNumTest.h
@@ -1,5 +1,4 @@
-//===-- Utility class to test fminimum_mag_num[f|l] -------------------------*-
-//C++ -*-===//
+//===-- Utility class to test fminimum_mag_num[f|l] -------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -70,7 +69,7 @@ class FMinimumMagNumTest : public LIBC_NAMESPACE::testing::Test {
       if ((x == 0) && (y == 0))
         continue;
 
-      if (abs(x) < abs(y)) {
+      if (LIBC_NAMESPACE::fputil::abs(x) < LIBC_NAMESPACE::fputil::abs(y)) {
         EXPECT_FP_EQ(x, func(x, y));
       } else {
         EXPECT_FP_EQ(y, func(x, y));
diff --git a/libc/test/src/math/smoke/FMinimumMagTest.h b/libc/test/src/math/smoke/FMinimumMagTest.h
index 20382d27635ba2..b11092e5379ba0 100644
--- a/libc/test/src/math/smoke/FMinimumMagTest.h
+++ b/libc/test/src/math/smoke/FMinimumMagTest.h
@@ -1,5 +1,4 @@
-//===-- Utility class to test fminimum_mag[f|l] -------------------------*- C++
-//-*-===//
+//===-- Utility class to test fminimum_mag[f|l] -----------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -70,7 +69,7 @@ class FMinimumMagTest : public LIBC_NAMESPACE::testing::Test {
       if ((x == 0) && (y == 0))
         continue;
 
-      if (abs(x) < abs(y)) {
+      if (LIBC_NAMESPACE::fputil::abs(x) < LIBC_NAMESPACE::fputil::abs(y)) {
         EXPECT_FP_EQ(x, func(x, y));
       } else {
         EXPECT_FP_EQ(y, func(x, y));
diff --git a/libc/test/src/math/smoke/FMinimumNumTest.h b/libc/test/src/math/smoke/FMinimumNumTest.h
index 1419786d3d3353..bc320956279cfa 100644
--- a/libc/test/src/math/smoke/FMinimumNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumNumTest.h
@@ -1,5 +1,4 @@
-//===-- Utility class to test fminimum_num[f|l] -------------------------*- C++
-//-*-===//
+//===-- Utility class to test fminimum_num[f|l] -----------------*- 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/test/src/math/smoke/FMinimumTest.h b/libc/test/src/math/smoke/FMinimumTest.h
index 496aa566419307..bc04a6d9935654 100644
--- a/libc/test/src/math/smoke/FMinimumTest.h
+++ b/libc/test/src/math/smoke/FMinimumTest.h
@@ -1,5 +1,4 @@
-//===-- Utility class to test fminimum[f|l] -------------------------*- C++
-//-*-===//
+//===-- Utility class to test fminimum[f|l] ---------------------*- 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/test/src/math/smoke/fmaximum_mag_num_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
index aa83f1d7d47ecb..16ec1b0ea3437e 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_num_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_mag_num
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_mag_num-------------------------------------===//
 //
 // 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/fmaximum_mag_numf128_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
index 5473b9b0edf329..17f2a24f7fd04e 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_numf128_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_mag_numf128
-//--------------------------------------------===//
+//===-- Unittests for fmaximum_mag_numf128---------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -7,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "FMaximumMag_NumTest.h"
+#include "FMaximumMagNumTest.h"
 
 #include "src/math/fmaximum_mag_numf128.h"
 
diff --git a/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
index 86ce1d4d39764f..a8a46f96970ed6 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_numf_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_mag_numf
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_mag_numf------------------------------------===//
 //
 // 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/fmaximum_mag_numl_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
index 811490f72143b9..c03fa20bd367e7 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_numl_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_mag_numl
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_mag_numl------------------------------------===//
 //
 // 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/fmaximum_mag_test.cpp b/libc/test/src/math/smoke/fmaximum_mag_test.cpp
index 5e419da731e036..e70602f044ec69 100644
--- a/libc/test/src/math/smoke/fmaximum_mag_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_mag_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_mag
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_mag-----------------------------------------===//
 //
 // 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/fmaximum_magf128_test.cpp b/libc/test/src/math/smoke/fmaximum_magf128_test.cpp
index 362644a7f24f22..d7ae8ec8d7a03f 100644
--- a/libc/test/src/math/smoke/fmaximum_magf128_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_magf128_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_magf128
-//--------------------------------------------===//
+//===-- Unittests for fmaximum_magf128-------------------------------------===//
 //
 // 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/fmaximum_magf_test.cpp b/libc/test/src/math/smoke/fmaximum_magf_test.cpp
index fb40bb7ab75a67..efca320b2b373d 100644
--- a/libc/test/src/math/smoke/fmaximum_magf_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_magf_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_magf
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_magf----------------------------------------===//
 //
 // 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/fmaximum_magl_test.cpp b/libc/test/src/math/smoke/fmaximum_magl_test.cpp
index b8d52323739074..16b420b8714b07 100644
--- a/libc/test/src/math/smoke/fmaximum_magl_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_magl_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_magl
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_magl----------------------------------------===//
 //
 // 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/fmaximum_num_test.cpp b/libc/test/src/math/smoke/fmaximum_num_test.cpp
index a24953960020fa..cb9afdf78b83f5 100644
--- a/libc/test/src/math/smoke/fmaximum_num_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_num_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_num
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_num-----------------------------------------===//
 //
 // 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/fmaximum_numf128_test.cpp b/libc/test/src/math/smoke/fmaximum_numf128_test.cpp
index 3e866510874dce..6855ea3b39a9c3 100644
--- a/libc/test/src/math/smoke/fmaximum_numf128_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_numf128_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_numf128
-//--------------------------------------------===//
+//===-- Unittests for fmaximum_numf128-------------------------------------===//
 //
 // 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/fmaximum_numf_test.cpp b/libc/test/src/math/smoke/fmaximum_numf_test.cpp
index 9e1b62043d73f0..053d18803e07f9 100644
--- a/libc/test/src/math/smoke/fmaximum_numf_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_numf_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_numf
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_numf----------------------------------------===//
 //
 // 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/fmaximum_numl_test.cpp b/libc/test/src/math/smoke/fmaximum_numl_test.cpp
index 8695a406499052..bf9612c4111da1 100644
--- a/libc/test/src/math/smoke/fmaximum_numl_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_numl_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum_numl
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum_numl----------------------------------------===//
 //
 // 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/fmaximum_test.cpp b/libc/test/src/math/smoke/fmaximum_test.cpp
index ceb877a3b0d39c..990e0177d8689c 100644
--- a/libc/test/src/math/smoke/fmaximum_test.cpp
+++ b/libc/test/src/math/smoke/fmaximum_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximum
-//-----------------------------------------------===//
+//===-- Unittests for fmaximum---------------------------------------------===//
 //
 // 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/fmaximumf128_test.cpp b/libc/test/src/math/smoke/fmaximumf128_test.cpp
index 1e629c2b8518ce..7e0b97bcdd4de1 100644
--- a/libc/test/src/math/smoke/fmaximumf128_test.cpp
+++ b/libc/test/src/math/smoke/fmaximumf128_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximumf128
-//--------------------------------------------===//
+//===-- Unittests for fmaximumf128-----------------------------------------===//
 //
 // 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/fmaximumf_test.cpp b/libc/test/src/math/smoke/fmaximumf_test.cpp
index 9b3340ac9f8062..a92bbd1446e71a 100644
--- a/libc/test/src/math/smoke/fmaximumf_test.cpp
+++ b/libc/test/src/math/smoke/fmaximumf_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximumf
-//-----------------------------------------------===//
+//===-- Unittests for fmaximumf--------------------------------------------===//
 //
 // 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/fmaximuml_test.cpp b/libc/test/src/math/smoke/fmaximuml_test.cpp
index fa0c9557ed5909..080847b9f4de85 100644
--- a/libc/test/src/math/smoke/fmaximuml_test.cpp
+++ b/libc/test/src/math/smoke/fmaximuml_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fmaximuml
-//-----------------------------------------------===//
+//===-- Unittests for fmaximuml--------------------------------------------===//
 //
 // 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/fminimum_mag_num_test.cpp b/libc/test/src/math/smoke/fminimum_mag_num_test.cpp
index 88ee0b1df5de80..471f2ceb3c2cdc 100644
--- a/libc/test/src/math/smoke/fminimum_mag_num_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_num_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_mag_num
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_mag_num-------------------------------------===//
 //
 // 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/fminimum_mag_numf128.cpp b/libc/test/src/math/smoke/fminimum_mag_numf128_test.cpp
similarity index 82%
rename from libc/test/src/math/smoke/fminimum_mag_numf128.cpp
rename to libc/test/src/math/smoke/fminimum_mag_numf128_test.cpp
index 4533c621b4932b..f1db025f489540 100644
--- a/libc/test/src/math/smoke/fminimum_mag_numf128.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_numf128_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_mag_numf128
-//--------------------------------------------===//
+//===-- Unittests for fminimum_mag_numf128---------------------------------===//
 //
 // 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/fminimum_mag_numf_test.cpp b/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
index 643d1f702e595d..773ba806b99ecb 100644
--- a/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_numf_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_mag_numf
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_mag_numf------------------------------------===//
 //
 // 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/fminimum_mag_numl_test.cpp b/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
index 18ebcd09aeccb7..b4152779db7301 100644
--- a/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_numl_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_mag_numl
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_mag_numl------------------------------------===//
 //
 // 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/fminimum_mag_test.cpp b/libc/test/src/math/smoke/fminimum_mag_test.cpp
index 6f84166e831a98..f4138f3353d11c 100644
--- a/libc/test/src/math/smoke/fminimum_mag_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_mag_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_mag
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_mag-----------------------------------------===//
 //
 // 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/fminimum_magf128_test.cpp b/libc/test/src/math/smoke/fminimum_magf128_test.cpp
index d6a1710db9435d..010ee6e73bee09 100644
--- a/libc/test/src/math/smoke/fminimum_magf128_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_magf128_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_magf128
-//--------------------------------------------===//
+//===-- Unittests for fminimum_magf128-------------------------------------===//
 //
 // 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/fminimum_magf_test.cpp b/libc/test/src/math/smoke/fminimum_magf_test.cpp
index 35f7f5563c9d82..aa27431489309b 100644
--- a/libc/test/src/math/smoke/fminimum_magf_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_magf_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_magf
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_magf----------------------------------------===//
 //
 // 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/fminimum_magl_test.cpp b/libc/test/src/math/smoke/fminimum_magl_test.cpp
index 18e3c52a012bd9..c6fbf7df0e70a7 100644
--- a/libc/test/src/math/smoke/fminimum_magl_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_magl_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_magl
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_magl----------------------------------------===//
 //
 // 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/fminimum_num_test.cpp b/libc/test/src/math/smoke/fminimum_num_test.cpp
index 7cc5a699e7e7c3..1be7ebb5fe8e9f 100644
--- a/libc/test/src/math/smoke/fminimum_num_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_num_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_num
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_num-----------------------------------------===//
 //
 // 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/fminimum_numf128_test.cpp b/libc/test/src/math/smoke/fminimum_numf128_test.cpp
index a01ea20e57a125..d773d8973286e8 100644
--- a/libc/test/src/math/smoke/fminimum_numf128_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_numf128_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_numf128
-//--------------------------------------------===//
+//===-- Unittests for fminimum_numf128-------------------------------------===//
 //
 // 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/fminimum_numf_test.cpp b/libc/test/src/math/smoke/fminimum_numf_test.cpp
index 971acc51684751..9b60f39d55a8d0 100644
--- a/libc/test/src/math/smoke/fminimum_numf_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_numf_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_numf
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_numf----------------------------------------===//
 //
 // 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/fminimum_numl_test.cpp b/libc/test/src/math/smoke/fminimum_numl_test.cpp
index b1b22aaac50486..8a72cd8adc5bf1 100644
--- a/libc/test/src/math/smoke/fminimum_numl_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_numl_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum_numl
-//-----------------------------------------------===//
+//===-- Unittests for fminimum_numl----------------------------------------===//
 //
 // 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/fminimum_test.cpp b/libc/test/src/math/smoke/fminimum_test.cpp
index e9e057bbd98e38..7778f1c2311c00 100644
--- a/libc/test/src/math/smoke/fminimum_test.cpp
+++ b/libc/test/src/math/smoke/fminimum_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimum
-//-----------------------------------------------===//
+//===-- Unittests for fminimum---------------------------------------------===//
 //
 // 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/fminimumf128_test.cpp b/libc/test/src/math/smoke/fminimumf128_test.cpp
index 06302459bacc40..163090b8a9ec5c 100644
--- a/libc/test/src/math/smoke/fminimumf128_test.cpp
+++ b/libc/test/src/math/smoke/fminimumf128_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimumf128
-//--------------------------------------------===//
+//===-- Unittests for fminimumf128-----------------------------------------===//
 //
 // 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/fminimumf_test.cpp b/libc/test/src/math/smoke/fminimumf_test.cpp
index 53659e9c709935..2ca0f2f35a7ff3 100644
--- a/libc/test/src/math/smoke/fminimumf_test.cpp
+++ b/libc/test/src/math/smoke/fminimumf_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimumf
-//-----------------------------------------------===//
+//===-- Unittests for fminimumf--------------------------------------------===//
 //
 // 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/fminimuml_test.cpp b/libc/test/src/math/smoke/fminimuml_test.cpp
index bbb979bb02ec06..3c067ae23f45dc 100644
--- a/libc/test/src/math/smoke/fminimuml_test.cpp
+++ b/libc/test/src/math/smoke/fminimuml_test.cpp
@@ -1,5 +1,4 @@
-//===-- Unittests for fminimuml
-//-----------------------------------------------===//
+//===-- Unittests for fminimuml--------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

>From 1ae6510b3e8873b71c30789662447d747634eae1 Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Fri, 22 Mar 2024 00:08:45 -0700
Subject: [PATCH 4/9] add fminimum_mag_num to the math/generic dir

---
 libc/src/math/generic/fminimum_mag_numf128.cpp | 2 +-
 libc/test/src/math/smoke/FMinimumMagNumTest.h  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libc/src/math/generic/fminimum_mag_numf128.cpp b/libc/src/math/generic/fminimum_mag_numf128.cpp
index d6ac83fdb1e5b8..109ce7e4e0111b 100644
--- a/libc/src/math/generic/fminimum_mag_numf128.cpp
+++ b/libc/src/math/generic/fminimum_mag_numf128.cpp
@@ -13,7 +13,7 @@
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(float128, fminimum_mag_numf128, (float128 x, float128 y)) {
-  return fputil::fminimum_num(x, y);
+  return fputil::fminimum_mag_num(x, y);
 }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/math/smoke/FMinimumMagNumTest.h b/libc/test/src/math/smoke/FMinimumMagNumTest.h
index 23c8161b845a60..da93f152ded449 100644
--- a/libc/test/src/math/smoke/FMinimumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumMagNumTest.h
@@ -69,10 +69,10 @@ class FMinimumMagNumTest : public LIBC_NAMESPACE::testing::Test {
       if ((x == 0) && (y == 0))
         continue;
 
-      if (LIBC_NAMESPACE::fputil::abs(x) < LIBC_NAMESPACE::fputil::abs(y)) {
-        EXPECT_FP_EQ(x, func(x, y));
-      } else {
+      if (LIBC_NAMESPACE::fputil::abs(x) > LIBC_NAMESPACE::fputil::abs(y)) {
         EXPECT_FP_EQ(y, func(x, y));
+      } else {
+        EXPECT_FP_EQ(x, func(x, y));
       }
     }
   }

>From 68059581174607a45a5b67132745482ce4a26fd2 Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Sat, 23 Mar 2024 21:57:54 -0700
Subject: [PATCH 5/9] remove specializations

---
 libc/src/math/amdgpu/fmaximum.cpp          | 21 ---------------------
 libc/src/math/amdgpu/fmaximum_mag.cpp      | 21 ---------------------
 libc/src/math/amdgpu/fmaximum_mag_num.cpp  | 21 ---------------------
 libc/src/math/amdgpu/fmaximum_mag_numf.cpp | 21 ---------------------
 libc/src/math/amdgpu/fmaximum_mag_numl.cpp | 22 ----------------------
 libc/src/math/amdgpu/fmaximum_magf.cpp     | 21 ---------------------
 libc/src/math/amdgpu/fmaximum_magl.cpp     | 21 ---------------------
 libc/src/math/amdgpu/fmaximum_num.cpp      | 21 ---------------------
 libc/src/math/amdgpu/fmaximum_numf.cpp     | 22 ----------------------
 libc/src/math/amdgpu/fmaximum_numl.cpp     | 21 ---------------------
 libc/src/math/amdgpu/fmaximumf.cpp         | 19 -------------------
 libc/src/math/amdgpu/fmaximuml.cpp         | 19 -------------------
 libc/src/math/amdgpu/fminimum.cpp          | 21 ---------------------
 libc/src/math/amdgpu/fminimum_mag.cpp      | 21 ---------------------
 libc/src/math/amdgpu/fminimum_mag_num.cpp  | 21 ---------------------
 libc/src/math/amdgpu/fminimum_mag_numf.cpp | 21 ---------------------
 libc/src/math/amdgpu/fminimum_mag_numl.cpp | 22 ----------------------
 libc/src/math/amdgpu/fminimum_magf.cpp     | 21 ---------------------
 libc/src/math/amdgpu/fminimum_magl.cpp     | 21 ---------------------
 libc/src/math/amdgpu/fminimum_num.cpp      | 22 ----------------------
 libc/src/math/amdgpu/fminimum_numf.cpp     | 21 ---------------------
 libc/src/math/amdgpu/fminimum_numl.cpp     | 21 ---------------------
 libc/src/math/amdgpu/fminimumf.cpp         | 19 -------------------
 libc/src/math/amdgpu/fminimuml.cpp         | 19 -------------------
 libc/src/math/nvptx/fmaximum.cpp           | 20 --------------------
 libc/src/math/nvptx/fmaximumf.cpp          | 22 ----------------------
 26 files changed, 542 deletions(-)
 delete mode 100644 libc/src/math/amdgpu/fmaximum.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_mag.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_mag_num.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_mag_numf.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_mag_numl.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_magf.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_magl.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_num.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_numf.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximum_numl.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximumf.cpp
 delete mode 100644 libc/src/math/amdgpu/fmaximuml.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_mag.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_mag_num.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_mag_numf.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_mag_numl.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_magf.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_magl.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_num.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_numf.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimum_numl.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimumf.cpp
 delete mode 100644 libc/src/math/amdgpu/fminimuml.cpp
 delete mode 100644 libc/src/math/nvptx/fmaximum.cpp
 delete mode 100644 libc/src/math/nvptx/fmaximumf.cpp

diff --git a/libc/src/math/amdgpu/fmaximum.cpp b/libc/src/math/amdgpu/fmaximum.cpp
deleted file mode 100644
index 5ded0caa1c62fb..00000000000000
--- a/libc/src/math/amdgpu/fmaximum.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fmaximum function for GPU--------------------===//
-//
-// 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/fmaximum.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fmaximum, (double x, double y)) {
-  return __builtin_fmaximum(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_mag.cpp b/libc/src/math/amdgpu/fmaximum_mag.cpp
deleted file mode 100644
index 66d120a4b861df..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_mag.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fmaximum_mag function for GPU----------------===//
-//
-// 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/fmaximum_mag.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fmaximum_mag, (double x, double y)) {
-  return __builtin_fmaximum_mag(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_mag_num.cpp b/libc/src/math/amdgpu/fmaximum_mag_num.cpp
deleted file mode 100644
index 3c9d39e7c61730..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_mag_num.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fmaximum_mag_num function for GPU------------===//
-//
-// 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/fmaximum_mag_num.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fmaximum_mag_num, (double x, double y)) {
-  return __builtin_fmaximum_mag_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_mag_numf.cpp b/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
deleted file mode 100644
index 32cf879309d381..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_mag_numf.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fmaximum_mag_numf function for GPU-----------===//
-//
-// 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/fmaximum_mag_numf.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fmaximum_mag_numf, (float x, float y)) {
-  return __builtin_fmaximum_mag_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_mag_numl.cpp b/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
deleted file mode 100644
index 65f5d6d1a2b131..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_mag_numl.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===-- Implementation of the fmaximum_mag_numl function for GPU-----------===//
-//
-// 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/fmaximum_mag_numl.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(long double, fmaximum_mag_numl,
-                   (long double x, long double y)) {
-  return __builtin_fmaximum_mag_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_magf.cpp b/libc/src/math/amdgpu/fmaximum_magf.cpp
deleted file mode 100644
index d3785b46a1aadc..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_magf.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fmaximum_magf function for GPU---------------===//
-//
-// 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/fmaximum_magf.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fmaximum_magf, (float x, float y)) {
-  return __builtin_fmaximum_mag(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_magl.cpp b/libc/src/math/amdgpu/fmaximum_magl.cpp
deleted file mode 100644
index c864afd5c177a5..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_magl.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fmaximum_magl function for GPU---------------===//
-//
-// 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/fmaximum_magl.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(long double, fmaximum_magl, (long double x, long double y)) {
-  return __builtin_fmaximum_mag(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_num.cpp b/libc/src/math/amdgpu/fmaximum_num.cpp
deleted file mode 100644
index 8ccc262dc70eb2..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_num.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fmaximum_num function for GPU----------------===//
-//
-// 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/fmaximum_num.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fmaximum_num, (double x, double y)) {
-  return __builtin_fmaximum_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_numf.cpp b/libc/src/math/amdgpu/fmaximum_numf.cpp
deleted file mode 100644
index 69379f15e9ac12..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_numf.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===-- Implementation of the fmaximum_numf function for GPU---------------===//
-//
-//
-// 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/fmaximum_numf.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fmaximum_numf, (float x, float y)) {
-  return __builtin_fmaximum_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximum_numl.cpp b/libc/src/math/amdgpu/fmaximum_numl.cpp
deleted file mode 100644
index 0929a8420d113b..00000000000000
--- a/libc/src/math/amdgpu/fmaximum_numl.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fmaximum_numl function for GPU---------------===//
-//
-// 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/fmaximum_numl.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fmaximum_numl, (long double x, long double y)) {
-  return __builtin_fmaximum_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximumf.cpp b/libc/src/math/amdgpu/fmaximumf.cpp
deleted file mode 100644
index f0a3196b89ac79..00000000000000
--- a/libc/src/math/amdgpu/fmaximumf.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the fmaximumf function for GPU-------------------===//
-//
-// 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/fmaximumf.h"
-
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fmaximumf, (float x, float y)) {
-  return __builtin_fmaximum(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fmaximuml.cpp b/libc/src/math/amdgpu/fmaximuml.cpp
deleted file mode 100644
index a8df64c47e1a2d..00000000000000
--- a/libc/src/math/amdgpu/fmaximuml.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the fmaximuml function for GPU-------------------===//
-//
-// 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/fmaximuml.h"
-
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fmaximuml, (float x, float y)) {
-  return __builtin_fmaximum(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum.cpp b/libc/src/math/amdgpu/fminimum.cpp
deleted file mode 100644
index cc4cd689d8b37b..00000000000000
--- a/libc/src/math/amdgpu/fminimum.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fminimum function for GPU--------------------===//
-//
-// 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/fminimum.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fminimum, (double x, double y)) {
-  return __builtin_fminimum(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_mag.cpp b/libc/src/math/amdgpu/fminimum_mag.cpp
deleted file mode 100644
index 81467d48a5ea51..00000000000000
--- a/libc/src/math/amdgpu/fminimum_mag.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fminimum_mag function for GPU----------------===//
-//
-// 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/fminimum_mag.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fminimum_mag, (double x, double y)) {
-  return __builtin_fminimum_mag(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_mag_num.cpp b/libc/src/math/amdgpu/fminimum_mag_num.cpp
deleted file mode 100644
index 9e6c816bfb1301..00000000000000
--- a/libc/src/math/amdgpu/fminimum_mag_num.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fminimum_mag_num function for GPU------------===//
-//
-// 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/fminimum_mag_num.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fminimum_mag_num, (double x, double y)) {
-  return __builtin_fminimum_mag_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_mag_numf.cpp b/libc/src/math/amdgpu/fminimum_mag_numf.cpp
deleted file mode 100644
index 9ada6137b0aaf5..00000000000000
--- a/libc/src/math/amdgpu/fminimum_mag_numf.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fminimum_mag_numf function for GPU-----------===//
-//
-// 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/fminimum_mag_numf.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fminimum_mag_numf, (float x, float y)) {
-  return __builtin_fminimum_mag_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_mag_numl.cpp b/libc/src/math/amdgpu/fminimum_mag_numl.cpp
deleted file mode 100644
index 5ff7eaa8147c7f..00000000000000
--- a/libc/src/math/amdgpu/fminimum_mag_numl.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===-- Implementation of the fminimum_mag_numl function for GPU-----------===//
-//
-// 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/fminimum_mag_numl.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(long double, fminimum_mag_numl,
-                   (long double x, long double y)) {
-  return __builtin_fminimum_mag_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_magf.cpp b/libc/src/math/amdgpu/fminimum_magf.cpp
deleted file mode 100644
index c91a12e2f009e5..00000000000000
--- a/libc/src/math/amdgpu/fminimum_magf.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fminimum_magf function for GPU---------------===//
-//
-// 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/fminimum_magf.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fminimum_magf, (float x, float y)) {
-  return __builtin_fminimum_mag(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_magl.cpp b/libc/src/math/amdgpu/fminimum_magl.cpp
deleted file mode 100644
index 40e8b985e5aa94..00000000000000
--- a/libc/src/math/amdgpu/fminimum_magl.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fminimum_magl function for GPU---------------===//
-//
-// 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/fminimum_magl.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(long double, fminimum_magl, (long double x, long double y)) {
-  return __builtin_fminimum_mag(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_num.cpp b/libc/src/math/amdgpu/fminimum_num.cpp
deleted file mode 100644
index 7f5bde44b4bacb..00000000000000
--- a/libc/src/math/amdgpu/fminimum_num.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===-- Implementation of the fminimum_num function for GPU----------------===//
-//
-//
-// 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/fminimum_num.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fminimum_num, (double x, double y)) {
-  return __builtin_fminimum_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_numf.cpp b/libc/src/math/amdgpu/fminimum_numf.cpp
deleted file mode 100644
index 574a73fc622c50..00000000000000
--- a/libc/src/math/amdgpu/fminimum_numf.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fminimum_numf function for GPU---------------===//
-//
-// 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/fminimum_numf.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fminimum_numf, (double x, double y)) {
-  return __builtin_fminimum_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimum_numl.cpp b/libc/src/math/amdgpu/fminimum_numl.cpp
deleted file mode 100644
index 2d00626479472a..00000000000000
--- a/libc/src/math/amdgpu/fminimum_numl.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//===-- Implementation of the fminimum_numl function for GPU---------------===//
-//
-// 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/fminimum_numl.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fminimum_numl, (double x, double y)) {
-  return __builtin_fminimum_num(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimumf.cpp b/libc/src/math/amdgpu/fminimumf.cpp
deleted file mode 100644
index 1128ff410cee55..00000000000000
--- a/libc/src/math/amdgpu/fminimumf.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the fminimumf function for GPU-------------------===//
-//
-// 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/fminimumf.h"
-
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fminimumf, (float x, float y)) {
-  return __builtin_fminimum(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/amdgpu/fminimuml.cpp b/libc/src/math/amdgpu/fminimuml.cpp
deleted file mode 100644
index 9dc114048b63ef..00000000000000
--- a/libc/src/math/amdgpu/fminimuml.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//===-- Implementation of the fminimuml function for GPU-------------------===//
-//
-// 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/fminimuml.h"
-
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(long double, fminimuml, (long double x, long doubley)) {
-  return __builtin_fminimum(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/nvptx/fmaximum.cpp b/libc/src/math/nvptx/fmaximum.cpp
deleted file mode 100644
index d09b40205db89f..00000000000000
--- a/libc/src/math/nvptx/fmaximum.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//===-- Implementation of the fmaximum function for GPU
-//-----------------------===//
-//
-// 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/fmaximum.h"
-
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, fmaximum, (double x, double y)) {
-  return __builtin_fmaximum(x, y);
-}
-
-} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/nvptx/fmaximumf.cpp b/libc/src/math/nvptx/fmaximumf.cpp
deleted file mode 100644
index e0d36a65b3bc68..00000000000000
--- a/libc/src/math/nvptx/fmaximumf.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===-- Implementation of the fmaximumf function for GPU
-//----------------------===//
-//
-// 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/fmaximumf.h"
-
-#include "src/__support/CPP/bit.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/optimization.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, fmaximumf, (float x, float y)) {
-  return __builtin_fmaximumf(x, y);
-}
-
-} // namespace LIBC_NAMESPACE

>From 4de63fb74605e936c6151e6772d7ad94eacdb86a Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Sat, 23 Mar 2024 21:58:28 -0700
Subject: [PATCH 6/9] remove curly braces

---
 libc/src/__support/FPUtil/BasicOperations.h | 62 +++++++--------------
 1 file changed, 21 insertions(+), 41 deletions(-)

diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 5c35b55178fd5c..8f1b94444df9f5 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -62,15 +62,12 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) {
+  if (bitx.is_nan()) 
     return x;
-  }
-  if (bity.is_nan()) {
+  if (bity.is_nan()) 
     return y;
-  }
-  if (bitx.sign() != bity.sign()) {
+  if (bitx.sign() != bity.sign()) 
     return (bitx.is_neg() ? y : x);
-  }
   return x > y ? x : y;
 }
 
@@ -78,15 +75,12 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum(T x, T y) {
   const FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) {
+  if (bitx.is_nan()) 
     return x;
-  }
-  if (bity.is_nan()) {
+  if (bity.is_nan())
     return y;
-  }
-  if (bitx.sign() != bity.sign()) {
+  if (bitx.sign() != bity.sign()) 
     return (bitx.is_neg()) ? x : y;
-  }
   return x < y ? x : y;
 }
 
@@ -94,15 +88,12 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) {
+  if (bitx.is_nan()) 
     return y;
-  }
-  if (bity.is_nan()) {
+  if (bity.is_nan())
     return x;
-  }
-  if (bitx.sign() != bity.sign()) {
+  if (bitx.sign() != bity.sign()) 
     return (bitx.is_neg() ? y : x);
-  }
   return x > y ? x : y;
 }
 
@@ -110,15 +101,12 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum_num(T x, T y) {
   const FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) {
+  if (bitx.is_nan()) 
     return y;
-  }
-  if (bity.is_nan()) {
+  if (bity.is_nan()) 
     return x;
-  }
-  if (bitx.sign() != bity.sign()) {
-    return (bitx.is_neg()) ? x : y;
-  }
+  if (bitx.sign() != bity.sign()) 
+    return (bitx.is_neg() ? x : y);
   return x < y ? x : y;
 }
 
@@ -126,12 +114,10 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum_mag(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (abs(x) > abs(y)) {
+  if (abs(x) > abs(y)) 
     return x;
-  }
-  if (abs(y) > abs(x)) {
+  if (abs(y) > abs(x)) 
     return y;
-  }
   return fmaximum(x, y);
 }
 
@@ -139,12 +125,10 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum_mag(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (abs(x) < abs(y)) {
+  if (abs(x) < abs(y)) 
     return x;
-  }
-  if (abs(y) < abs(x)) {
+  if (abs(y) < abs(x)) 
     return y;
-  }
   return fminimum(x, y);
 }
 
@@ -152,12 +136,10 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum_mag_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (abs(x) > abs(y)) {
+  if (abs(x) > abs(y)) 
     return x;
-  }
-  if (abs(y) > abs(x)) {
+  if (abs(y) > abs(x)) 
     return y;
-  }
   return fmaximum_num(x, y);
 }
 
@@ -165,12 +147,10 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum_mag_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (abs(x) < abs(y)) {
+  if (abs(x) < abs(y)) 
     return x;
-  }
-  if (abs(y) < abs(x)) {
+  if (abs(y) < abs(x))
     return y;
-  }
   return fminimum_num(x, y);
 }
 

>From 5b1339d555b835dfd17093ee15d881200fec94cc Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Sat, 23 Mar 2024 22:02:22 -0700
Subject: [PATCH 7/9] format code

---
 libc/src/__support/FPUtil/BasicOperations.h | 34 ++++++++++-----------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 8f1b94444df9f5..eda350b534e528 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -62,11 +62,11 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) 
+  if (bitx.is_nan())
     return x;
-  if (bity.is_nan()) 
+  if (bity.is_nan())
     return y;
-  if (bitx.sign() != bity.sign()) 
+  if (bitx.sign() != bity.sign())
     return (bitx.is_neg() ? y : x);
   return x > y ? x : y;
 }
@@ -75,11 +75,11 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum(T x, T y) {
   const FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) 
+  if (bitx.is_nan())
     return x;
   if (bity.is_nan())
     return y;
-  if (bitx.sign() != bity.sign()) 
+  if (bitx.sign() != bity.sign())
     return (bitx.is_neg()) ? x : y;
   return x < y ? x : y;
 }
@@ -88,11 +88,11 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) 
+  if (bitx.is_nan())
     return y;
   if (bity.is_nan())
     return x;
-  if (bitx.sign() != bity.sign()) 
+  if (bitx.sign() != bity.sign())
     return (bitx.is_neg() ? y : x);
   return x > y ? x : y;
 }
@@ -101,11 +101,11 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum_num(T x, T y) {
   const FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan()) 
+  if (bitx.is_nan())
     return y;
-  if (bity.is_nan()) 
+  if (bity.is_nan())
     return x;
-  if (bitx.sign() != bity.sign()) 
+  if (bitx.sign() != bity.sign())
     return (bitx.is_neg() ? x : y);
   return x < y ? x : y;
 }
@@ -114,9 +114,9 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum_mag(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (abs(x) > abs(y)) 
+  if (abs(x) > abs(y))
     return x;
-  if (abs(y) > abs(x)) 
+  if (abs(y) > abs(x))
     return y;
   return fmaximum(x, y);
 }
@@ -125,9 +125,9 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum_mag(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (abs(x) < abs(y)) 
+  if (abs(x) < abs(y))
     return x;
-  if (abs(y) < abs(x)) 
+  if (abs(y) < abs(x))
     return y;
   return fminimum(x, y);
 }
@@ -136,9 +136,9 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum_mag_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (abs(x) > abs(y)) 
+  if (abs(x) > abs(y))
     return x;
-  if (abs(y) > abs(x)) 
+  if (abs(y) > abs(x))
     return y;
   return fmaximum_num(x, y);
 }
@@ -147,7 +147,7 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum_mag_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (abs(x) < abs(y)) 
+  if (abs(x) < abs(y))
     return x;
   if (abs(y) < abs(x))
     return y;

>From 7396dfb8bcd459476a235253765759d24ab66874 Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Sun, 24 Mar 2024 09:56:25 -0700
Subject: [PATCH 8/9] adhere to the C standard

---
 libc/src/__support/FPUtil/BasicOperations.h   | 21 +++++++++++++++----
 libc/test/src/math/smoke/FMaximumMagNumTest.h | 21 ++++++++++++-------
 libc/test/src/math/smoke/FMaximumNumTest.h    | 21 ++++++++++++-------
 libc/test/src/math/smoke/FMinimumMagNumTest.h | 21 ++++++++++++-------
 libc/test/src/math/smoke/FMinimumNumTest.h    | 21 ++++++++++++-------
 5 files changed, 73 insertions(+), 32 deletions(-)

diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index eda350b534e528..a8160aa0a7a347 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -13,6 +13,7 @@
 
 #include "src/__support/CPP/type_traits.h"
 #include "src/__support/common.h"
+#include "FEnvImpl.h"
 
 namespace LIBC_NAMESPACE {
 namespace fputil {
@@ -88,10 +89,16 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fmaximum_num(T x, T y) {
   FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan())
+  if (bitx.is_quiet_nan() || bitx.is_signaling_nan())
     return y;
-  if (bity.is_nan())
+  if (bity.is_nan() || bity.is_signaling_nan())
     return x;
+  if (bitx.is_nan() && bity.is_nan())
+    return FPBits<T>::quiet_nan().get_val();
+  if (bitx.is_nan() && bity.is_signaling_nan())
+     fputil::raise_except_if_required(FE_INVALID);
+  if (bitx.is_signaling_nan() && bity.is_nan())
+     fputil::raise_except_if_required(FE_INVALID);
   if (bitx.sign() != bity.sign())
     return (bitx.is_neg() ? y : x);
   return x > y ? x : y;
@@ -101,10 +108,16 @@ template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0>
 LIBC_INLINE T fminimum_num(T x, T y) {
   const FPBits<T> bitx(x), bity(y);
 
-  if (bitx.is_nan())
+  if (bitx.is_quiet_nan() || bitx.is_signaling_nan())
     return y;
-  if (bity.is_nan())
+  if (bity.is_nan() || bity.is_signaling_nan())
     return x;
+  if (bitx.is_nan() && bity.is_nan())
+    return FPBits<T>::quiet_nan().get_val();
+  if (bitx.is_nan() && bity.is_signaling_nan())
+     fputil::raise_except_if_required(FE_INVALID);
+  if (bitx.is_signaling_nan() && bity.is_nan())
+     fputil::raise_except_if_required(FE_INVALID);
   if (bitx.sign() != bity.sign())
     return (bitx.is_neg() ? x : y);
   return x < y ? x : y;
diff --git a/libc/test/src/math/smoke/FMaximumMagNumTest.h b/libc/test/src/math/smoke/FMaximumMagNumTest.h
index 8bb967cc142fa8..1a1d217b0d18ca 100644
--- a/libc/test/src/math/smoke/FMaximumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMaximumMagNumTest.h
@@ -12,6 +12,7 @@
 #include "src/__support/FPUtil/BasicOperations.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
+#include "src/__support/FPUtil/FPBits.h"
 
 template <typename T>
 class FMaximumMagNumTest : public LIBC_NAMESPACE::testing::Test {
@@ -22,13 +23,19 @@ class FMaximumMagNumTest : public LIBC_NAMESPACE::testing::Test {
   typedef T (*FMaximumMagNumFunc)(T, T);
 
   void testNaN(FMaximumMagNumFunc func) {
-    EXPECT_FP_EQ(inf, func(aNaN, inf));
-    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
-    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
-    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
-    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
-    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
-    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+    EXPECT_FP_EQ(inf, func(FPBits::quiet_nan().get_val(), inf));
+    EXPECT_FP_EQ(inf, func(FPBits::signaling_nan().get_val(), inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, FPBits::signaling_nan().get_val()));
+    EXPECT_FP_EQ(FPBits::quiet_nan().get_val(), func(aNaN, aNaN));
+    EXPECT_FP_EQ(0.0, func(FPBits::quiet_nan().get_val(), 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(0.0, func(FPBits::signaling_nan().get_val(), 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::signaling_nan().get_val()));
+    EXPECT_FP_EQ(T(-1.2345), func(FPBits::quiet_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(T(-1.2345), func(FPBits::signaling_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));
   }
 
   void testInfArg(FMaximumMagNumFunc func) {
diff --git a/libc/test/src/math/smoke/FMaximumNumTest.h b/libc/test/src/math/smoke/FMaximumNumTest.h
index 0812dda980f548..6a48da6b979a3a 100644
--- a/libc/test/src/math/smoke/FMaximumNumTest.h
+++ b/libc/test/src/math/smoke/FMaximumNumTest.h
@@ -11,6 +11,7 @@
 
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
+#include "src/__support/FPUtil/FPBits.h"
 
 template <typename T>
 class FMaximumNumTest : public LIBC_NAMESPACE::testing::Test {
@@ -21,13 +22,19 @@ class FMaximumNumTest : public LIBC_NAMESPACE::testing::Test {
   typedef T (*FMaximumNumFunc)(T, T);
 
   void testNaN(FMaximumNumFunc func) {
-    EXPECT_FP_EQ(inf, func(aNaN, inf));
-    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
-    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
-    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
-    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
-    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
-    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+    EXPECT_FP_EQ(inf, func(FPBits::quiet_nan().get_val(), inf));
+    EXPECT_FP_EQ(inf, func(FPBits::signaling_nan().get_val(), inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, FPBits::signaling_nan().get_val()));
+    EXPECT_FP_EQ(FPBits::quiet_nan().get_val(), func(aNaN, aNaN));
+    EXPECT_FP_EQ(0.0, func(FPBits::quiet_nan().get_val(), 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(0.0, func(FPBits::signaling_nan().get_val(), 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::signaling_nan().get_val()));
+    EXPECT_FP_EQ(T(-1.2345), func(FPBits::quiet_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(T(-1.2345), func(FPBits::signaling_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));									      
   }
 
   void testInfArg(FMaximumNumFunc func) {
diff --git a/libc/test/src/math/smoke/FMinimumMagNumTest.h b/libc/test/src/math/smoke/FMinimumMagNumTest.h
index da93f152ded449..6d7831c934cd03 100644
--- a/libc/test/src/math/smoke/FMinimumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumMagNumTest.h
@@ -10,6 +10,7 @@
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMMAG_NUMTEST_H
 
 #include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/FPBits.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
 
@@ -22,13 +23,19 @@ class FMinimumMagNumTest : public LIBC_NAMESPACE::testing::Test {
   typedef T (*FMinimumMagNumFunc)(T, T);
 
   void testNaN(FMinimumMagNumFunc func) {
-    EXPECT_FP_EQ(inf, func(aNaN, inf));
-    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
-    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
-    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
-    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
-    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
-    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+    EXPECT_FP_EQ(inf, func(FPBits::quiet_nan().get_val(), inf));
+    EXPECT_FP_EQ(inf, func(FPBits::signaling_nan().get_val(), inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, FPBits::signaling_nan().get_val()));
+    EXPECT_FP_EQ(FPBits::quiet_nan().get_val(), func(aNaN, aNaN));
+    EXPECT_FP_EQ(0.0, func(FPBits::quiet_nan().get_val(), 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(0.0, func(FPBits::signaling_nan().get_val(), 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::signaling_nan().get_val()));
+    EXPECT_FP_EQ(T(-1.2345), func(FPBits::quiet_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(T(-1.2345), func(FPBits::signaling_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));
   }
 
   void testInfArg(FMinimumMagNumFunc func) {
diff --git a/libc/test/src/math/smoke/FMinimumNumTest.h b/libc/test/src/math/smoke/FMinimumNumTest.h
index bc320956279cfa..30ee4f910ae3b4 100644
--- a/libc/test/src/math/smoke/FMinimumNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumNumTest.h
@@ -11,6 +11,7 @@
 
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
+#include "src/__support/FPUtil/FPBits.h"
 
 template <typename T>
 class FMinimumNumTest : public LIBC_NAMESPACE::testing::Test {
@@ -21,13 +22,19 @@ class FMinimumNumTest : public LIBC_NAMESPACE::testing::Test {
   typedef T (*FMinimumNumFunc)(T, T);
 
   void testNaN(FMinimumNumFunc func) {
-    EXPECT_FP_EQ(inf, func(aNaN, inf));
-    EXPECT_FP_EQ(neg_inf, func(neg_inf, aNaN));
-    EXPECT_FP_EQ(0.0, func(aNaN, 0.0));
-    EXPECT_FP_EQ(-0.0, func(-0.0, aNaN));
-    EXPECT_FP_EQ(T(-1.2345), func(aNaN, T(-1.2345)));
-    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), aNaN));
-    EXPECT_FP_EQ(aNaN, func(aNaN, aNaN));
+    EXPECT_FP_EQ(inf, func(FPBits::quiet_nan().get_val(), inf));
+    EXPECT_FP_EQ(inf, func(FPBits::signaling_nan().get_val(), inf));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(neg_inf, func(neg_inf, FPBits::signaling_nan().get_val()));
+    EXPECT_FP_EQ(FPBits::quiet_nan().get_val(), func(aNaN, aNaN));
+    EXPECT_FP_EQ(0.0, func(FPBits::quiet_nan().get_val(), 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(0.0, func(FPBits::signaling_nan().get_val(), 0.0));
+    EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::signaling_nan().get_val()));
+    EXPECT_FP_EQ(T(-1.2345), func(FPBits::quiet_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::quiet_nan().get_val()));
+    EXPECT_FP_EQ(T(-1.2345), func(FPBits::signaling_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));
   }
 
   void testInfArg(FMinimumNumFunc func) {

>From 767035e2a6309ebe5052b8ec6abdb9b59fa5514f Mon Sep 17 00:00:00 2001
From: Job Hernandez <h93 at protonmail.com>
Date: Sun, 24 Mar 2024 09:57:01 -0700
Subject: [PATCH 9/9] format code

---
 libc/src/__support/FPUtil/BasicOperations.h   | 10 +++++-----
 libc/test/src/math/smoke/FMaximumMagNumTest.h |  5 +++--
 libc/test/src/math/smoke/FMaximumNumTest.h    |  7 ++++---
 libc/test/src/math/smoke/FMinimumMagNumTest.h |  3 ++-
 libc/test/src/math/smoke/FMinimumNumTest.h    |  5 +++--
 5 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index a8160aa0a7a347..9527abf8ef00e8 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -11,9 +11,9 @@
 
 #include "FPBits.h"
 
+#include "FEnvImpl.h"
 #include "src/__support/CPP/type_traits.h"
 #include "src/__support/common.h"
-#include "FEnvImpl.h"
 
 namespace LIBC_NAMESPACE {
 namespace fputil {
@@ -96,9 +96,9 @@ LIBC_INLINE T fmaximum_num(T x, T y) {
   if (bitx.is_nan() && bity.is_nan())
     return FPBits<T>::quiet_nan().get_val();
   if (bitx.is_nan() && bity.is_signaling_nan())
-     fputil::raise_except_if_required(FE_INVALID);
+    fputil::raise_except_if_required(FE_INVALID);
   if (bitx.is_signaling_nan() && bity.is_nan())
-     fputil::raise_except_if_required(FE_INVALID);
+    fputil::raise_except_if_required(FE_INVALID);
   if (bitx.sign() != bity.sign())
     return (bitx.is_neg() ? y : x);
   return x > y ? x : y;
@@ -115,9 +115,9 @@ LIBC_INLINE T fminimum_num(T x, T y) {
   if (bitx.is_nan() && bity.is_nan())
     return FPBits<T>::quiet_nan().get_val();
   if (bitx.is_nan() && bity.is_signaling_nan())
-     fputil::raise_except_if_required(FE_INVALID);
+    fputil::raise_except_if_required(FE_INVALID);
   if (bitx.is_signaling_nan() && bity.is_nan())
-     fputil::raise_except_if_required(FE_INVALID);
+    fputil::raise_except_if_required(FE_INVALID);
   if (bitx.sign() != bity.sign())
     return (bitx.is_neg() ? x : y);
   return x < y ? x : y;
diff --git a/libc/test/src/math/smoke/FMaximumMagNumTest.h b/libc/test/src/math/smoke/FMaximumMagNumTest.h
index 1a1d217b0d18ca..0a1146f80d7bed 100644
--- a/libc/test/src/math/smoke/FMaximumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMaximumMagNumTest.h
@@ -10,9 +10,9 @@
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMMAG_NUMTEST_H
 
 #include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/FPBits.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
-#include "src/__support/FPUtil/FPBits.h"
 
 template <typename T>
 class FMaximumMagNumTest : public LIBC_NAMESPACE::testing::Test {
@@ -34,7 +34,8 @@ class FMaximumMagNumTest : public LIBC_NAMESPACE::testing::Test {
     EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::signaling_nan().get_val()));
     EXPECT_FP_EQ(T(-1.2345), func(FPBits::quiet_nan().get_val(), T(-1.2345)));
     EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::quiet_nan().get_val()));
-    EXPECT_FP_EQ(T(-1.2345), func(FPBits::signaling_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(-1.2345),
+                 func(FPBits::signaling_nan().get_val(), T(-1.2345)));
     EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));
   }
 
diff --git a/libc/test/src/math/smoke/FMaximumNumTest.h b/libc/test/src/math/smoke/FMaximumNumTest.h
index 6a48da6b979a3a..a7297109a81fc4 100644
--- a/libc/test/src/math/smoke/FMaximumNumTest.h
+++ b/libc/test/src/math/smoke/FMaximumNumTest.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMNUMTEST_H
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMAXIMUMNUMTEST_H
 
+#include "src/__support/FPUtil/FPBits.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
-#include "src/__support/FPUtil/FPBits.h"
 
 template <typename T>
 class FMaximumNumTest : public LIBC_NAMESPACE::testing::Test {
@@ -33,8 +33,9 @@ class FMaximumNumTest : public LIBC_NAMESPACE::testing::Test {
     EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::signaling_nan().get_val()));
     EXPECT_FP_EQ(T(-1.2345), func(FPBits::quiet_nan().get_val(), T(-1.2345)));
     EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::quiet_nan().get_val()));
-    EXPECT_FP_EQ(T(-1.2345), func(FPBits::signaling_nan().get_val(), T(-1.2345)));
-    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));									      
+    EXPECT_FP_EQ(T(-1.2345),
+                 func(FPBits::signaling_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));
   }
 
   void testInfArg(FMaximumNumFunc func) {
diff --git a/libc/test/src/math/smoke/FMinimumMagNumTest.h b/libc/test/src/math/smoke/FMinimumMagNumTest.h
index 6d7831c934cd03..52ee2d7d492fdf 100644
--- a/libc/test/src/math/smoke/FMinimumMagNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumMagNumTest.h
@@ -34,7 +34,8 @@ class FMinimumMagNumTest : public LIBC_NAMESPACE::testing::Test {
     EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::signaling_nan().get_val()));
     EXPECT_FP_EQ(T(-1.2345), func(FPBits::quiet_nan().get_val(), T(-1.2345)));
     EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::quiet_nan().get_val()));
-    EXPECT_FP_EQ(T(-1.2345), func(FPBits::signaling_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(-1.2345),
+                 func(FPBits::signaling_nan().get_val(), T(-1.2345)));
     EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));
   }
 
diff --git a/libc/test/src/math/smoke/FMinimumNumTest.h b/libc/test/src/math/smoke/FMinimumNumTest.h
index 30ee4f910ae3b4..a95870d666c573 100644
--- a/libc/test/src/math/smoke/FMinimumNumTest.h
+++ b/libc/test/src/math/smoke/FMinimumNumTest.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMNUMTEST_H
 #define LLVM_LIBC_TEST_SRC_MATH_SMOKE_FMINIMUMNUMTEST_H
 
+#include "src/__support/FPUtil/FPBits.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
-#include "src/__support/FPUtil/FPBits.h"
 
 template <typename T>
 class FMinimumNumTest : public LIBC_NAMESPACE::testing::Test {
@@ -33,7 +33,8 @@ class FMinimumNumTest : public LIBC_NAMESPACE::testing::Test {
     EXPECT_FP_EQ(-0.0, func(-0.0, FPBits::signaling_nan().get_val()));
     EXPECT_FP_EQ(T(-1.2345), func(FPBits::quiet_nan().get_val(), T(-1.2345)));
     EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::quiet_nan().get_val()));
-    EXPECT_FP_EQ(T(-1.2345), func(FPBits::signaling_nan().get_val(), T(-1.2345)));
+    EXPECT_FP_EQ(T(-1.2345),
+                 func(FPBits::signaling_nan().get_val(), T(-1.2345)));
     EXPECT_FP_EQ(T(1.2345), func(T(1.2345), FPBits::signaling_nan().get_val()));
   }
 



More information about the libc-commits mailing list