diff --git a/libc/docs/build_and_test.rst b/libc/docs/build_and_test.rst --- a/libc/docs/build_and_test.rst +++ b/libc/docs/build_and_test.rst @@ -62,3 +62,20 @@ "LIBC_INCLUDE_DOCS" : true } } + +Building with Bazel +=================== + +#. To build with Bazel, use the following command: + + .. code-block:: sh + + $> bazel build --config=generic_clang @llvm-project//libc/... + +#. To run the unit tests with bazel, use the following command: + + .. code-block:: sh + + $> bazel test --config=generic_clang @llvm-project//libc/... + +#. The bazel target layout of `libc` is located at: `utils/bazel/llvm-project-overlay/libc/BUILD.bazel `_. diff --git a/libc/src/math/generic/explogxf.h b/libc/src/math/generic/explogxf.h --- a/libc/src/math/generic/explogxf.h +++ b/libc/src/math/generic/explogxf.h @@ -16,7 +16,6 @@ #include "src/__support/FPUtil/PolyEval.h" #include "src/__support/FPUtil/nearest_integer.h" #include "src/__support/common.h" -#include #include diff --git a/libc/src/math/generic/inv_trigf_utils.h b/libc/src/math/generic/inv_trigf_utils.h --- a/libc/src/math/generic/inv_trigf_utils.h +++ b/libc/src/math/generic/inv_trigf_utils.h @@ -15,7 +15,6 @@ #include "src/__support/FPUtil/PolyEval.h" #include "src/__support/FPUtil/nearest_integer.h" #include "src/__support/common.h" -#include #include diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -726,6 +726,39 @@ ], ) +libc_support_library( + name = "explogxf", + hdrs = ["src/math/generic/explogxf.h"], + srcs = ["src/math/generic/explogxf.cpp"], + deps = [ + ":__support_common", + ":__support_fputil_fp_bits", + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ":math_utils", + ":libc_root", + ], +) + +libc_support_library( + name = "inv_trigf_utils", + hdrs = ["src/math/generic/inv_trigf_utils.h"], + srcs = ["src/math/generic/inv_trigf_utils.cpp"], + deps = [ + ":__support_common", + ":__support_fputil_fp_bits", + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":math_utils", + ":libc_root", + ], +) + libc_math_function( name = "expm1f", additional_deps = [ @@ -737,6 +770,193 @@ ], ) +libc_math_function( + name = "expf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ], +) + +libc_math_function( + name = "exp10f", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ":explogxf", + ], +) + +libc_math_function( + name = "exp2f", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":explogxf", + ], +) + +libc_math_function( + name = "logf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ], +) + +libc_math_function( + name = "log2f", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ], +) + +libc_math_function( + name = "log10f", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ], +) + +libc_math_function( + name = "log1pf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ], +) + +libc_math_function( + name = "sinhf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ":explogxf", + ], +) + +libc_math_function( + name = "coshf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ":explogxf", + ], +) + +libc_math_function( + name = "tanhf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ":explogxf", + ], +) + +libc_math_function( + name = "asinhf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":__support_fputil_sqrt", + ":common_constants", + ":explogxf", + ], +) + +libc_math_function( + name = "acoshf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":__support_fputil_sqrt", + ":common_constants", + ":explogxf", + ], +) + +libc_math_function( + name = "atanhf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":common_constants", + ":explogxf", + ], +) + +libc_math_function( + name = "asinf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":__support_fputil_sqrt", + ":inv_trigf_utils", + ], +) + +libc_math_function( + name = "acosf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":__support_fputil_sqrt", + ":inv_trigf_utils", + ], +) + +libc_math_function( + name = "atanf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_nearest_integer", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":inv_trigf_utils", + ], +) + libc_math_function(name = "fabs") libc_math_function(name = "fabsf") @@ -912,6 +1132,17 @@ ], ) +libc_math_function( + name = "tanf", + additional_deps = [ + ":__support_fputil_fma", + ":__support_fputil_multiply_add", + ":__support_fputil_polyeval", + ":range_reduction", + ":sincosf_utils", + ], +) + libc_math_function( name = "sqrt", 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 --- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel @@ -572,3 +572,129 @@ "//libc/utils/MPFRWrapper:mpfr_wrapper", ], ) + +math_test( + name = "tanf", + deps = [ + ":sdcomp26094", + "//libc:__support_cpp_array", + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ], +) + +math_test( + name = "expf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "exp2f", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) +math_test( + name = "exp10f", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) +math_test( + name = "expm1f", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "logf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "log2f", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "log10f", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "log1pf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "sinhf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "coshf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "tanhf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "asinhf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "acoshf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "atanhf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "asinf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "acosf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +) + +math_test( + name = "atanf", + deps = [ + "//libc/utils/MPFRWrapper:mpfr_wrapper", + ] +)