Skip to content

[libc][bazel] Main f16 test targets, new f16 funcs #130208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2025

Conversation

michaelrj-google
Copy link
Contributor

This patch adds acosf16 and asinf16 which I missed last patch, and also
the primary math tests for the float16 functions.

This patch adds acosf16 and asinf16 which I missed last patch, and also
the primary math tests for the float16 functions.
@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Mar 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 7, 2025

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

Changes

This patch adds acosf16 and asinf16 which I missed last patch, and also
the primary math tests for the float16 functions.


Full diff: https://github.com/llvm/llvm-project/pull/130208.diff

3 Files Affected:

  • (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+28)
  • (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel (+164)
  • (modified) utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel (+4)
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 5339b30154ed1..4b0fec6473b67 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -2198,6 +2198,20 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "acosf16",
+    additional_deps = [
+        ":__support_fputil_cast",
+        ":__support_fputil_fma",
+        ":__support_fputil_multiply_add",
+        ":__support_fputil_nearest_integer",
+        ":__support_fputil_polyeval",
+        ":__support_fputil_sqrt",
+        ":__support_macros_optimization",
+        ":inv_trigf_utils",
+    ],
+)
+
 libc_math_function(
     name = "acoshf",
     additional_deps = [
@@ -2226,6 +2240,20 @@ libc_math_function(
     ],
 )
 
+libc_math_function(
+    name = "asinf16",
+    additional_deps = [
+        ":__support_fputil_cast",
+        ":__support_fputil_fma",
+        ":__support_fputil_multiply_add",
+        ":__support_fputil_nearest_integer",
+        ":__support_fputil_polyeval",
+        ":__support_fputil_sqrt",
+        ":__support_macros_optimization",
+        ":inv_trigf_utils",
+    ],
+)
+
 libc_math_function(
     name = "asinhf",
     additional_deps = [
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 764c845435611..2154e71018226 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
@@ -47,6 +47,11 @@ math_mpfr_test(
     hdrs = ["CeilTest.h"],
 )
 
+math_mpfr_test(
+    name = "ceilf16",
+    hdrs = ["CeilTest.h"],
+)
+
 math_mpfr_test(name = "cos")
 
 math_mpfr_test(
@@ -144,6 +149,21 @@ math_mpfr_test(
     hdrs = ["AddTest.h"],
 )
 
+math_mpfr_test(
+    name = "f16add",
+    hdrs = ["AddTest.h"],
+)
+
+math_mpfr_test(
+    name = "f16addf",
+    hdrs = ["AddTest.h"],
+)
+
+math_mpfr_test(
+    name = "f16addl",
+    hdrs = ["AddTest.h"],
+)
+
 math_mpfr_test(
     name = "fdiv",
     hdrs = ["DivTest.h"],
@@ -154,6 +174,21 @@ math_mpfr_test(
     hdrs = ["DivTest.h"],
 )
 
+math_mpfr_test(
+    name = "f16div",
+    hdrs = ["DivTest.h"],
+)
+
+math_mpfr_test(
+    name = "f16divf",
+    hdrs = ["DivTest.h"],
+)
+
+math_mpfr_test(
+    name = "f16divl",
+    hdrs = ["DivTest.h"],
+)
+
 # TODO: Add ffma, ffmal test.  Missing stdlib/rand dependency.
 
 math_mpfr_test(
@@ -171,8 +206,21 @@ math_mpfr_test(
     hdrs = ["FloorTest.h"],
 )
 
+math_mpfr_test(
+    name = "floorf16",
+    hdrs = ["FloorTest.h"],
+)
+
 # 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 = "f16fma")
+# math_mpfr_test(name = "f16fmaf")
+# math_mpfr_test(name = "f16fmal")
+
 math_mpfr_test(
     name = "frexp",
     hdrs = ["FrexpTest.h"],
@@ -208,6 +256,21 @@ math_mpfr_test(
     hdrs = ["SubTest.h"],
 )
 
+math_mpfr_test(
+    name = "f16sub",
+    hdrs = ["SubTest.h"],
+)
+
+math_mpfr_test(
+    name = "f16subf",
+    hdrs = ["SubTest.h"],
+)
+
+math_mpfr_test(
+    name = "f16subl",
+    hdrs = ["SubTest.h"],
+)
+
 math_mpfr_test(
     name = "hypot",
     hdrs = ["HypotTest.h"],
@@ -236,6 +299,11 @@ math_mpfr_test(
     hdrs = ["RoundToIntegerTest.h"],
 )
 
+math_mpfr_test(
+    name = "llrintf16",
+    hdrs = ["RoundToIntegerTest.h"],
+)
+
 math_mpfr_test(
     name = "llround",
     hdrs = ["RoundToIntegerTest.h"],
@@ -251,6 +319,16 @@ math_mpfr_test(
     hdrs = ["RoundToIntegerTest.h"],
 )
 
+math_mpfr_test(
+    name = "lroundf16",
+    hdrs = ["RoundToIntegerTest.h"],
+)
+
+math_mpfr_test(
+    name = "llroundf16",
+    hdrs = ["RoundToIntegerTest.h"],
+)
+
 math_mpfr_test(name = "log")
 
 math_mpfr_test(name = "logf")
@@ -282,6 +360,11 @@ math_mpfr_test(
     hdrs = ["RoundToIntegerTest.h"],
 )
 
+math_mpfr_test(
+    name = "lrintf16",
+    hdrs = ["RoundToIntegerTest.h"],
+)
+
 math_mpfr_test(
     name = "lround",
     hdrs = ["RoundToIntegerTest.h"],
@@ -323,6 +406,14 @@ math_mpfr_test(
     ],
 )
 
+math_mpfr_test(
+    name = "nearbyintf16",
+    hdrs = ["NearbyIntTest.h"],
+    deps = [
+        "//libc:__support_cpp_array",
+    ],
+)
+
 math_mpfr_test(name = "pow")
 
 math_mpfr_test(name = "powf")
@@ -357,6 +448,11 @@ math_mpfr_test(
     hdrs = ["RIntTest.h"],
 )
 
+math_mpfr_test(
+    name = "rintf16",
+    hdrs = ["RIntTest.h"],
+)
+
 math_mpfr_test(
     name = "roundeven",
     hdrs = ["RoundEvenTest.h"],
@@ -372,6 +468,11 @@ math_mpfr_test(
     hdrs = ["RoundEvenTest.h"],
 )
 
+math_mpfr_test(
+    name = "roundevenf16",
+    hdrs = ["RoundEvenTest.h"],
+)
+
 math_mpfr_test(
     name = "round",
     hdrs = ["RoundTest.h"],
@@ -387,6 +488,11 @@ math_mpfr_test(
     hdrs = ["RoundTest.h"],
 )
 
+math_mpfr_test(
+    name = "roundf16",
+    hdrs = ["RoundTest.h"],
+)
+
 math_mpfr_test(name = "sin")
 
 math_mpfr_test(
@@ -437,6 +543,21 @@ math_mpfr_test(
     hdrs = ["SqrtTest.h"],
 )
 
+math_mpfr_test(
+    name = "f16sqrt",
+    hdrs = ["SqrtTest.h"],
+)
+
+math_mpfr_test(
+    name = "f16sqrtf",
+    hdrs = ["SqrtTest.h"],
+)
+
+math_mpfr_test(
+    name = "f16sqrtl",
+    hdrs = ["SqrtTest.h"],
+)
+
 math_mpfr_test(name = "tan")
 
 math_mpfr_test(
@@ -463,3 +584,46 @@ math_mpfr_test(
     name = "truncl",
     hdrs = ["TruncTest.h"],
 )
+
+math_mpfr_test(
+    name = "truncf16",
+    hdrs = ["TruncTest.h"],
+)
+
+math_mpfr_test(name = "cosf16")
+
+math_mpfr_test(name = "cospif16")
+
+math_mpfr_test(name = "sinf16")
+
+math_mpfr_test(name = "sinpif16")
+
+math_mpfr_test(name = "tanf16")
+
+math_mpfr_test(name = "tanpif16")
+
+math_mpfr_test(name = "expf16")
+
+math_mpfr_test(name = "exp2f16")
+
+math_mpfr_test(name = "exp2m1f16")
+
+math_mpfr_test(name = "exp10f16")
+
+math_mpfr_test(name = "exp10m1f16")
+
+math_mpfr_test(name = "asinf16")
+
+math_mpfr_test(name = "acosf16")
+
+math_mpfr_test(name = "coshf16")
+
+math_mpfr_test(name = "sinhf16")
+
+math_mpfr_test(name = "tanhf16")
+
+math_mpfr_test(name = "logf16")
+
+math_mpfr_test(name = "log2f16")
+
+math_mpfr_test(name = "log10f16")
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 c56f3c7cf4f34..803548178b0e3 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
@@ -14,8 +14,12 @@ math_test(name = "acosf")
 
 math_test(name = "acoshf")
 
+math_test(name = "acosf16")
+
 math_test(name = "asinf")
 
+math_test(name = "asinf16")
+
 math_test(name = "asinhf")
 
 math_test(name = "atan2")

@michaelrj-google michaelrj-google merged commit 3a228a3 into llvm:main Mar 7, 2025
12 checks passed
@michaelrj-google michaelrj-google deleted the libcMoreF16Bazel branch March 7, 2025 19:38
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
This patch adds acosf16 and asinf16 which I missed last patch, and also
the primary math tests for the float16 functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel libc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants