[libc-commits] [libc] c84f759 - [libc] Fix compilation of new trig functions (#111987)

via libc-commits libc-commits at lists.llvm.org
Fri Oct 11 05:38:21 PDT 2024


Author: Joseph Huber
Date: 2024-10-11T05:38:17-07:00
New Revision: c84f75966af79a381e27e6ffc9481c1fae2fcb4f

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

LOG: [libc] Fix compilation of new trig functions (#111987)

Added: 
    

Modified: 
    libc/src/math/generic/cos.cpp
    libc/src/math/generic/range_reduction_double_common.h

Removed: 
    


################################################################################
diff  --git a/libc/src/math/generic/cos.cpp b/libc/src/math/generic/cos.cpp
index 923ea96852d889..568b1254c6f02b 100644
--- a/libc/src/math/generic/cos.cpp
+++ b/libc/src/math/generic/cos.cpp
@@ -93,7 +93,7 @@ LLVM_LIBC_FUNCTION(double, cos, (double x)) {
     }
     return ans;
   };
-  DoubleDouble sin_k = get_idx_dd(k + 128);
+  DoubleDouble msin_k = get_idx_dd(k + 128);
   DoubleDouble cos_k = get_idx_dd(k + 64);
 #else
   // Fast look up version, but needs 256-entry table.

diff  --git a/libc/src/math/generic/range_reduction_double_common.h b/libc/src/math/generic/range_reduction_double_common.h
index e23bbff144bee8..bcab82f6c9c3a8 100644
--- a/libc/src/math/generic/range_reduction_double_common.h
+++ b/libc/src/math/generic/range_reduction_double_common.h
@@ -278,6 +278,7 @@ struct LargeRangeReduction {
   DoubleDouble y_mid;
 };
 
+#ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
 static Float128 range_reduction_small_f128(double x) {
   constexpr Float128 PI_OVER_128_F128 = {
       Sign::POS, -133, 0xc90f'daa2'2168'c234'c4c6'628b'80dc'1cd1_u128};
@@ -300,7 +301,6 @@ static Float128 range_reduction_small_f128(double x) {
   return fputil::quick_mul(y, PI_OVER_128_F128);
 }
 
-#ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
 static constexpr Float128 SIN_K_PI_OVER_128_F128[65] = {
     {Sign::POS, 0, 0},
     {Sign::POS, -133, 0xc90a'afbd'1b33'efc9'c539'edcb'fda0'cf2c_u128},


        


More information about the libc-commits mailing list