[libc-commits] [libc] d1823a0 - [libc][math] Fix LIBC_MATH_HAS_SMALL_TABLES check in sin.cpp and cos.cpp (#240076)

via libc-commits libc-commits at lists.llvm.org
Sun Nov 8 05:21:00 PST 2026


Author: lntue
Date: 2026-11-08T08:20:55-05:00
New Revision: d1823a0fc406b83e5cdd394e722106aedaf39680

URL: https://github.com/llvm/llvm-project/commit/d1823a0fc406b83e5cdd394e722106aedaf39680
DIFF: https://github.com/llvm/llvm-project/commit/d1823a0fc406b83e5cdd394e722106aedaf39680.diff

LOG: [libc][math] Fix LIBC_MATH_HAS_SMALL_TABLES check in sin.cpp and cos.cpp (#240076)

Added: 
    

Modified: 
    libc/src/math/generic/CMakeLists.txt
    libc/src/math/generic/cos.cpp
    libc/src/math/generic/sin.cpp
    utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Removed: 
    


################################################################################
diff  --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 1d628e75ecd807..ac2da02e814acd 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 469ceadd035c62..3f319bb029678a 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 39e297efde46ce..a20a0265b01e5c 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 c22d9cc7202dd5..6455190b39f67e 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -13972,6 +13972,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",


        


More information about the libc-commits mailing list