[llvm] [libc][Bazel] Add missing F16 math targets (PR #222937)
Matteo Di Iorio via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 05:17:17 PDT 2026
https://github.com/splicer3 created https://github.com/llvm/llvm-project/pull/222937
Addresses #221799 by adding all existing F16 tests that were missing Bazel targets.
Validated by running all 184 F16 tests with bazel test.
>From 99a9cf0203038ae17833f1303eee03b6121f4fb5 Mon Sep 17 00:00:00 2001
From: Matteo Di Iorio <matteo.di.iorio at icloud.com>
Date: Fri, 11 Sep 2026 13:46:21 +0200
Subject: [PATCH] [libc][Bazel] Add missing F16 math targets
---
.../libc/test/src/math/BUILD.bazel | 99 +++++++++++++++++--
.../libc/test/src/math/smoke/BUILD.bazel | 61 ++++++++++++
2 files changed, 154 insertions(+), 6 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
index d8914aa3b8ec7..35ee503e9a081 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
@@ -24,6 +24,8 @@ math_mpfr_test(name = "atan2")
math_mpfr_test(name = "atan2f")
+math_mpfr_test(name = "atan2f16")
+
math_mpfr_test(
name = "atan2f128",
deps = ["//libc:__support_fputil_float128"],
@@ -33,8 +35,14 @@ math_mpfr_test(name = "atan")
math_mpfr_test(name = "atanf")
+math_mpfr_test(name = "atanf16")
+
math_mpfr_test(name = "atanhf")
+math_mpfr_test(name = "atanhf16")
+
+math_mpfr_test(name = "atanpif16")
+
math_mpfr_test(name = "cbrt")
math_mpfr_test(name = "cbrtf")
@@ -122,6 +130,10 @@ math_mpfr_test(
math_mpfr_test(name = "erff")
+math_mpfr_test(name = "erff16")
+
+math_mpfr_test(name = "erfcf16")
+
math_mpfr_test(name = "exp")
math_mpfr_test(name = "expf")
@@ -145,6 +157,8 @@ math_mpfr_test(name = "expm1")
math_mpfr_test(name = "expm1f")
+math_mpfr_test(name = "expm1f16")
+
math_mpfr_test(
name = "fabs",
hdrs = ["FAbsTest.h"],
@@ -251,13 +265,68 @@ math_mpfr_test(
# TODO: Add fma, fmaf, fmal, fmul, fmull tests. Missing stdlib/rand dependency.
-# math_mpfr_test(name = "f16mul")
-# math_mpfr_test(name = "f16mulf")
-# math_mpfr_test(name = "f16mull")
+math_mpfr_test(
+ name = "f16mul",
+ hdrs = ["MulTest.h"],
+ deps = [
+ "//libc:rand",
+ "//libc:srand",
+ ],
+)
-# math_mpfr_test(name = "f16fma")
-# math_mpfr_test(name = "f16fmaf")
-# math_mpfr_test(name = "f16fmal")
+math_mpfr_test(
+ name = "f16mulf",
+ hdrs = ["MulTest.h"],
+ deps = [
+ "//libc:rand",
+ "//libc:srand",
+ ],
+)
+
+math_mpfr_test(
+ name = "f16mull",
+ hdrs = ["MulTest.h"],
+ deps = [
+ "//libc:rand",
+ "//libc:srand",
+ ],
+)
+
+math_mpfr_test(
+ name = "f16fma",
+ hdrs = ["FmaTest.h"],
+ deps = [
+ "//libc:rand",
+ "//libc:srand",
+ ],
+)
+
+math_mpfr_test(
+ name = "f16fmaf",
+ hdrs = ["FmaTest.h"],
+ deps = [
+ "//libc:rand",
+ "//libc:srand",
+ ],
+)
+
+math_mpfr_test(
+ name = "f16fmal",
+ hdrs = ["FmaTest.h"],
+ deps = [
+ "//libc:rand",
+ "//libc:srand",
+ ],
+)
+
+math_mpfr_test(
+ name = "fmaf16",
+ hdrs = ["FmaTest.h"],
+ deps = [
+ "//libc:rand",
+ "//libc:srand",
+ ],
+)
math_mpfr_test(
name = "frexp",
@@ -655,6 +724,10 @@ math_mpfr_test(
hdrs = ["SqrtTest.h"],
)
+math_mpfr_test(name = "sqrtf16")
+
+math_mpfr_test(name = "rsqrtf16")
+
math_mpfr_test(
name = "f16sqrtl",
hdrs = ["SqrtTest.h"],
@@ -731,8 +804,16 @@ math_mpfr_test(name = "exp10m1f16")
math_mpfr_test(name = "asinf16")
+math_mpfr_test(name = "asinhf16")
+
+math_mpfr_test(name = "asinpif16")
+
math_mpfr_test(name = "acosf16")
+math_mpfr_test(name = "acoshf16")
+
+math_mpfr_test(name = "acospif16")
+
math_mpfr_test(name = "coshf16")
math_mpfr_test(name = "sinhf16")
@@ -743,4 +824,10 @@ math_mpfr_test(name = "logf16")
math_mpfr_test(name = "log2f16")
+math_mpfr_test(name = "log2p1f16")
+
math_mpfr_test(name = "log10f16")
+
+math_mpfr_test(name = "log10p1f16")
+
+math_mpfr_test(name = "lgammaf16")
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
index 1ea19f953e0ad..88a78e6cacbcd 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
@@ -16,12 +16,20 @@ math_test(name = "acoshf")
math_test(name = "acosf16")
+math_test(name = "acoshf16")
+
+math_test(name = "acospif16")
+
math_test(name = "asinf")
math_test(name = "asinf16")
math_test(name = "asinhf")
+math_test(name = "asinhf16")
+
+math_test(name = "asinpif16")
+
math_test(name = "atan2")
math_test(name = "atan2f")
@@ -42,6 +50,12 @@ math_test(name = "atanf")
math_test(name = "atanhf")
+math_test(name = "atanf16")
+
+math_test(name = "atanhf16")
+
+math_test(name = "atanpif16")
+
math_test(
name = "canonicalize",
hdrs = ["CanonicalizeTest.h"],
@@ -193,6 +207,11 @@ math_test(
hdrs = ["AddTest.h"],
)
+math_test(
+ name = "f16addf128",
+ hdrs = ["AddTest.h"],
+)
+
math_test(
name = "f16addl",
hdrs = ["AddTest.h"],
@@ -218,6 +237,11 @@ math_test(
hdrs = ["DivTest.h"],
)
+math_test(
+ name = "f16divf128",
+ hdrs = ["DivTest.h"],
+)
+
math_test(
name = "f16divl",
hdrs = ["DivTest.h"],
@@ -243,6 +267,11 @@ math_test(
hdrs = ["FmaTest.h"],
)
+math_test(
+ name = "f16fmaf128",
+ hdrs = ["FmaTest.h"],
+)
+
math_test(
name = "f16fmal",
hdrs = ["FmaTest.h"],
@@ -268,6 +297,11 @@ math_test(
hdrs = ["MulTest.h"],
)
+math_test(
+ name = "f16mulf128",
+ hdrs = ["MulTest.h"],
+)
+
math_test(
name = "f16mull",
hdrs = ["MulTest.h"],
@@ -332,11 +366,18 @@ math_test(
hdrs = ["SqrtTest.h"],
)
+math_test(
+ name = "f16sqrtf128",
+ hdrs = ["SqrtTest.h"],
+)
+
math_test(
name = "sqrtf16",
hdrs = ["SqrtTest.h"],
)
+math_test(name = "rsqrtf16")
+
math_test(
name = "f16sqrtl",
hdrs = ["SqrtTest.h"],
@@ -362,6 +403,11 @@ math_test(
hdrs = ["SubTest.h"],
)
+math_test(
+ name = "f16subf128",
+ hdrs = ["SubTest.h"],
+)
+
math_test(
name = "f16subl",
hdrs = ["SubTest.h"],
@@ -369,6 +415,10 @@ math_test(
math_test(name = "erff")
+math_test(name = "erfcf16")
+
+math_test(name = "erff16")
+
math_test(name = "exp")
math_test(name = "expf")
@@ -1069,6 +1119,11 @@ math_test(
],
)
+math_test(
+ name = "isnanf16",
+ hdrs = ["IsNanTest.h"],
+)
+
math_test(
name = "llogbf16",
hdrs = ["ILogbTest.h"],
@@ -1820,8 +1875,14 @@ math_test(name = "log10f16")
math_test(name = "log2f16")
+math_test(name = "log2p1f16")
+
+math_test(name = "log10p1f16")
+
math_test(name = "logf16")
+math_test(name = "lgammaf16")
+
math_test(
name = "nanf16",
deps = [
More information about the llvm-commits
mailing list