-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc][bazel] Update bazel overlay for math functions and their tests. #107862
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
@llvm/pr-subscribers-libc Author: None (lntue) ChangesPatch is 81.80 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/107862.diff 6 Files Affected:
diff --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp
index 7caf1489d0221e..0c4c8215343927 100644
--- a/libc/test/src/math/exp2f_test.cpp
+++ b/libc/test/src/math/exp2f_test.cpp
@@ -8,7 +8,6 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include "src/errno/libc_errno.h"
#include "src/math/exp2f.h"
#include "test/UnitTest/FPMatcher.h"
diff --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp
index 3ef1a4ece4cf63..39228eb2f6d8ba 100644
--- a/libc/test/src/math/smoke/exp2f_test.cpp
+++ b/libc/test/src/math/smoke/exp2f_test.cpp
@@ -8,7 +8,6 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include "src/errno/libc_errno.h"
#include "src/math/exp2f.h"
#include "test/UnitTest/FPMatcher.h"
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index bedd363edd1bde..8dc93014714b86 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -675,7 +675,12 @@ libc_support_library(
libc_support_library(
name = "__support_fputil_basic_operations",
- hdrs = ["src/__support/FPUtil/BasicOperations.h"],
+ hdrs = [
+ "src/__support/FPUtil/BasicOperations.h",
+ "src/__support/FPUtil/generic/add_sub.h",
+ "src/__support/FPUtil/generic/div.h",
+ "src/__support/FPUtil/generic/mul.h",
+ ],
deps = [
":__support_common",
":__support_cpp_type_traits",
@@ -1404,7 +1409,7 @@ libc_function(
],
)
-################################ math targets ################################
+########################### math support library ###############################
libc_support_library(
name = "common_constants",
@@ -1547,26 +1552,29 @@ libc_support_library(
],
)
+################################ math targets ##################################
+
libc_math_function(
- name = "erff",
+ name = "acosf",
additional_deps = [
+ ":__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 = "expm1",
+ name = "acoshf",
additional_deps = [
- ":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
+ ":__support_fputil_fma",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
- ":__support_fputil_rounding_mode",
- ":__support_fputil_triple_double",
- ":__support_integer_literals",
+ ":__support_fputil_sqrt",
":__support_macros_optimization",
":common_constants",
":explogxf",
@@ -1574,30 +1582,27 @@ libc_math_function(
)
libc_math_function(
- name = "expm1f",
+ name = "asinf",
additional_deps = [
":__support_fputil_fma",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
- ":__support_fputil_rounding_mode",
+ ":__support_fputil_sqrt",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":inv_trigf_utils",
],
)
libc_math_function(
- name = "exp",
+ name = "asinhf",
additional_deps = [
- ":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
+ ":__support_fputil_fma",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
- ":__support_fputil_rounding_mode",
- ":__support_fputil_triple_double",
- ":__support_integer_literals",
+ ":__support_fputil_sqrt",
":__support_macros_optimization",
":common_constants",
":explogxf",
@@ -1605,7 +1610,7 @@ libc_math_function(
)
libc_math_function(
- name = "expf",
+ name = "atanf",
additional_deps = [
":__support_fputil_fma",
":__support_fputil_multiply_add",
@@ -1613,176 +1618,211 @@ libc_math_function(
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
":__support_macros_optimization",
- ":common_constants",
+ ":inv_trigf_utils",
],
)
libc_math_function(
- name = "exp10",
+ name = "atan2f",
additional_deps = [
":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
- ":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
- ":__support_fputil_polyeval",
- ":__support_fputil_rounding_mode",
- ":__support_fputil_triple_double",
- ":__support_integer_literals",
- ":__support_macros_optimization",
- ":common_constants",
- ":explogxf",
+ ":inv_trigf_utils",
],
)
libc_math_function(
- name = "exp10f",
+ name = "atan2",
additional_deps = [
- ":exp10f_impl",
+ ":__support_fputil_double_double",
+ ":__support_fputil_nearest_integer",
+ ":inv_trigf_utils",
],
)
libc_math_function(
- name = "exp2",
+ name = "atanhf",
additional_deps = [
- ":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
+ ":__support_fputil_fma",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
- ":__support_fputil_rounding_mode",
- ":__support_fputil_triple_double",
- ":__support_integer_literals",
":__support_macros_optimization",
":common_constants",
":explogxf",
],
)
+libc_math_function(name = "canonicalize")
+
+libc_math_function(name = "canonicalizef")
+
+libc_math_function(name = "canonicalizel")
+
+libc_math_function(name = "canonicalizef128")
+
libc_math_function(
- name = "exp2f",
+ name = "cbrt",
additional_deps = [
- ":exp2f_impl",
+ ":__support_fputil_double_double",
+ ":__support_fputil_polyeval",
+ ":__support_integer_literals",
],
)
libc_math_function(
- name = "logf",
+ name = "cbrtf",
additional_deps = [
- ":__support_fputil_fma",
- ":__support_fputil_multiply_add",
":__support_fputil_polyeval",
- ":__support_macros_optimization",
- ":__support_macros_properties_cpu_features",
- ":common_constants",
],
)
libc_math_function(
- name = "log2f",
- additional_deps = [
- ":__support_fputil_fma",
- ":__support_fputil_multiply_add",
- ":__support_fputil_polyeval",
- ":__support_macros_optimization",
- ":common_constants",
+ name = "ceil",
+ specializations = [
+ "generic",
],
)
libc_math_function(
- name = "log10f",
+ name = "ceilf",
+ specializations = [
+ "generic",
+ ],
+)
+
+libc_math_function(
+ name = "ceill",
+ specializations = [
+ "generic",
+ ],
+)
+
+libc_math_function(name = "ceilf128")
+
+libc_math_function(name = "copysign")
+
+libc_math_function(name = "copysignf")
+
+libc_math_function(name = "copysignl")
+
+libc_math_function(name = "copysignf128")
+
+libc_math_function(
+ name = "cos",
additional_deps = [
- ":__support_fputil_fma",
":__support_fputil_multiply_add",
- ":__support_fputil_polyeval",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":range_reduction_double",
+ ":sincos_eval",
],
)
libc_math_function(
- name = "log1pf",
+ name = "cosf",
additional_deps = [
":__support_fputil_fma",
":__support_fputil_multiply_add",
- ":__support_fputil_polyeval",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":common_constants",
+ ":sincosf_utils",
],
)
libc_math_function(
- name = "log",
+ name = "coshf",
additional_deps = [
- ":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
":__support_fputil_fma",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
- ":__support_integer_literals",
+ ":__support_fputil_rounding_mode",
":__support_macros_optimization",
- ":__support_macros_properties_cpu_features",
":common_constants",
- ":log_range_reduction",
+ ":explogxf",
],
)
libc_math_function(
- name = "log2",
+ name = "cospif",
additional_deps = [
- ":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
":__support_fputil_fma",
":__support_fputil_multiply_add",
+ ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
- ":__support_integer_literals",
+ ":__support_fputil_rounding_mode",
":__support_macros_optimization",
- ":__support_macros_properties_cpu_features",
":common_constants",
- ":log_range_reduction",
+ ":explogxf",
+ ":sincosf_utils",
],
)
+libc_math_function(name = "daddl")
+
+libc_math_function(name = "daddf128")
+
+libc_math_function(name = "ddivl")
+
+libc_math_function(name = "ddivf128")
+
libc_math_function(
- name = "log10",
+ name = "dfmal",
additional_deps = [
- ":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
":__support_fputil_fma",
- ":__support_fputil_multiply_add",
- ":__support_fputil_polyeval",
- ":__support_integer_literals",
- ":__support_macros_optimization",
- ":__support_macros_properties_cpu_features",
- ":common_constants",
- ":log_range_reduction",
],
)
libc_math_function(
- name = "log1p",
+ name = "dfmaf128",
additional_deps = [
- ":__support_fputil_double_double",
- ":__support_fputil_dyadic_float",
":__support_fputil_fma",
+ ],
+)
+
+libc_math_function(name = "dmull")
+
+libc_math_function(name = "dmulf128")
+
+libc_math_function(
+ name = "dsqrtl",
+ additional_deps = [
+ ":__support_fputil_sqrt",
+ ],
+)
+
+libc_math_function(
+ name = "dsqrtf128",
+ additional_deps = [
+ ":__support_fputil_sqrt",
+ ],
+)
+
+libc_math_function(name = "dsubl")
+
+libc_math_function(name = "dsubf128")
+
+libc_math_function(
+ name = "erff",
+ additional_deps = [
":__support_fputil_multiply_add",
":__support_fputil_polyeval",
- ":__support_integer_literals",
":__support_macros_optimization",
- ":__support_macros_properties_cpu_features",
- ":common_constants",
],
)
libc_math_function(
- name = "sinhf",
+ name = "exp",
additional_deps = [
- ":__support_fputil_fma",
+ ":__support_fputil_double_double",
+ ":__support_fputil_dyadic_float",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
+ ":__support_fputil_triple_double",
+ ":__support_integer_literals",
":__support_macros_optimization",
":common_constants",
":explogxf",
@@ -1790,7 +1830,7 @@ libc_math_function(
)
libc_math_function(
- name = "coshf",
+ name = "expf",
additional_deps = [
":__support_fputil_fma",
":__support_fputil_multiply_add",
@@ -1799,75 +1839,76 @@ libc_math_function(
":__support_fputil_rounding_mode",
":__support_macros_optimization",
":common_constants",
- ":explogxf",
],
)
libc_math_function(
- name = "cospif",
+ name = "exp10",
additional_deps = [
- ":__support_fputil_fma",
+ ":__support_fputil_double_double",
+ ":__support_fputil_dyadic_float",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
+ ":__support_fputil_triple_double",
+ ":__support_integer_literals",
":__support_macros_optimization",
":common_constants",
":explogxf",
- ":sincosf_utils",
],
)
libc_math_function(
- name = "tanhf",
+ name = "exp10f",
additional_deps = [
- ":__support_fputil_fma",
+ ":exp10f_impl",
+ ],
+)
+
+libc_math_function(
+ name = "exp2",
+ additional_deps = [
+ ":__support_fputil_double_double",
+ ":__support_fputil_dyadic_float",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":__support_fputil_rounding_mode",
+ ":__support_fputil_triple_double",
+ ":__support_integer_literals",
":__support_macros_optimization",
- ":__support_macros_properties_cpu_features",
":common_constants",
":explogxf",
],
)
libc_math_function(
- name = "asinhf",
+ name = "exp2f",
additional_deps = [
- ":__support_fputil_fma",
- ":__support_fputil_multiply_add",
- ":__support_fputil_nearest_integer",
- ":__support_fputil_polyeval",
- ":__support_fputil_sqrt",
- ":__support_macros_optimization",
- ":common_constants",
- ":explogxf",
+ ":exp2f_impl",
],
)
libc_math_function(
- name = "acoshf",
+ name = "exp2m1f",
additional_deps = [
- ":__support_fputil_fma",
- ":__support_fputil_multiply_add",
- ":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
- ":__support_fputil_sqrt",
- ":__support_macros_optimization",
- ":common_constants",
":explogxf",
],
)
libc_math_function(
- name = "atanhf",
+ name = "expm1",
additional_deps = [
- ":__support_fputil_fma",
+ ":__support_fputil_double_double",
+ ":__support_fputil_dyadic_float",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
+ ":__support_fputil_rounding_mode",
+ ":__support_fputil_triple_double",
+ ":__support_integer_literals",
":__support_macros_optimization",
":common_constants",
":explogxf",
@@ -1875,145 +1916,575 @@ libc_math_function(
)
libc_math_function(
- name = "asinf",
+ name = "expm1f",
additional_deps = [
":__support_fputil_fma",
":__support_fputil_multiply_add",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
- ":__support_fputil_sqrt",
+ ":__support_fputil_rounding_mode",
":__support_macros_optimization",
":__support_macros_properties_cpu_features",
- ":inv_trigf_utils",
+ ":common_constants",
],
)
-libc_math_function(
- name = "acosf",
- additional_deps = [
- ":__support_fputil_fma",
- ":__support_fputil_multiply_add",
- ":__support_fputil_nearest_integer",
- ":__support_fputil_polyeval",
+libc_math_function(name = "fabs")
+
+libc_math_function(name = "fabsf")
+
+libc_math_function(name = "fabsl")
+
+libc_math_function(name = "fabsf128")
+
+libc_math_function(name = "fadd")
+
+libc_math_function(name = "faddl")
+
+libc_math_function(name = "faddf128")
+
+libc_math_function(name = "fdim")
+
+libc_math_function(name = "fdimf")
+
+libc_math_function(name = "fdiml")
+
+libc_math_function(name = "fdimf128")
+
+libc_math_function(name = "fdiv")
+
+libc_math_function(name = "fdivl")
+
+libc_math_function(name = "fdivf128")
+
+libc_math_function(
+ name = "ffma",
+ additional_deps = [
+ ":__support_fputil_fma",
+ ],
+)
+
+libc_math_function(
+ name = "ffmal",
+ additional_deps = [
+ ":__support_fputil_fma",
+ ],
+)
+
+libc_math_function(
+ name = "ffmaf128",
+ additional_deps = [
+ ":__support_fputil_fma",
+ ],
+)
+
+libc_math_function(
+ name = "floor",
+ specializations = [
+ "generic",
+ ],
+)
+
+libc_math_function(
+ name = "floorf",
+ specializations = [
+ "generic",
+ ],
+)
+
+libc_math_function(name = "floorl")
+
+libc_math_function(name = "floorf128")
+
+# TODO: Add fma, fmaf, fmal, fmaf128 functions.
+
+libc_math_function(name = "fmax")
+
+libc_math_function(name = "fmaxf")
+
+libc_math_function(name = "fmaxl")
+
+libc_math_function(name = "fmaxf128")
+
+libc_math_function(name = "fmaximum")
+
+libc_math_function(name = "fmaximumf")
+
+libc_math_function(name = "fmaximuml")
+
+libc_math_function(name = "fmaximumf128")
+
+libc_math_function(name = "fmaximum_mag")
+
+libc_math_function(name = "fmaximum_magf")
+
+libc_math_function(name = "fmaximum_magl")
+
+libc_math_function(name = "fmaximum_magf128")
+
+libc_math_function(name = "fmaximum_mag_num")
+
+libc_math_function(name = "fmaximum_mag_numf")
+
+libc_math_function(name = "fmaximum_mag_numl")
+
+libc_math_function(name = "fmaximum_mag_numf128")
+
+libc_math_function(name = "fmaximum_num")
+
+libc_math_function(name = "fmaximum_numf")
+
+libc_math_function(name = "fmaximum_numl")
+
+libc_math_function(name = "fmaximum_numf128")
+
+libc_math_function(name = "fmin")
+
+libc_math_function(name = "fminf")
+
+libc_math_function(name = "fminl")
+
+libc_math_function(name = "fminf128")
+
+libc_math_function(name = "fminimum")
+
+libc_math_function(name = "fminimumf")
+
+libc_math_function(name = "fminimuml")
+
+libc_math_function(name = "fminimumf128")
+
+libc_math_function(name = "fminimum_mag")
+
+libc_math_function(name = "fminimum_magf")
+
+libc_math_function(name = "fminimum_magl")
+
+libc_math_function(name = "fminimum_magf128")
+
+libc_math_function(name = "fminimum_mag_num")
+
+libc_math_function(name = "fminimum_mag_numf")
+
+libc_math_function(name = "fminimum_mag_numl")
+
+libc_math_function(name = "fminimum_mag_numf128")
+
+libc_math_function(name = "fminimum_num")
+
+libc_math_function(name = "fminimum_numf")
+
+libc_math_function(name = "fminimum_numl")
+
+libc_math_function(name = "fminimum_numf128")
+
+libc_math_function(
+ name = "fmod",
+ additional_deps = [
+ ":__support_fputil_generic_fmod",
+ ],
+)
+
+libc_math_function(
+ name = "fmodf",
+ additional_deps = [
+ ":__support_fputil_generic_fmod",
+ ],
+)
+
+libc_math_function(
+ name = "fmodl",
+ additional_deps = [
+ ":__support_fputil_generic_fmod",
+ ],
+)
+
+libc_math_function(
+ name = "fmodf128",
+ additional_deps = [
+ ":__support_fputil_generic_fmod",
+ ],
+)
+
+libc_math_function(name = "fmul")
+
+libc_math_function(name = "fmull")
+
+libc_math_function(name = "fmulf128")
+
+libc_math_function(name = "frexp")
+
+libc_math_function(name = "frexpf")
+
+libc_math_function(name = "frexpl")
+
+libc_math_function(name = "frexpf128")
+
+libc_math_function(name = "fromfp")
+
+libc_math_function(name = "fromfpf")
+
+libc_math_function(name = "fromfpl")
+
+libc_math_function(name = "fromfpf128")
+
+libc_math_function(name = "fromfpx")
+
+libc_math_function(name = "fromfpxf")
+
+libc_math_function(name = "fromfpxl")
+
+libc_math_function(name = "fromfpxf128")
+
+libc_math_function(
+ name = "fsqrt",
+ additional_deps = [
":__support_fputil_sqrt",
+ ],
+)
+
+libc_math_function(
+ name = "fsqrtl",
+ additional_deps = [
+ ":__support_fputil_sqrt",
+ ],
+)
+
+libc_math_function(
+ name = "fsqrtf128",
+ additional_deps = [
+ ":__support_fputil_sqrt",
+ ],
+)
+
+libc_math_function(name = "fsub")
+
+libc_math_function(name = "fsubl")
+
+libc_math_function(name = "fsubf128")
+
+libc_math_function(name = "getpayload")
+
+libc_math_function(name = "getpayloadf")
+
+libc_math_function(name = "getpayloadl")
+
+libc_math_function(name = "getpayloadf128")
+
+libc_math_fu...
[truncated]
|
michaelrj-google
approved these changes
Sep 9, 2024
Contributor
michaelrj-google
left a comment
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.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.