[libc-commits] [libc] [libc][math] Resolve size issues on baremetal and cleanup code. (PR #179707)

via libc-commits libc-commits at lists.llvm.org
Wed Feb 4 08:27:48 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Muhammad Bassiouni (bassiounix)

<details>
<summary>Changes</summary>



---

Patch is 111.47 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/179707.diff


116 Files Affected:

- (modified) libc/src/__support/math/acos.h (+1-1) 
- (modified) libc/src/__support/math/acosf.h (+14-13) 
- (modified) libc/src/__support/math/acosf16.h (+1-1) 
- (modified) libc/src/__support/math/acosh_float_constants.h (+3-2) 
- (modified) libc/src/__support/math/acoshf.h (+1-1) 
- (modified) libc/src/__support/math/acoshf16.h (+1-1) 
- (modified) libc/src/__support/math/acoshf_utils.h (+1-1) 
- (modified) libc/src/__support/math/acospif16.h (+1-1) 
- (modified) libc/src/__support/math/asin.h (+1-1) 
- (modified) libc/src/__support/math/asin_utils.h (+12-12) 
- (modified) libc/src/__support/math/asinf.h (+1-1) 
- (modified) libc/src/__support/math/asinf16.h (+1-1) 
- (modified) libc/src/__support/math/asinhf.h (+1-1) 
- (modified) libc/src/__support/math/asinhf16.h (+1-1) 
- (modified) libc/src/__support/math/atan.h (+1-1) 
- (modified) libc/src/__support/math/atan2f.h (+8-10) 
- (modified) libc/src/__support/math/atan2f128.h (+1-1) 
- (modified) libc/src/__support/math/atan2f_float.h (+3-3) 
- (modified) libc/src/__support/math/atan_utils.h (+8-10) 
- (modified) libc/src/__support/math/atanf.h (+1-1) 
- (modified) libc/src/__support/math/atanf16.h (+1-1) 
- (modified) libc/src/__support/math/atanf_float.h (+4-4) 
- (modified) libc/src/__support/math/atanhf.h (+1-1) 
- (modified) libc/src/__support/math/atanhf16.h (+4-4) 
- (modified) libc/src/__support/math/cbrt.h (+6-6) 
- (modified) libc/src/__support/math/cbrtf.h (+1-1) 
- (modified) libc/src/__support/math/cosf.h (+3-2) 
- (modified) libc/src/__support/math/cosf16.h (+1-1) 
- (modified) libc/src/__support/math/coshf.h (+1-1) 
- (modified) libc/src/__support/math/coshf16.h (+1-1) 
- (modified) libc/src/__support/math/cospif.h (+2-1) 
- (modified) libc/src/__support/math/cospif16.h (+1-1) 
- (modified) libc/src/__support/math/dfmaf128.h (+1-1) 
- (modified) libc/src/__support/math/dfmal.h (+1-1) 
- (modified) libc/src/__support/math/dsqrtl.h (+1-1) 
- (modified) libc/src/__support/math/erff.h (+1-1) 
- (modified) libc/src/__support/math/exp.h (+21-20) 
- (modified) libc/src/__support/math/exp10.h (+16-18) 
- (modified) libc/src/__support/math/exp10_float16_constants.h (+3-3) 
- (modified) libc/src/__support/math/exp10f.h (+1-1) 
- (modified) libc/src/__support/math/exp10f16.h (+4-4) 
- (modified) libc/src/__support/math/exp10f16_utils.h (+1-1) 
- (modified) libc/src/__support/math/exp10f_utils.h (+1-1) 
- (modified) libc/src/__support/math/exp10m1f.h (+7-7) 
- (modified) libc/src/__support/math/exp10m1f16.h (+1-1) 
- (modified) libc/src/__support/math/exp2.h (+12-14) 
- (modified) libc/src/__support/math/exp2f.h (+1-1) 
- (modified) libc/src/__support/math/exp2f16.h (+1-1) 
- (modified) libc/src/__support/math/exp2m1f.h (+1-1) 
- (modified) libc/src/__support/math/exp2m1f16.h (+1-1) 
- (modified) libc/src/__support/math/exp_constants.h (+3-2) 
- (modified) libc/src/__support/math/exp_float_constants.h (+3-2) 
- (modified) libc/src/__support/math/exp_utils.h (+1-1) 
- (modified) libc/src/__support/math/expf.h (+1-1) 
- (modified) libc/src/__support/math/expf16.h (+2-3) 
- (modified) libc/src/__support/math/expf16_utils.h (+3-4) 
- (modified) libc/src/__support/math/expm1.h (+17-18) 
- (modified) libc/src/__support/math/expm1f.h (+1-1) 
- (modified) libc/src/__support/math/expm1f16.h (+1-1) 
- (modified) libc/src/__support/math/expxf16_utils.h (+12-12) 
- (modified) libc/src/__support/math/f16fma.h (+1-1) 
- (modified) libc/src/__support/math/f16fmal.h (+1-2) 
- (modified) libc/src/__support/math/f16sqrt.h (+1-1) 
- (modified) libc/src/__support/math/f16sqrtl.h (+1-1) 
- (modified) libc/src/__support/math/frexpf.h (+1-1) 
- (modified) libc/src/__support/math/frexpf128.h (+1-1) 
- (modified) libc/src/__support/math/frexpf16.h (+1-1) 
- (modified) libc/src/__support/math/fsqrt.h (+1-3) 
- (modified) libc/src/__support/math/fsqrtf128.h (+1-1) 
- (modified) libc/src/__support/math/fsqrtl.h (+1-1) 
- (modified) libc/src/__support/math/hypotf.h (+1-1) 
- (modified) libc/src/__support/math/ilogb.h (+1-3) 
- (modified) libc/src/__support/math/ilogbf128.h (+1-1) 
- (modified) libc/src/__support/math/ilogbl.h (+1-1) 
- (modified) libc/src/__support/math/inv_trigf_utils.h (+9-9) 
- (modified) libc/src/__support/math/ldexpf.h (+1-1) 
- (modified) libc/src/__support/math/ldexpf128.h (+1-1) 
- (modified) libc/src/__support/math/ldexpf16.h (+1-1) 
- (modified) libc/src/__support/math/llogb.h (+1-3) 
- (modified) libc/src/__support/math/llogbf.h (+1-3) 
- (modified) libc/src/__support/math/llogbf128.h (+1-1) 
- (modified) libc/src/__support/math/llogbf16.h (+1-1) 
- (modified) libc/src/__support/math/log.h (+2-2) 
- (modified) libc/src/__support/math/log10.h (+2-2) 
- (modified) libc/src/__support/math/log1p.h (+3-3) 
- (modified) libc/src/__support/math/log2.h (+2-2) 
- (modified) libc/src/__support/math/logbf.h (+1-1) 
- (modified) libc/src/__support/math/logbf128.h (+1-3) 
- (modified) libc/src/__support/math/logbf16.h (+1-3) 
- (modified) libc/src/__support/math/logf.h (+1-1) 
- (modified) libc/src/__support/math/logf16.h (+1-1) 
- (modified) libc/src/__support/math/range_reduction.h (+10-6) 
- (modified) libc/src/__support/math/range_reduction_double_common.h (+4-4) 
- (modified) libc/src/__support/math/range_reduction_double_fma.h (+1-1) 
- (modified) libc/src/__support/math/range_reduction_double_nofma.h (+1-1) 
- (modified) libc/src/__support/math/range_reduction_fma.h (+8-4) 
- (modified) libc/src/__support/math/rsqrtf.h (+1-1) 
- (modified) libc/src/__support/math/rsqrtf16.h (+1-1) 
- (modified) libc/src/__support/math/sincos_eval.h (+3-3) 
- (modified) libc/src/__support/math/sincosf.h (+1) 
- (modified) libc/src/__support/math/sincosf16_utils.h (+11-7) 
- (modified) libc/src/__support/math/sincosf_utils.h (+24-9) 
- (modified) libc/src/__support/math/sinf.h (+3-2) 
- (modified) libc/src/__support/math/sinf16.h (+1-1) 
- (modified) libc/src/__support/math/sinhf.h (+1-1) 
- (modified) libc/src/__support/math/sinhf16.h (+1-1) 
- (modified) libc/src/__support/math/sinpif.h (+2-1) 
- (modified) libc/src/__support/math/sqrt.h (+1-1) 
- (modified) libc/src/__support/math/sqrtf.h (+1-1) 
- (modified) libc/src/__support/math/sqrtf16.h (+1-1) 
- (modified) libc/src/__support/math/tan.h (+3-4) 
- (modified) libc/src/__support/math/tanf.h (+2-1) 
- (modified) libc/src/math/generic/sinpif16.cpp (+1-1) 
- (modified) libc/src/math/generic/tanf16.cpp (+1-1) 
- (modified) libc/src/math/generic/tanpif.cpp (+1) 
- (modified) libc/src/math/generic/tanpif16.cpp (+1-1) 


``````````diff
diff --git a/libc/src/__support/math/acos.h b/libc/src/__support/math/acos.h
index 0e1e413870844..6b419449176fd 100644
--- a/libc/src/__support/math/acos.h
+++ b/libc/src/__support/math/acos.h
@@ -24,7 +24,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr double acos(double x) {
+LIBC_INLINE constexpr double acos(double x) {
   using DoubleDouble = fputil::DoubleDouble;
   using namespace asin_internal;
   using FPBits = fputil::FPBits<double>;
diff --git a/libc/src/__support/math/acosf.h b/libc/src/__support/math/acosf.h
index 7a0c0e535a8a1..4cdf8ef704f25 100644
--- a/libc/src/__support/math/acosf.h
+++ b/libc/src/__support/math/acosf.h
@@ -26,26 +26,27 @@ namespace acosf_internal {
 
 #ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
 
-static constexpr size_t N_EXCEPTS = 4;
+LIBC_INLINE_VAR constexpr size_t N_EXCEPTS = 4;
 
 // Exceptional values when |x| <= 0.5
-static constexpr fputil::ExceptValues<float, N_EXCEPTS> ACOSF_EXCEPTS = {{
-    // (inputs, RZ output, RU offset, RD offset, RN offset)
-    // x = 0x1.110b46p-26, acosf(x) = 0x1.921fb4p0 (RZ)
-    {0x328885a3, 0x3fc90fda, 1, 0, 1},
-    // x = -0x1.110b46p-26, acosf(x) = 0x1.921fb4p0 (RZ)
-    {0xb28885a3, 0x3fc90fda, 1, 0, 1},
-    // x = 0x1.04c444p-12, acosf(x) = 0x1.920f68p0 (RZ)
-    {0x39826222, 0x3fc907b4, 1, 0, 1},
-    // x = -0x1.04c444p-12, acosf(x) = 0x1.923p0 (RZ)
-    {0xb9826222, 0x3fc91800, 1, 0, 1},
-}};
+LIBC_INLINE_VAR constexpr fputil::ExceptValues<float, N_EXCEPTS> ACOSF_EXCEPTS =
+    {{
+        // (inputs, RZ output, RU offset, RD offset, RN offset)
+        // x = 0x1.110b46p-26, acosf(x) = 0x1.921fb4p0 (RZ)
+        {0x328885a3, 0x3fc90fda, 1, 0, 1},
+        // x = -0x1.110b46p-26, acosf(x) = 0x1.921fb4p0 (RZ)
+        {0xb28885a3, 0x3fc90fda, 1, 0, 1},
+        // x = 0x1.04c444p-12, acosf(x) = 0x1.920f68p0 (RZ)
+        {0x39826222, 0x3fc907b4, 1, 0, 1},
+        // x = -0x1.04c444p-12, acosf(x) = 0x1.923p0 (RZ)
+        {0xb9826222, 0x3fc91800, 1, 0, 1},
+    }};
 
 #endif // !LIBC_MATH_HAS_SKIP_ACCURATE_PASS
 
 } // namespace acosf_internal
 
-LIBC_INLINE static constexpr float acosf(float x) {
+LIBC_INLINE constexpr float acosf(float x) {
   using namespace acosf_internal;
   using namespace inv_trigf_utils_internal;
   using FPBits = typename fputil::FPBits<float>;
diff --git a/libc/src/__support/math/acosf16.h b/libc/src/__support/math/acosf16.h
index 3f0e002a590e0..49cd203919aeb 100644
--- a/libc/src/__support/math/acosf16.h
+++ b/libc/src/__support/math/acosf16.h
@@ -26,7 +26,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float16 acosf16(float16 x) {
+LIBC_INLINE constexpr float16 acosf16(float16 x) {
 
   // Generated by Sollya using the following command:
   // > round(pi/2, SG, RN);
diff --git a/libc/src/__support/math/acosh_float_constants.h b/libc/src/__support/math/acosh_float_constants.h
index 2eb245d8265e0..f27e126099c7c 100644
--- a/libc/src/__support/math/acosh_float_constants.h
+++ b/libc/src/__support/math/acosh_float_constants.h
@@ -9,6 +9,7 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_MATH_ACOSH_FLOAT_CONSTANTS_H
 #define LLVM_LIBC_SRC___SUPPORT_MATH_ACOSH_FLOAT_CONSTANTS_H
 
+#include "src/__support/macros/attributes.h"
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
@@ -16,7 +17,7 @@ namespace LIBC_NAMESPACE_DECL {
 namespace acoshf_internal {
 
 // Lookup table for (1/f) where f = 1 + n*2^(-7), n = 0..127.
-static constexpr double ONE_OVER_F[128] = {
+LIBC_INLINE_VAR constexpr double ONE_OVER_F[128] = {
     0x1.0000000000000p+0, 0x1.fc07f01fc07f0p-1, 0x1.f81f81f81f820p-1,
     0x1.f44659e4a4271p-1, 0x1.f07c1f07c1f08p-1, 0x1.ecc07b301ecc0p-1,
     0x1.e9131abf0b767p-1, 0x1.e573ac901e574p-1, 0x1.e1e1e1e1e1e1ep-1,
@@ -62,7 +63,7 @@ static constexpr double ONE_OVER_F[128] = {
     0x1.0204081020408p-1, 0x1.0101010101010p-1};
 
 // Lookup table for log(f) = log(1 + n*2^(-7)) where n = 0..127.
-static constexpr double LOG_F[128] = {
+LIBC_INLINE_VAR constexpr double LOG_F[128] = {
     0x0.0000000000000p+0, 0x1.fe02a6b106788p-8, 0x1.fc0a8b0fc03e3p-7,
     0x1.7b91b07d5b11ap-6, 0x1.f829b0e783300p-6, 0x1.39e87b9febd5fp-5,
     0x1.77458f632dcfcp-5, 0x1.b42dd711971bep-5, 0x1.f0a30c01162a6p-5,
diff --git a/libc/src/__support/math/acoshf.h b/libc/src/__support/math/acoshf.h
index 4e003110efafb..acc6fde1378de 100644
--- a/libc/src/__support/math/acoshf.h
+++ b/libc/src/__support/math/acoshf.h
@@ -21,7 +21,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float acoshf(float x) {
+LIBC_INLINE constexpr float acoshf(float x) {
   using namespace acoshf_internal;
   using FPBits_t = typename fputil::FPBits<float>;
   FPBits_t xbits(x);
diff --git a/libc/src/__support/math/acoshf16.h b/libc/src/__support/math/acoshf16.h
index e5be2a8dd915c..eeb9e9f7afa9d 100644
--- a/libc/src/__support/math/acoshf16.h
+++ b/libc/src/__support/math/acoshf16.h
@@ -28,7 +28,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float16 acoshf16(float16 x) {
+LIBC_INLINE constexpr float16 acoshf16(float16 x) {
 
   using namespace acoshf_internal;
   constexpr size_t N_EXCEPTS = 2;
diff --git a/libc/src/__support/math/acoshf_utils.h b/libc/src/__support/math/acoshf_utils.h
index 808c3dd41cfe4..a0002f404a19f 100644
--- a/libc/src/__support/math/acoshf_utils.h
+++ b/libc/src/__support/math/acoshf_utils.h
@@ -19,7 +19,7 @@ namespace LIBC_NAMESPACE_DECL {
 namespace acoshf_internal {
 
 // x should be positive, normal finite value
-LIBC_INLINE static double log_eval(double x) {
+LIBC_INLINE double log_eval(double x) {
   // For x = 2^ex * (1 + mx)
   //   log(x) = ex * log(2) + log(1 + mx)
   using FPB = fputil::FPBits<double>;
diff --git a/libc/src/__support/math/acospif16.h b/libc/src/__support/math/acospif16.h
index cf29c7654abc2..4b5c28084f709 100644
--- a/libc/src/__support/math/acospif16.h
+++ b/libc/src/__support/math/acospif16.h
@@ -25,7 +25,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float16 acospif16(float16 x) {
+LIBC_INLINE constexpr float16 acospif16(float16 x) {
   using FPBits = fputil::FPBits<float16>;
   FPBits xbits(x);
 
diff --git a/libc/src/__support/math/asin.h b/libc/src/__support/math/asin.h
index 396a5355b9b3b..98e77d0b97454 100644
--- a/libc/src/__support/math/asin.h
+++ b/libc/src/__support/math/asin.h
@@ -25,7 +25,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static double asin(double x) {
+LIBC_INLINE double asin(double x) {
   using namespace asin_internal;
   using FPBits = fputil::FPBits<double>;
 
diff --git a/libc/src/__support/math/asin_utils.h b/libc/src/__support/math/asin_utils.h
index efe779c8a81fd..2feb1485ec667 100644
--- a/libc/src/__support/math/asin_utils.h
+++ b/libc/src/__support/math/asin_utils.h
@@ -24,10 +24,11 @@ namespace asin_internal {
 using DoubleDouble = fputil::DoubleDouble;
 using Float128 = fputil::DyadicFloat<128>;
 
-static constexpr DoubleDouble PI = {0x1.1a62633145c07p-53, 0x1.921fb54442d18p1};
+LIBC_INLINE_VAR constexpr DoubleDouble PI = {0x1.1a62633145c07p-53,
+                                             0x1.921fb54442d18p1};
 
-static constexpr DoubleDouble PI_OVER_TWO = {0x1.1a62633145c07p-54,
-                                             0x1.921fb54442d18p0};
+LIBC_INLINE_VAR constexpr DoubleDouble PI_OVER_TWO = {0x1.1a62633145c07p-54,
+                                                      0x1.921fb54442d18p0};
 
 #ifdef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
 
@@ -38,7 +39,7 @@ static constexpr DoubleDouble PI_OVER_TWO = {0x1.1a62633145c07p-54,
 // > dirtyinfnorm(asin(x)/x - P, [0, 0.5]);
 // 0x1.1a71ef0a0f26a9fb7ed7e41dee788b13d1770db3dp-52
 
-static constexpr double ASIN_COEFFS[12] = {
+LIBC_INLINE_VAR constexpr double ASIN_COEFFS[12] = {
     0x1.0000000000000p0,  0x1.5555555556dcfp-3,  0x1.3333333082e11p-4,
     0x1.6db6dd14099edp-5, 0x1.f1c69b35bf81fp-6,  0x1.6e97194225a67p-6,
     0x1.1babddb82ce12p-6, 0x1.d55bd078600d6p-7,  0x1.33328959e63d6p-7,
@@ -123,7 +124,7 @@ LIBC_INLINE double asin_eval(double u) {
 // > dirtyinfnorm(asin(x)/x - P, [-1/64, 1/64]);
 // 0x1.999075402cafp-83
 
-static constexpr double ASIN_COEFFS[9][12] = {
+LIBC_INLINE_VAR constexpr double ASIN_COEFFS[9][12] = {
     {1.0, 0.0, 0x1.5555555555555p-3, 0x1.5555555555555p-57,
      0x1.3333333333333p-4, 0x1.6db6db6db6db7p-5, 0x1.f1c71c71c71c7p-6,
      0x1.6e8ba2e8ba2e9p-6, 0x1.1c4ec4ec4ec4fp-6, 0x1.c99999999999ap-7,
@@ -163,8 +164,8 @@ static constexpr double ASIN_COEFFS[9][12] = {
 };
 
 // We calculate the lower part of the approximation P(u).
-LIBC_INLINE static DoubleDouble asin_eval(const DoubleDouble &u, unsigned &idx,
-                                          double &err) {
+LIBC_INLINE DoubleDouble asin_eval(const DoubleDouble &u, unsigned &idx,
+                                   double &err) {
   using fputil::multiply_add;
   // k = round(u * 32).
   double k = fputil::nearest_integer(u.hi * 0x1.0p5);
@@ -238,7 +239,7 @@ LIBC_INLINE static DoubleDouble asin_eval(const DoubleDouble &u, unsigned &idx,
 //               + (676039 x^24)/104857600 + (1300075 x^26)/226492416 +
 //               + (5014575 x^28)/973078528 + (9694845 x^30)/2080374784.
 
-static constexpr Float128 ASIN_COEFFS_F128[17][16] = {
+LIBC_INLINE_VAR constexpr Float128 ASIN_COEFFS_F128[17][16] = {
     {
         {Sign::POS, -127, 0x80000000'00000000'00000000'00000000_u128},
         {Sign::POS, -130, 0xaaaaaaaa'aaaaaaaa'aaaaaaaa'aaaaaaab_u128},
@@ -547,14 +548,13 @@ static constexpr Float128 ASIN_COEFFS_F128[17][16] = {
     },
 };
 
-static constexpr Float128 PI_OVER_TWO_F128 = {
+LIBC_INLINE_VAR constexpr Float128 PI_OVER_TWO_F128 = {
     Sign::POS, -127, 0xc90fdaa2'2168c234'c4c6628b'80dc1cd1_u128};
 
-static constexpr Float128 PI_F128 = {
+LIBC_INLINE_VAR constexpr Float128 PI_F128 = {
     Sign::POS, -126, 0xc90fdaa2'2168c234'c4c6628b'80dc1cd1_u128};
 
-LIBC_INLINE static constexpr Float128 asin_eval(const Float128 &u,
-                                                unsigned idx) {
+LIBC_INLINE constexpr Float128 asin_eval(const Float128 &u, unsigned idx) {
   return fputil::polyeval(u, ASIN_COEFFS_F128[idx][0], ASIN_COEFFS_F128[idx][1],
                           ASIN_COEFFS_F128[idx][2], ASIN_COEFFS_F128[idx][3],
                           ASIN_COEFFS_F128[idx][4], ASIN_COEFFS_F128[idx][5],
diff --git a/libc/src/__support/math/asinf.h b/libc/src/__support/math/asinf.h
index bfa0dc31ecf4c..c00b764a41853 100644
--- a/libc/src/__support/math/asinf.h
+++ b/libc/src/__support/math/asinf.h
@@ -23,7 +23,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float asinf(float x) {
+LIBC_INLINE constexpr float asinf(float x) {
   using namespace inv_trigf_utils_internal;
 
 #ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
diff --git a/libc/src/__support/math/asinf16.h b/libc/src/__support/math/asinf16.h
index 3d032a41a2bb3..e9c9c6fca9184 100644
--- a/libc/src/__support/math/asinf16.h
+++ b/libc/src/__support/math/asinf16.h
@@ -25,7 +25,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float16 asinf16(float16 x) {
+LIBC_INLINE constexpr float16 asinf16(float16 x) {
 
   // Generated by Sollya using the following command:
   // > round(pi/2, D, RN);
diff --git a/libc/src/__support/math/asinhf.h b/libc/src/__support/math/asinhf.h
index 1c08a6e6651b7..b08d30b97b9f1 100644
--- a/libc/src/__support/math/asinhf.h
+++ b/libc/src/__support/math/asinhf.h
@@ -21,7 +21,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float asinhf(float x) {
+LIBC_INLINE constexpr float asinhf(float x) {
   using namespace acoshf_internal;
   using FPBits_t = typename fputil::FPBits<float>;
   FPBits_t xbits(x);
diff --git a/libc/src/__support/math/asinhf16.h b/libc/src/__support/math/asinhf16.h
index 3c5171e59c11f..39118d9357043 100644
--- a/libc/src/__support/math/asinhf16.h
+++ b/libc/src/__support/math/asinhf16.h
@@ -29,7 +29,7 @@ namespace LIBC_NAMESPACE_DECL {
 
 namespace math {
 
-LIBC_INLINE static constexpr float16 asinhf16(float16 x) {
+LIBC_INLINE constexpr float16 asinhf16(float16 x) {
 
 #ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
   constexpr size_t N_EXCEPTS = 8;
diff --git a/libc/src/__support/math/atan.h b/libc/src/__support/math/atan.h
index 62190b092429a..db60311bd746d 100644
--- a/libc/src/__support/math/atan.h
+++ b/libc/src/__support/math/atan.h
@@ -52,7 +52,7 @@ namespace math {
 //      So we can return:
 //        atan(x) = sign(x) * (pi/2 - epsilon)
 
-LIBC_INLINE static constexpr double atan(double x) {
+LIBC_INLINE constexpr double atan(double x) {
 
   using namespace atan_internal;
   using FPBits = fputil::FPBits<double>;
diff --git a/libc/src/__support/math/atan2f.h b/libc/src/__support/math/atan2f.h
index 0133d12c1e071..15d1fce2b707c 100644
--- a/libc/src/__support/math/atan2f.h
+++ b/libc/src/__support/math/atan2f.h
@@ -17,7 +17,7 @@
 #include "src/__support/FPUtil/multiply_add.h"
 #include "src/__support/FPUtil/nearest_integer.h"
 #include "src/__support/macros/config.h"
-#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+#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) &&                               \
@@ -45,7 +45,7 @@ namespace atan2f_internal {
 //     b = round(atan(i/16) - a, D, RN);
 //     print("{", b, ",", a, "},");
 //   };
-static constexpr fputil::DoubleDouble ATAN_I[17] = {
+LIBC_INLINE_VAR constexpr fputil::DoubleDouble ATAN_I[17] = {
     {0.0, 0.0},
     {-0x1.c934d86d23f1dp-60, 0x1.ff55bb72cfdeap-5},
     {-0x1.cd37686760c17p-59, 0x1.fd5ba9aac2f6ep-4},
@@ -72,7 +72,7 @@ static constexpr fputil::DoubleDouble ATAN_I[17] = {
 //     b = round(j - a, D, RN);
 //     print("{", b, ",", a, "},");
 //   };
-static constexpr fputil::DoubleDouble COEFFS[9] = {
+LIBC_INLINE_VAR constexpr fputil::DoubleDouble COEFFS[9] = {
     {0.0, 1.0},                                      // 1
     {-0x1.5555555555555p-56, -0x1.5555555555555p-2}, // -1/3
     {-0x1.999999999999ap-57, 0x1.999999999999ap-3},  // 1/5
@@ -98,8 +98,7 @@ static constexpr fputil::DoubleDouble COEFFS[9] = {
 //                     = 33.
 // Thus, the Veltkamp splitting constant is C = 2^33 + 1.
 // This is used when FMA instruction is not available.
-[[maybe_unused]] LIBC_INLINE static constexpr fputil::DoubleDouble
-split_d(double a) {
+[[maybe_unused]] LIBC_INLINE constexpr fputil::DoubleDouble split_d(double a) {
   fputil::DoubleDouble r{0.0, 0.0};
   constexpr double C = 0x1.0p33 + 1.0;
   double t1 = C * a;
@@ -116,10 +115,9 @@ split_d(double a) {
 //   idx, k_d   = round( 2^4 * num_d / den_d )
 //   final_sign = sign of the final result
 //   const_term = the constant term in the final expression.
-LIBC_INLINE static float
-atan2f_double_double(double num_d, double den_d, double q_d, int idx,
-                     double k_d, double final_sign,
-                     const fputil::DoubleDouble &const_term) {
+LIBC_INLINE float atan2f_double_double(double num_d, double den_d, double q_d,
+                                       int idx, double k_d, double final_sign,
+                                       const fputil::DoubleDouble &const_term) {
   fputil::DoubleDouble q;
   double num_r = 0, den_r = 0;
 
@@ -241,7 +239,7 @@ atan2f_double_double(double num_d, double den_d, double q_d, int idx,
 // 0x1.aec6f...p-100
 // which is about rounding errors of double-double (2^-104).
 
-LIBC_INLINE static constexpr float atan2f(float y, float x) {
+LIBC_INLINE constexpr float atan2f(float y, float x) {
   using namespace atan2f_internal;
   using namespace inv_trigf_utils_internal;
   using FPBits = typename fputil::FPBits<float>;
diff --git a/libc/src/__support/math/atan2f128.h b/libc/src/__support/math/atan2f128.h
index 89efaf1fd72a0..b2891bdec4c76 100644
--- a/libc/src/__support/math/atan2f128.h
+++ b/libc/src/__support/math/atan2f128.h
@@ -81,7 +81,7 @@ namespace math {
 // and relative errors bounded by:
 //   |(atan(u) - P(u)) / P(u)| < 2^-114.
 
-LIBC_INLINE static constexpr float128 atan2f128(float128 y, float128 x) {
+LIBC_INLINE constexpr float128 atan2f128(float128 y, float128 x) {
   using Float128 = fputil::DyadicFloat<128>;
 
   constexpr Float128 ZERO = {Sign::POS, 0, 0_u128};
diff --git a/libc/src/__support/math/atan2f_float.h b/libc/src/__support/math/atan2f_float.h
index cc5ea77d5dd36..1f44b67749964 100644
--- a/libc/src/__support/math/atan2f_float.h
+++ b/libc/src/__support/math/atan2f_float.h
@@ -30,7 +30,7 @@ using FloatFloat = fputil::FloatFloat;
 //     b = round(atan(i/16) - a, SG, RN);
 //     print("{", b, ",", a, "},");
 //   };
-static constexpr FloatFloat ATAN_I[17] = {
+LIBC_INLINE_VAR constexpr FloatFloat ATAN_I[17] = {
     {0.0f, 0.0f},
     {-0x1.1a6042p-30f, 0x1.ff55bcp-5f},
     {-0x1.54f424p-30f, 0x1.fd5baap-4f},
@@ -60,7 +60,7 @@ static constexpr FloatFloat ATAN_I[17] = {
 // For x = x_hi + x_lo, fully expand the polynomial and drop any terms less than
 //   ulp(x_hi^3 / 3) gives us:
 // P(x) ~ x_hi - x_hi^3/3 + x_lo * (1 - x_hi^2)
-LIBC_INLINE static constexpr FloatFloat atan_eval(const FloatFloat &x) {
+LIBC_INLINE constexpr FloatFloat atan_eval(const FloatFloat &x) {
   FloatFloat p;
   p.hi = x.hi;
   float x_hi_sq = x.hi * x.hi;
@@ -124,7 +124,7 @@ LIBC_INLINE static constexpr FloatFloat atan_eval(const FloatFloat &x) {
 // > dirtyinfnorm(atan(x) - P, [-2^-5, 2^-5]);
 // 0x1.995...p-28.
 
-LIBC_INLINE static constexpr float atan2f(float y, float x) {
+LIBC_INLINE constexpr float atan2f(float y, float x) {
   using namespace atan2f_internal;
   using FPBits = typename fputil::FPBits<float>;
   constexpr float IS_NEG[2] = {1.0f, -1.0f};
diff --git a/libc/src/__support/math/atan_utils.h b/libc/src/__support/math/atan_utils.h
index 9e8d7d6569c8f..e752af3568373 100644
--- a/libc/src/__support/math/atan_utils.h
+++ b/libc/src/__support/math/atan_utils.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_LIBC_SRC_MATH_GENERIC_ATAN_UTILS_H
-#define LLVM_LIBC_SRC_MATH_GENERIC_ATAN_UTILS_H
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_ATAN_UTILS_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_ATAN_UTILS_H
 
 #include "src/__support/FPUtil/PolyEval.h"
 #include "src/__support/FPUtil/double_double.h"
@@ -29,7 +29,7 @@ using Float128 = fputil::DyadicFloat<128>;
 //     b = round(atan(i/64) - a, D, RN);
 //     print("{", b, ",", a, "},");
 //   };
-static constexpr DoubleDouble ATAN_I[65] = {
+LIBC_INLINE_VAR constexpr DoubleDouble ATAN_I[65] = {
     {0.0, 0.0},
     {-0x1.220c39d4dff5p-61, 0x1.fff555bbb729bp-7},
     {-0x1.5ec431444912cp-60, 0x1.ffd55bba97625p-6},
@@ -110,8 +110,7 @@ static constexpr DoubleDouble ATAN_I[65] = {
 //        + x_lo * (1 - x_hi^2 + x_hi^4)
 // Since p.lo is ~ x^3/3, the relative error from rounding is bounded by:
 //   |(atan(x) - P(x))/atan(x)| < ulp(x^2) <= 2^(-14-52) = 2^-66.
-[[maybe_unused]] LIBC_INLINE static DoubleDouble
-atan_eval(const DoubleDouble &x) {
+[[maybe_unused]] LIBC_INLINE DoubleDouble atan_eval(const DoubleDouble &x) {
   DoubleDouble p;
   p.hi = x.hi;
   double x_hi_sq = x.hi * x.hi;
@@ -143,7 +142,7 @@ atan_eval(const DoubleDouble &x) {
 //     b = 2^ll + a;
 //     print("{Sign::POS, ", 2^(ll - 128), ",", b, "},");
 // };
-static constexpr Float128 ATAN_I_F128[65] = {
+LIBC_INLINE_VAR constexpr Float128 ATAN_I_F128[65] = {
     {Sign::POS, 0, 0_u128},
     {Sign::POS, -134, 0xfffaaadd'db94d5bb'e78c5640'15f76048_u128},
     {Sign::POS, -133, 0xffeaaddd'4bb12542'779d776d'da8c6214_u128},
@@ -216,7 +215,7 @@ static constexpr Float128 ATAN_I_F128[65] = {
 //                 [0, 2^-7]);
 // > dirtyinfnorm(atan(x) - P, [0, 2^-7]);
 // 0x1.26016ad97f323875760f869684c0898d7b7bb8bep-122
-static constexpr Float128 ATAN_POLY_F128[] = {
+LIBC_INLINE_VAR constexpr Float128 ATAN_POLY_F128[] = {
     {Sign::NEG, -129, 0xaaaaaaaa'aaaaaaaa'aaaaaaa6'003c5d1d_u128},
     {Sign::POS, -130, 0xcccccccc'cccccccc'cca00232'8776b063_u128},
     {Sign::NEG, -130, 0x92492492'49249201'27f5268a'cb24aec0_u128},
@@ -226,8 +225,7 @@ static constexpr Float128 ATAN_POLY_F128[] = {
 };
 
 // Approximate atan for |x| <= 2^-7.
-[[maybe_unused]] LIBC_INLINE static constexpr Float128
-atan_eval(const Float128 &x) {
+[[m...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/179707


More information about the libc-commits mailing list