-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc][bazel][math] Add float128 math functions and their smoke tests to bazel layout. #87645
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
Conversation
… to bazel layout.
@llvm/pr-subscribers-libc Author: None (lntue) ChangesFull diff: https://github.com/llvm/llvm-project/pull/87645.diff 2 Files Affected:
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 9dfe4c48184e3e..d8375de6b3c175 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1696,16 +1696,14 @@ libc_math_function(
)
libc_math_function(name = "fabs")
-
libc_math_function(name = "fabsf")
-
libc_math_function(name = "fabsl")
+libc_math_function(name = "fabsf128")
libc_math_function(name = "fdim")
-
libc_math_function(name = "fdimf")
-
libc_math_function(name = "fdiml")
+libc_math_function(name = "fdimf128")
libc_math_function(
name = "ceil",
@@ -1730,6 +1728,9 @@ libc_math_function(
],
)
+libc_math_function(name = "ceilf128")
+
+
libc_math_function(
name = "floor",
specializations = [
@@ -1747,12 +1748,12 @@ libc_math_function(
)
libc_math_function(name = "floorl")
+libc_math_function(name = "floorf128")
libc_math_function(name = "ldexp")
-
libc_math_function(name = "ldexpf")
-
libc_math_function(name = "ldexpl")
+libc_math_function(name = "ldexpf128")
libc_math_function(
name = "trunc",
@@ -1771,6 +1772,7 @@ libc_math_function(
)
libc_math_function(name = "truncl")
+libc_math_function(name = "truncf128")
libc_math_function(
name = "round",
@@ -1789,6 +1791,7 @@ libc_math_function(
)
libc_math_function(name = "roundl")
+libc_math_function(name = "roundf128")
libc_math_function(
name = "fmod",
@@ -1805,10 +1808,9 @@ libc_math_function(
)
libc_math_function(name = "frexp")
-
libc_math_function(name = "frexpf")
-
libc_math_function(name = "frexpl")
+libc_math_function(name = "frexpf128")
libc_math_function(name = "hypot")
@@ -1820,40 +1822,32 @@ libc_math_function(
)
libc_math_function(name = "logb")
-
libc_math_function(name = "logbf")
-
libc_math_function(name = "logbl")
+libc_math_function(name = "logbf128")
libc_math_function(name = "modf")
-
libc_math_function(name = "modff")
-
libc_math_function(name = "modfl")
+libc_math_function(name = "modff128")
libc_math_function(name = "remquo")
-
libc_math_function(name = "remquof")
-
libc_math_function(name = "remquol")
libc_math_function(name = "remainder")
-
libc_math_function(name = "remainderf")
-
libc_math_function(name = "remainderl")
libc_math_function(name = "fmin")
-
libc_math_function(name = "fminf")
-
libc_math_function(name = "fminl")
+libc_math_function(name = "fminf128")
libc_math_function(name = "fmax")
-
libc_math_function(name = "fmaxf")
-
libc_math_function(name = "fmaxl")
+libc_math_function(name = "fmaxf128")
libc_math_function(
name = "cosf",
@@ -1927,49 +1921,47 @@ libc_math_function(
],
)
-libc_math_function(name = "copysign")
+libc_math_function(
+ name = "sqrtf128",
+ additional_deps = [
+ ":__support_fputil_sqrt",
+ ],
+)
+libc_math_function(name = "copysign")
libc_math_function(name = "copysignf")
-
libc_math_function(name = "copysignl")
-
libc_math_function(name = "copysignf128")
libc_math_function(name = "ilogb")
-
libc_math_function(name = "ilogbf")
-
libc_math_function(name = "ilogbl")
+libc_math_function(name = "ilogbf128")
libc_math_function(name = "rint")
-
libc_math_function(name = "rintf")
-
libc_math_function(name = "rintl")
+libc_math_function(name = "rintf128")
libc_math_function(name = "lrint")
-
libc_math_function(name = "lrintf")
-
libc_math_function(name = "lrintl")
+libc_math_function(name = "lrintf128")
libc_math_function(name = "llrint")
-
libc_math_function(name = "llrintf")
-
libc_math_function(name = "llrintl")
+libc_math_function(name = "llrintf128")
libc_math_function(name = "lround")
-
libc_math_function(name = "lroundf")
-
libc_math_function(name = "lroundl")
+libc_math_function(name = "lroundf128")
libc_math_function(name = "llround")
-
libc_math_function(name = "llroundf")
-
libc_math_function(name = "llroundl")
+libc_math_function(name = "llroundf128")
libc_math_function(
name = "nan",
@@ -1995,28 +1987,29 @@ libc_math_function(
],
)
-libc_math_function(name = "nearbyint")
+libc_math_function(
+ name = "nanf128",
+ additional_deps = [
+ ":__support_str_to_float",
+ ":errno",
+ ],
+)
+libc_math_function(name = "nearbyint")
libc_math_function(name = "nearbyintf")
-
libc_math_function(name = "nearbyintl")
libc_math_function(name = "nextafter")
-
libc_math_function(name = "nextafterf")
-
libc_math_function(name = "nextafterl")
+libc_math_function(name = "nextafterf128")
libc_math_function(name = "nexttoward")
-
libc_math_function(name = "nexttowardf")
-
libc_math_function(name = "nexttowardl")
libc_math_function(name = "scalbn")
-
libc_math_function(name = "scalbnf")
-
libc_math_function(name = "scalbnl")
############################## inttypes targets ##############################
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
new file mode 100644
index 00000000000000..0d69a480cb2870
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel
@@ -0,0 +1,147 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+# Smoke tests for LLVM libc math.h functions.
+
+load("//libc:libc_build_rules.bzl", "libc_support_library")
+load("//libc/test/src/math:libc_math_test_rules.bzl", "math_test")
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+math_test(
+ name = "fabsf128",
+ hdrs = ["FAbsTest.h"],
+)
+
+math_test(
+ name = "ceilf128",
+ hdrs = ["CeilTest.h"],
+)
+
+math_test(
+ name = "floorf128",
+ hdrs = ["FloorTest.h"],
+)
+
+math_test(
+ name = "truncf128",
+ hdrs = ["TruncTest.h"],
+)
+
+math_test(
+ name = "roundf128",
+ hdrs = ["RoundTest.h"],
+)
+
+math_test(
+ name = "frexpf128",
+ hdrs = ["FrexpTest.h"],
+)
+
+math_test(
+ name = "logbf128",
+ hdrs = ["LogbTest.h"],
+)
+
+math_test(
+ name = "modff128",
+ hdrs = ["ModfTest.h"],
+)
+
+math_test(
+ name = "fminf128",
+ hdrs = ["FMinTest.h"],
+)
+
+math_test(
+ name = "fmaxf128",
+ hdrs = ["FMaxTest.h"],
+)
+
+math_test(
+ name = "sqrtf128",
+ hdrs = ["SqrtTest.h"],
+ deps = ["//libc:__support_cpp_bit"],
+)
+
+math_test(
+ name = "copysignf128",
+ hdrs = ["CopySignTest.h"],
+)
+
+math_test(
+ name = "ilogbf128",
+ hdrs = ["ILogbTest.h"],
+ deps = ["//libc:__support_cpp_limits"],
+)
+
+math_test(
+ name = "fdimf128",
+ hdrs = ["FDimTest.h"],
+)
+
+libc_support_library(
+ name = "ldexp_test_template",
+ hdrs = ["LdExpTest.h"],
+ deps = [
+ "//libc:__support_cpp_limits",
+ "//libc:__support_fputil_fp_bits",
+ "//libc:__support_fputil_normal_float",
+ "//libc:llvm_libc_macros_math_macros",
+ "//libc/test/UnitTest:LibcUnitTest",
+ "//libc/test/UnitTest:fp_test_helpers",
+ ],
+)
+
+math_test(
+ name = "ldexpf128",
+ hdrs = ["LdExpTest.h"],
+ deps = ["//libc:__support_cpp_limits"],
+)
+
+math_test(
+ name = "rintf128",
+ hdrs = ["RIntTest.h"],
+)
+
+math_test(
+ name = "lrintf128",
+ hdrs = ["RoundToIntegerTest.h"],
+)
+
+math_test(
+ name = "llrintf128",
+ hdrs = ["RoundToIntegerTest.h"],
+)
+math_test(
+ name = "lroundf128",
+ hdrs = ["RoundToIntegerTest.h"],
+)
+
+math_test(
+ name = "llroundf128",
+ hdrs = ["RoundToIntegerTest.h"],
+)
+
+libc_support_library(
+ name = "nextafter_test_template",
+ hdrs = ["NextAfterTest.h"],
+ deps = [
+ "//libc:__support_cpp_array",
+ "//libc:__support_cpp_bit",
+ "//libc:__support_cpp_type_traits",
+ "//libc:__support_fputil_basic_operations",
+ "//libc:__support_fputil_fp_bits",
+ "//libc:llvm_libc_macros_math_macros",
+ "//libc/test/UnitTest:LibcUnitTest",
+ "//libc/test/UnitTest:fp_test_helpers",
+ ],
+)
+
+math_test(
+ name = "nextafterf128",
+ deps = [":nextafter_test_template"],
+)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI buildifier
requires an empty line between targets.
This manifested in
https://github.com/llvm/llvm-project/pull/87751/files#diff-7a096458e3980913cd3fb784be5e5c09497231c1ed46d4e4bab4ce48b82691ce
No description provided.