[libc-commits] [libc] [llvm] [libc][math] Fix LIBC_MATH_HAS_SMALL_TABLES check in sin.cpp and cos.cpp (PR #240076)
via libc-commits
libc-commits at lists.llvm.org
Sat Nov 7 16:58:22 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: lntue
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/240076.diff
4 Files Affected:
- (modified) libc/src/math/generic/CMakeLists.txt (+2)
- (modified) libc/src/math/generic/cos.cpp (+3-1)
- (modified) libc/src/math/generic/sin.cpp (+1-1)
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+1)
``````````diff
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 1d628e75ecd80..ac2da02e814ac 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -306,6 +306,7 @@ add_entrypoint_object(
HDRS
../cos.h
DEPENDS
+ libc.src.__support.macros.optimization
libc.src.__support.macros.properties.cpu_features
libc.src.__support.math.cos
libc.src.__support.math.cos_integer_eval
@@ -358,6 +359,7 @@ add_entrypoint_object(
HDRS
../sin.h
DEPENDS
+ libc.src.__support.macros.optimization
libc.src.__support.macros.properties.cpu_features
libc.src.__support.math.sin
libc.src.__support.math.sin_integer_eval
diff --git a/libc/src/math/generic/cos.cpp b/libc/src/math/generic/cos.cpp
index 469ceadd035c6..3f319bb029678 100644
--- a/libc/src/math/generic/cos.cpp
+++ b/libc/src/math/generic/cos.cpp
@@ -7,6 +7,8 @@
//===----------------------------------------------------------------------===//
#include "src/math/cos.h"
+#include "src/__support/macros/optimization.h"
+#include "src/__support/macros/properties/cpu_features.h"
#include "src/__support/math/cos.h"
#include "src/__support/math/cos_integer_eval.h"
@@ -14,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, cos, (double x)) {
#if defined(LIBC_MATH_HAS_SKIP_ACCURATE_PASS) && \
- defined(LIBC_MATH_SMALL_TABLES) && \
+ defined(LIBC_MATH_HAS_SMALL_TABLES) && \
!defined(LIBC_TARGET_CPU_HAS_FPU_DOUBLE)
return math::integer_only::cos(x);
#else
diff --git a/libc/src/math/generic/sin.cpp b/libc/src/math/generic/sin.cpp
index 39e297efde46c..a20a0265b01e5 100644
--- a/libc/src/math/generic/sin.cpp
+++ b/libc/src/math/generic/sin.cpp
@@ -16,7 +16,7 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, sin, (double x)) {
#if defined(LIBC_MATH_HAS_SKIP_ACCURATE_PASS) && \
- defined(LIBC_MATH_SMALL_TABLES) && \
+ defined(LIBC_MATH_HAS_SMALL_TABLES) && \
!defined(LIBC_TARGET_CPU_HAS_FPU_DOUBLE)
return math::integer_only::sin(x);
#else
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 89c312fa4fe87..722b4fcd4b7dd 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -13956,6 +13956,7 @@ libc_math_function(
libc_math_function(
name = "cos",
additional_deps = [
+ ":__support_macros_optimization",
":__support_macros_properties_cpu_features",
":__support_math_cos",
":__support_math_cos_integer_eval",
``````````
</details>
https://github.com/llvm/llvm-project/pull/240076
More information about the libc-commits
mailing list