[libc][math] Refactor sinf implementation to header-only in src/__support/math folder.#177963
Merged
[libc][math] Refactor sinf implementation to header-only in src/__support/math folder.#177963
Conversation
Member
|
@llvm/pr-subscribers-libc Author: Nico Weber (nico) ChangesPart of #147386 in preparation for: I used #177583 to create the initial version of this. (It got a bit confused by the #if/#else/#endif for sinf, but easy to fix up manually.) Full diff: https://github.com/llvm/llvm-project/pull/177963.diff 9 Files Affected:
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 5126e46c9772e..9e76e710ecb01 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -84,6 +84,7 @@
#include "math/rsqrtf.h"
#include "math/rsqrtf16.h"
#include "math/sin.h"
+#include "math/sinf.h"
#include "math/tan.h"
#include "math/tanf.h"
diff --git a/libc/shared/math/sinf.h b/libc/shared/math/sinf.h
new file mode 100644
index 0000000000000..5157b1e2d7cdc
--- /dev/null
+++ b/libc/shared/math/sinf.h
@@ -0,0 +1,23 @@
+//===-- Shared sinf function ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_SINF_H
+#define LLVM_LIBC_SHARED_MATH_SINF_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/sinf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::sinf;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_SINF_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index d18ebc03ba7b8..9fe1eb967d5e0 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -1286,3 +1286,19 @@ add_header_library(
libc.src.__support.FPUtil.polyeval
libc.src.__support.macros.optimization
)
+
+add_header_library(
+ sinf
+ HDRS
+ sinf.h
+ DEPENDS
+ .range_reduction
+ .sincosf_utils
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.fenv_impl
+ libc.src.__support.FPUtil.fma
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.FPUtil.polyeval
+ libc.src.__support.FPUtil.rounding_mode
+ libc.src.__support.macros.optimization
+)
diff --git a/libc/src/__support/math/sinf.h b/libc/src/__support/math/sinf.h
new file mode 100644
index 0000000000000..b07ebba61bcd9
--- /dev/null
+++ b/libc/src/__support/math/sinf.h
@@ -0,0 +1,194 @@
+//===-- Single-precision sin function -------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LIBC_SRC___SUPPORT_MATH_SINF_H
+#define LIBC_SRC___SUPPORT_MATH_SINF_H
+
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/PolyEval.h"
+#include "src/__support/FPUtil/multiply_add.h"
+#include "src/__support/FPUtil/rounding_mode.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
+
+#if defined(LIBC_MATH_HAS_SKIP_ACCURATE_PASS) && \
+ defined(LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT) && \
+ defined(LIBC_TARGET_CPU_HAS_FMA_FLOAT)
+
+#include "sincosf_float_eval.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE static float sinf(float x) {
+ return math::sincosf_float_eval::sincosf_eval</*IS_SIN*/ true>(x);
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#else // !LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT
+
+#include "src/__support/math/sincosf_utils.h"
+
+#ifdef LIBC_TARGET_CPU_HAS_FMA_DOUBLE
+#include "src/__support/math/range_reduction_fma.h"
+#else // !LIBC_TARGET_CPU_HAS_FMA_DOUBLE
+#include "src/__support/math/range_reduction.h"
+#endif // LIBC_TARGET_CPU_HAS_FMA_DOUBLE
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE static float sinf(float x) {
+ using FPBits = typename fputil::FPBits<float>;
+ FPBits xbits(x);
+
+ uint32_t x_u = xbits.uintval();
+ uint32_t x_abs = x_u & 0x7fff'ffffU;
+ double xd = static_cast<double>(x);
+
+ // Range reduction:
+ // For |x| > pi/32, we perform range reduction as follows:
+ // Find k and y such that:
+ // x = (k + y) * pi/32
+ // k is an integer
+ // |y| < 0.5
+ // For small range (|x| < 2^45 when FMA instructions are available, 2^22
+ // otherwise), this is done by performing:
+ // k = round(x * 32/pi)
+ // y = x * 32/pi - k
+ // For large range, we will omit all the higher parts of 32/pi such that the
+ // least significant bits of their full products with x are larger than 63,
+ // since sin((k + y + 64*i) * pi/32) = sin(x + i * 2pi) = sin(x).
+ //
+ // When FMA instructions are not available, we store the digits of 32/pi in
+ // chunks of 28-bit precision. This will make sure that the products:
+ // x * THIRTYTWO_OVER_PI_28[i] are all exact.
+ // When FMA instructions are available, we simply store the digits of 32/pi in
+ // chunks of doubles (53-bit of precision).
+ // So when multiplying by the largest values of single precision, the
+ // resulting output should be correct up to 2^(-208 + 128) ~ 2^-80. By the
+ // worst-case analysis of range reduction, |y| >= 2^-38, so this should give
+ // us more than 40 bits of accuracy. For the worst-case estimation of range
+ // reduction, see for instances:
+ // Elementary Functions by J-M. Muller, Chapter 11,
+ // Handbook of Floating-Point Arithmetic by J-M. Muller et. al.,
+ // Chapter 10.2.
+ //
+ // Once k and y are computed, we then deduce the answer by the sine of sum
+ // formula:
+ // sin(x) = sin((k + y)*pi/32)
+ // = sin(y*pi/32) * cos(k*pi/32) + cos(y*pi/32) * sin(k*pi/32)
+ // The values of sin(k*pi/32) and cos(k*pi/32) for k = 0..31 are precomputed
+ // and stored using a vector of 32 doubles. Sin(y*pi/32) and cos(y*pi/32) are
+ // computed using degree-7 and degree-6 minimax polynomials generated by
+ // Sollya respectively.
+
+ // |x| <= pi/16
+ if (LIBC_UNLIKELY(x_abs <= 0x3e49'0fdbU)) {
+
+ // |x| < 0x1.d12ed2p-12f
+ if (LIBC_UNLIKELY(x_abs < 0x39e8'9769U)) {
+ if (LIBC_UNLIKELY(x_abs == 0U)) {
+ // For signed zeros.
+ return x;
+ }
+ // When |x| < 2^-12, the relative error of the approximation sin(x) ~ x
+ // is:
+ // |sin(x) - x| / |sin(x)| < |x^3| / (6|x|)
+ // = x^2 / 6
+ // < 2^-25
+ // < epsilon(1)/2.
+ // So the correctly rounded values of sin(x) are:
+ // = x - sign(x)*eps(x) if rounding mode = FE_TOWARDZERO,
+ // or (rounding mode = FE_UPWARD and x is
+ // negative),
+ // = x otherwise.
+ // To simplify the rounding decision and make it more efficient, we use
+ // fma(x, -2^-25, x) instead.
+ // An exhaustive test shows that this formula work correctly for all
+ // rounding modes up to |x| < 0x1.c555dep-11f.
+ // Note: to use the formula x - 2^-25*x to decide the correct rounding, we
+ // do need fma(x, -2^-25, x) to prevent underflow caused by -2^-25*x when
+ // |x| < 2^-125. For targets without FMA instructions, we simply use
+ // double for intermediate results as it is more efficient than using an
+ // emulated version of FMA.
+#if defined(LIBC_TARGET_CPU_HAS_FMA_FLOAT)
+ return fputil::multiply_add(x, -0x1.0p-25f, x);
+#else
+ return static_cast<float>(fputil::multiply_add(xd, -0x1.0p-25, xd));
+#endif // LIBC_TARGET_CPU_HAS_FMA_FLOAT
+ }
+
+ // |x| < pi/16.
+ double xsq = xd * xd;
+
+ // Degree-9 polynomial approximation:
+ // sin(x) ~ x + a_3 x^3 + a_5 x^5 + a_7 x^7 + a_9 x^9
+ // = x (1 + a_3 x^2 + ... + a_9 x^8)
+ // = x * P(x^2)
+ // generated by Sollya with the following commands:
+ // > display = hexadecimal;
+ // > Q = fpminimax(sin(x)/x, [|0, 2, 4, 6, 8|], [|1, D...|], [0, pi/16]);
+ double result =
+ fputil::polyeval(xsq, 1.0, -0x1.55555555554c6p-3, 0x1.1111111085e65p-7,
+ -0x1.a019f70fb4d4fp-13, 0x1.718d179815e74p-19);
+ return static_cast<float>(xd * result);
+ }
+
+#ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
+ if (LIBC_UNLIKELY(x_abs == 0x4619'9998U)) { // x = 0x1.33333p13
+ float r = -0x1.63f4bap-2f;
+ int rounding = fputil::quick_get_round();
+ if ((rounding == FE_DOWNWARD && xbits.is_pos()) ||
+ (rounding == FE_UPWARD && xbits.is_neg()))
+ r = -0x1.63f4bcp-2f;
+ return xbits.is_neg() ? -r : r;
+ }
+#endif // !LIBC_MATH_HAS_SKIP_ACCURATE_PASS
+
+ if (LIBC_UNLIKELY(x_abs >= 0x7f80'0000U)) {
+ if (xbits.is_signaling_nan()) {
+ fputil::raise_except_if_required(FE_INVALID);
+ return FPBits::quiet_nan().get_val();
+ }
+
+ if (x_abs == 0x7f80'0000U) {
+ fputil::set_errno_if_required(EDOM);
+ fputil::raise_except_if_required(FE_INVALID);
+ }
+ return x + FPBits::quiet_nan().get_val();
+ }
+
+ // Combine the results with the sine of sum formula:
+ // sin(x) = sin((k + y)*pi/32)
+ // = sin(y*pi/32) * cos(k*pi/32) + cos(y*pi/32) * sin(k*pi/32)
+ // = sin_y * cos_k + (1 + cosm1_y) * sin_k
+ // = sin_y * cos_k + (cosm1_y * sin_k + sin_k)
+ double sin_k, cos_k, sin_y, cosm1_y;
+
+ sincosf_eval(xd, x_abs, sin_k, cos_k, sin_y, cosm1_y);
+
+ return static_cast<float>(fputil::multiply_add(
+ sin_y, cos_k, fputil::multiply_add(cosm1_y, sin_k, sin_k)));
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT
+
+#endif // LIBC_SRC___SUPPORT_MATH_SINF_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 3addfab6c6603..d07ef01567d6f 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -372,16 +372,8 @@ add_entrypoint_object(
HDRS
../sinf.h
DEPENDS
- libc.src.__support.math.range_reduction
- libc.src.__support.math.sincosf_utils
+ libc.src.__support.math.sinf
libc.src.errno.errno
- libc.src.__support.FPUtil.basic_operations
- libc.src.__support.FPUtil.fenv_impl
- libc.src.__support.FPUtil.fp_bits
- libc.src.__support.FPUtil.fma
- libc.src.__support.FPUtil.polyeval
- libc.src.__support.FPUtil.rounding_mode
- libc.src.__support.macros.optimization
)
add_entrypoint_object(
diff --git a/libc/src/math/generic/sinf.cpp b/libc/src/math/generic/sinf.cpp
index c362628fb106c..648d57b82488c 100644
--- a/libc/src/math/generic/sinf.cpp
+++ b/libc/src/math/generic/sinf.cpp
@@ -7,176 +7,10 @@
//===----------------------------------------------------------------------===//
#include "src/math/sinf.h"
-#include "src/__support/FPUtil/BasicOperations.h"
-#include "src/__support/FPUtil/FEnvImpl.h"
-#include "src/__support/FPUtil/FPBits.h"
-#include "src/__support/FPUtil/PolyEval.h"
-#include "src/__support/FPUtil/multiply_add.h"
-#include "src/__support/FPUtil/rounding_mode.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
-#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
-
-#if defined(LIBC_MATH_HAS_SKIP_ACCURATE_PASS) && \
- defined(LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT) && \
- defined(LIBC_TARGET_CPU_HAS_FMA_FLOAT)
-
-#include "src/__support/math/sincosf_float_eval.h"
+#include "src/__support/math/sinf.h"
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(float, sinf, (float x)) {
- return math::sincosf_float_eval::sincosf_eval</*IS_SIN*/ true>(x);
-}
-
-} // namespace LIBC_NAMESPACE_DECL
-
-#else // !LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT
-
-#include "src/__support/math/sincosf_utils.h"
-
-#ifdef LIBC_TARGET_CPU_HAS_FMA_DOUBLE
-#include "src/__support/math/range_reduction_fma.h"
-#else // !LIBC_TARGET_CPU_HAS_FMA_DOUBLE
-#include "src/__support/math/range_reduction.h"
-#endif // LIBC_TARGET_CPU_HAS_FMA_DOUBLE
-
-namespace LIBC_NAMESPACE_DECL {
-
-LLVM_LIBC_FUNCTION(float, sinf, (float x)) {
- using FPBits = typename fputil::FPBits<float>;
- FPBits xbits(x);
-
- uint32_t x_u = xbits.uintval();
- uint32_t x_abs = x_u & 0x7fff'ffffU;
- double xd = static_cast<double>(x);
-
- // Range reduction:
- // For |x| > pi/32, we perform range reduction as follows:
- // Find k and y such that:
- // x = (k + y) * pi/32
- // k is an integer
- // |y| < 0.5
- // For small range (|x| < 2^45 when FMA instructions are available, 2^22
- // otherwise), this is done by performing:
- // k = round(x * 32/pi)
- // y = x * 32/pi - k
- // For large range, we will omit all the higher parts of 32/pi such that the
- // least significant bits of their full products with x are larger than 63,
- // since sin((k + y + 64*i) * pi/32) = sin(x + i * 2pi) = sin(x).
- //
- // When FMA instructions are not available, we store the digits of 32/pi in
- // chunks of 28-bit precision. This will make sure that the products:
- // x * THIRTYTWO_OVER_PI_28[i] are all exact.
- // When FMA instructions are available, we simply store the digits of 32/pi in
- // chunks of doubles (53-bit of precision).
- // So when multiplying by the largest values of single precision, the
- // resulting output should be correct up to 2^(-208 + 128) ~ 2^-80. By the
- // worst-case analysis of range reduction, |y| >= 2^-38, so this should give
- // us more than 40 bits of accuracy. For the worst-case estimation of range
- // reduction, see for instances:
- // Elementary Functions by J-M. Muller, Chapter 11,
- // Handbook of Floating-Point Arithmetic by J-M. Muller et. al.,
- // Chapter 10.2.
- //
- // Once k and y are computed, we then deduce the answer by the sine of sum
- // formula:
- // sin(x) = sin((k + y)*pi/32)
- // = sin(y*pi/32) * cos(k*pi/32) + cos(y*pi/32) * sin(k*pi/32)
- // The values of sin(k*pi/32) and cos(k*pi/32) for k = 0..31 are precomputed
- // and stored using a vector of 32 doubles. Sin(y*pi/32) and cos(y*pi/32) are
- // computed using degree-7 and degree-6 minimax polynomials generated by
- // Sollya respectively.
-
- // |x| <= pi/16
- if (LIBC_UNLIKELY(x_abs <= 0x3e49'0fdbU)) {
-
- // |x| < 0x1.d12ed2p-12f
- if (LIBC_UNLIKELY(x_abs < 0x39e8'9769U)) {
- if (LIBC_UNLIKELY(x_abs == 0U)) {
- // For signed zeros.
- return x;
- }
- // When |x| < 2^-12, the relative error of the approximation sin(x) ~ x
- // is:
- // |sin(x) - x| / |sin(x)| < |x^3| / (6|x|)
- // = x^2 / 6
- // < 2^-25
- // < epsilon(1)/2.
- // So the correctly rounded values of sin(x) are:
- // = x - sign(x)*eps(x) if rounding mode = FE_TOWARDZERO,
- // or (rounding mode = FE_UPWARD and x is
- // negative),
- // = x otherwise.
- // To simplify the rounding decision and make it more efficient, we use
- // fma(x, -2^-25, x) instead.
- // An exhaustive test shows that this formula work correctly for all
- // rounding modes up to |x| < 0x1.c555dep-11f.
- // Note: to use the formula x - 2^-25*x to decide the correct rounding, we
- // do need fma(x, -2^-25, x) to prevent underflow caused by -2^-25*x when
- // |x| < 2^-125. For targets without FMA instructions, we simply use
- // double for intermediate results as it is more efficient than using an
- // emulated version of FMA.
-#if defined(LIBC_TARGET_CPU_HAS_FMA_FLOAT)
- return fputil::multiply_add(x, -0x1.0p-25f, x);
-#else
- return static_cast<float>(fputil::multiply_add(xd, -0x1.0p-25, xd));
-#endif // LIBC_TARGET_CPU_HAS_FMA_FLOAT
- }
-
- // |x| < pi/16.
- double xsq = xd * xd;
-
- // Degree-9 polynomial approximation:
- // sin(x) ~ x + a_3 x^3 + a_5 x^5 + a_7 x^7 + a_9 x^9
- // = x (1 + a_3 x^2 + ... + a_9 x^8)
- // = x * P(x^2)
- // generated by Sollya with the following commands:
- // > display = hexadecimal;
- // > Q = fpminimax(sin(x)/x, [|0, 2, 4, 6, 8|], [|1, D...|], [0, pi/16]);
- double result =
- fputil::polyeval(xsq, 1.0, -0x1.55555555554c6p-3, 0x1.1111111085e65p-7,
- -0x1.a019f70fb4d4fp-13, 0x1.718d179815e74p-19);
- return static_cast<float>(xd * result);
- }
-
-#ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
- if (LIBC_UNLIKELY(x_abs == 0x4619'9998U)) { // x = 0x1.33333p13
- float r = -0x1.63f4bap-2f;
- int rounding = fputil::quick_get_round();
- if ((rounding == FE_DOWNWARD && xbits.is_pos()) ||
- (rounding == FE_UPWARD && xbits.is_neg()))
- r = -0x1.63f4bcp-2f;
- return xbits.is_neg() ? -r : r;
- }
-#endif // !LIBC_MATH_HAS_SKIP_ACCURATE_PASS
-
- if (LIBC_UNLIKELY(x_abs >= 0x7f80'0000U)) {
- if (xbits.is_signaling_nan()) {
- fputil::raise_except_if_required(FE_INVALID);
- return FPBits::quiet_nan().get_val();
- }
-
- if (x_abs == 0x7f80'0000U) {
- fputil::set_errno_if_required(EDOM);
- fputil::raise_except_if_required(FE_INVALID);
- }
- return x + FPBits::quiet_nan().get_val();
- }
-
- // Combine the results with the sine of sum formula:
- // sin(x) = sin((k + y)*pi/32)
- // = sin(y*pi/32) * cos(k*pi/32) + cos(y*pi/32) * sin(k*pi/32)
- // = sin_y * cos_k + (1 + cosm1_y) * sin_k
- // = sin_y * cos_k + (cosm1_y * sin_k + sin_k)
- double sin_k, cos_k, sin_y, cosm1_y;
-
- sincosf_eval(xd, x_abs, sin_k, cos_k, sin_y, cosm1_y);
-
- return static_cast<float>(fputil::multiply_add(
- sin_y, cos_k, fputil::multiply_add(cosm1_y, sin_k, sin_k)));
-}
+LLVM_LIBC_FUNCTION(float, sinf, (float x)) { return math::sinf(x); }
} // namespace LIBC_NAMESPACE_DECL
-#endif // LIBC_MATH_HAS_INTERMEDIATE_COMP_IN_FLOAT
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index dabf5f6b168cc..e3c9fa097f638 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -82,4 +82,5 @@ add_fp_unittest(
libc.src.__support.math.sin
libc.src.__support.math.tan
libc.src.__support.math.tanf
+ libc.src.__support.math.sinf
)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index cd389c41cb7b2..4c107d786d3a7 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -89,6 +89,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat) {
EXPECT_EQ(long(0), LIBC_NAMESPACE::shared::llogbf(1.0f));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::logbf(1.0f));
EXPECT_FP_EQ(0x1p+0f, LIBC_NAMESPACE::shared::rsqrtf(1.0f));
+ EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::sinf(0.0f));
EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::tanf(0.0f));
}
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 346864d2276c0..66e87df60135d 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3455,6 +3455,20 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_sinf",
+ hdrs = ["src/__support/math/sinf.h"],
+ deps = [
+ ":__support_fputil_fma",
+ ":__support_fputil_polyeval",
+ ":__support_fputil_rounding_mode",
+ ":__support_macros_optimization",
+ ":__support_macros_properties_cpu_features",
+ ":__support_range_reduction",
+ ":__support_sincosf_utils",
+ ],
+)
+
libc_support_library(
name = "__support_math_sinhfcoshf_utils",
hdrs = ["src/__support/math/sinhfcoshf_utils.h"],
@@ -5058,13 +5072,7 @@ libc_math_function(
libc_math_function(
name = "sinf",
additional_deps = [
- ":__support_fputil_fma",
- ":__support_fputil_polyeval",
- ":__support_fputil_rounding_mode",
- ":__support_macros_optimization",
- ":__support_macros_properties_cpu_features",
- ":__support_range_reduction",
- ":__support_sincosf_utils",
+ ":__support_math_sinf",
],
)
|
Contributor
Author
|
Thanks, all done! I'll update my script. |
nico
added a commit
to nico/llvm-project
that referenced
this pull request
Jan 26, 2026
...due to the feedback on llvm#177963. Patch generated by running rg -l '\bLIBC_SRC' libc/src/__support/math | \ xargs sed -i '' -e \ 's/LIBC_SRC___SUPPORT_MATH_\([A-Z0-9_]*\)/LLVM_LIBC_SRC___SUPPORT_MATH_\1/'
bassiounix
pushed a commit
that referenced
this pull request
Jan 26, 2026
...due to the feedback on #177963. Patch generated by running rg -l '\bLIBC_SRC' libc/src/__support/math | \ xargs sed -i '' -e \ 's/LIBC_SRC___SUPPORT_MATH_\([A-Z0-9_]*\)/LLVM_LIBC_SRC___SUPPORT_MATH_\1/'
Abdelrhmansersawy
pushed a commit
to Abdelrhmansersawy/llvm-project
that referenced
this pull request
Jan 27, 2026
...due to the feedback on llvm#177963. Patch generated by running rg -l '\bLIBC_SRC' libc/src/__support/math | \ xargs sed -i '' -e \ 's/LIBC_SRC___SUPPORT_MATH_\([A-Z0-9_]*\)/LLVM_LIBC_SRC___SUPPORT_MATH_\1/'
stomfaig
pushed a commit
to stomfaig/llvm-project
that referenced
this pull request
Jan 28, 2026
stomfaig
pushed a commit
to stomfaig/llvm-project
that referenced
this pull request
Jan 28, 2026
...due to the feedback on llvm#177963. Patch generated by running rg -l '\bLIBC_SRC' libc/src/__support/math | \ xargs sed -i '' -e \ 's/LIBC_SRC___SUPPORT_MATH_\([A-Z0-9_]*\)/LLVM_LIBC_SRC___SUPPORT_MATH_\1/'
sshrestha-aa
pushed a commit
to sshrestha-aa/llvm-project
that referenced
this pull request
Feb 4, 2026
sshrestha-aa
pushed a commit
to sshrestha-aa/llvm-project
that referenced
this pull request
Feb 4, 2026
...due to the feedback on llvm#177963. Patch generated by running rg -l '\bLIBC_SRC' libc/src/__support/math | \ xargs sed -i '' -e \ 's/LIBC_SRC___SUPPORT_MATH_\([A-Z0-9_]*\)/LLVM_LIBC_SRC___SUPPORT_MATH_\1/'
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
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.
Part of #147386
in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
I used #177583 to create the initial version of this. (It got a bit confused by the #if/#else/#endif for sinf, but easy to fix up manually.)