[libc-commits] [libc] [libc][math][c23] add c23 floating point fmaximum and fminimum fns (PR #86016)
Job Henandez Lara via libc-commits
libc-commits at lists.llvm.org
Wed Mar 20 14:42:34 PDT 2024
https://github.com/Jobhdez created https://github.com/llvm/llvm-project/pull/86016
Hello,
I have added fminimum and fmaximum functions.
I built it using
```
$ cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS="llvm;libc" -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
$ ninja libc -j8
```
I ran the tests as follows:
```
ninja libc-math-smoke-tests
```
Please let me know of anything I need to change. I will be available.
Thanks.
>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] [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)
More information about the libc-commits
mailing list