Repository navigation
Conversation
Building the math test suite with GCC surfaces conversion, narrowing, uninitialised-variable, and non-exhaustive return warnings, along with -Wattributes visibility warnings under -fvisibility-inlines-hidden when passing LIBC_ALWAYS_INLINE static_rounding functions as template arguments. Initialise tracking locals across range and shared tests, suffix float and float16 test literals with exact f and f16 hexadecimal forms, cast FModTest inputs with fputil::cast<T>, and wrap static_rounding helpers in static functions for exhaustive expf and exp2f tests. Guard the 64-bit long exponent checks in LdExpTest with if constexpr and mark the MPCUtils RoundingMode switch unreachable after covering all enumerators. Co-authored-by: Tue Ly <lntue.h@gmail.com> Assisted-by: Automated tooling, human reviewed.
|
@llvm/pr-subscribers-libc Author: Jeff Bailey (kaladron) ChangesBuilding the math test suite with GCC surfaces conversion, narrowing, uninitialised-variable, and non-exhaustive return warnings, along with -Wattributes visibility warnings under -fvisibility-inlines-hidden when passing LIBC_ALWAYS_INLINE static_rounding functions as template arguments. Initialise tracking locals across range and shared tests, suffix float and float16 test literals with exact f and f16 hexadecimal forms, cast FModTest inputs with fputil::cast<T>, and wrap static_rounding helpers in static functions for exhaustive expf and exp2f tests. Guard the 64-bit long exponent checks in LdExpTest with if constexpr and mark the MPCUtils RoundingMode switch unreachable after covering all enumerators. Assisted-by: Automated tooling, human reviewed. Patch is 112.73 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/241530.diff 29 Files Affected:
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 97e975a238922d..2d94ffd2814116 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -27,7 +27,7 @@ using LIBC_NAMESPACE::fputil::Float80;
TEST(LlvmLibcSharedMathTest, AllFloat16) {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<float16>;
- int exponent;
+ int exponent = 0;
EXPECT_FP_EQ(0.0f16, LIBC_NAMESPACE::shared::acoshf16(1.0f16));
EXPECT_FP_EQ(0.0f16, LIBC_NAMESPACE::shared::acospif16(1.0f16));
EXPECT_FP_EQ(1.0f16, LIBC_NAMESPACE::shared::rsqrtf16(1.0f16));
@@ -176,7 +176,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
TEST(LlvmLibcSharedMathTest, AllFloat) {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>;
- int exponent;
+ int exponent = 0;
EXPECT_FP_EQ(0x1.921fb6p+0, LIBC_NAMESPACE::shared::acosf(0.0f));
EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::shared::acoshf(1.0f));
@@ -593,7 +593,7 @@ TEST(LlvmLibcSharedMathTest, AllLongDouble) {
// Emulated float128 tests
TEST(LlvmLibcSharedMathTest, AllEmuFloat128) {
- int exponent;
+ int exponent = 0;
using FPBits = LIBC_NAMESPACE::fputil::FPBits<Float128>;
EXPECT_FP_EQ(Float128(0.0),
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index c5249acb0c9d2f..75c11aadebec59 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -2649,6 +2649,7 @@ add_fp_unittest(
libc.hdr.errno_macros
libc.src.math.fmodf
libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.cast
libc.src.__support.FPUtil.nearest_integer_operations
)
@@ -2664,6 +2665,7 @@ add_fp_unittest(
libc.hdr.errno_macros
libc.src.math.fmod
libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.cast
libc.src.__support.FPUtil.nearest_integer_operations
)
diff --git a/libc/test/src/math/FModTest.h b/libc/test/src/math/FModTest.h
index 63320f7d3c9bfb..794a6f498cd0e2 100644
--- a/libc/test/src/math/FModTest.h
+++ b/libc/test/src/math/FModTest.h
@@ -18,6 +18,7 @@
#include "hdr/math_macros.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
+#include "src/__support/FPUtil/cast.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@@ -41,7 +42,10 @@
EXPECT_FP_EXCEPTION(expected_exception); \
} while (0)
-#define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)
+#define TEST_REGULAR(x, y, expected) \
+ TEST_SPECIAL(LIBC_NAMESPACE::fputil::cast<T>(x), \
+ LIBC_NAMESPACE::fputil::cast<T>(y), \
+ LIBC_NAMESPACE::fputil::cast<T>(expected), false, 0)
template <typename T>
class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
@@ -228,7 +232,6 @@ class FmodTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
}
void testRegularExtreme(FModFunc f) {
-
TEST_REGULAR(0x1p127L, -0x3p-149L, 0x1p-149L);
TEST_REGULAR(0x1p127L, 0x3p-148L, 0x1p-147L);
TEST_REGULAR(0x1p127L, -0x3p-148L, 0x1p-147L);
diff --git a/libc/test/src/math/HypotTest.h b/libc/test/src/math/HypotTest.h
index 146f85d0b36019..93fa602067af9d 100644
--- a/libc/test/src/math/HypotTest.h
+++ b/libc/test/src/math/HypotTest.h
@@ -74,7 +74,8 @@ class HypotTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
constexpr unsigned SCALE = (sizeof(T) < 4) ? 1 : 4;
for (unsigned scale = 0; scale < SCALE; ++scale) {
StorageType max_value = static_cast<StorageType>(MAX_SUBNORMAL << scale);
- StorageType step = (max_value - MIN_SUBNORMAL) / COUNT + 1;
+ StorageType step =
+ static_cast<StorageType>((max_value - MIN_SUBNORMAL) / COUNT + 1);
for (int signs = 0; signs < 4; ++signs) {
for (StorageType v = MIN_SUBNORMAL, w = max_value;
v <= max_value && w >= MIN_SUBNORMAL; v += step, w -= step) {
diff --git a/libc/test/src/math/atan2f16_test.cpp b/libc/test/src/math/atan2f16_test.cpp
index b4214e932f5917..4b26f1b3b2498f 100644
--- a/libc/test/src/math/atan2f16_test.cpp
+++ b/libc/test/src/math/atan2f16_test.cpp
@@ -26,31 +26,34 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
TEST_F(LlvmLibcAtan2f16Test, TrickyInputs) {
constexpr int N = 17;
- mpfr::BinaryInput<float16> INPUTS[N] = {
- {0x1.0p0f, 0x1.4p0f}, {0x1.2p0f, 0x1.0p0f}, {-0x1.0p0f, 0x1.2p0f},
- {0x1.8p0f, 0x1.0p0f}, {0x1.2p-2f, 0x1.0p-2f}, {0x1.0p0f, 0x1.0p0f},
- {0x1.0p-1f, 0x1.0p0f}, {0x1.0p0f, 0x1.0p-1f}, {0x1.8p1f, 0x1.0p0f},
- {0x1.0p0f, 0x1.4p1f}, {0x1.2p1f, 0x1.0p-1f}, {0x1.0p-2f, 0x1.0p0f},
- {0x1.0p0f, 0x1.0p-3f}, {0x1.4p0f, 0x1.0p0f}, {0x1.0p0f, 0x1.8p0f},
- {0x1.0p-1f, 0x1.0p-1f}, {0x1.2p0f, 0x1.2p0f},
+ mpfr::BinaryInput<float16> inputs[N] = {
+ {0x1.0p0f16, 0x1.4p0f16}, {0x1.2p0f16, 0x1.0p0f16},
+ {-0x1.0p0f16, 0x1.2p0f16}, {0x1.8p0f16, 0x1.0p0f16},
+ {0x1.2p-2f16, 0x1.0p-2f16}, {0x1.0p0f16, 0x1.0p0f16},
+ {0x1.0p-1f16, 0x1.0p0f16}, {0x1.0p0f16, 0x1.0p-1f16},
+ {0x1.8p1f16, 0x1.0p0f16}, {0x1.0p0f16, 0x1.4p1f16},
+ {0x1.2p1f16, 0x1.0p-1f16}, {0x1.0p-2f16, 0x1.0p0f16},
+ {0x1.0p0f16, 0x1.0p-3f16}, {0x1.4p0f16, 0x1.0p0f16},
+ {0x1.0p0f16, 0x1.8p0f16}, {0x1.0p-1f16, 0x1.0p-1f16},
+ {0x1.2p0f16, 0x1.2p0f16},
};
for (int i = 0; i < N; ++i) {
- float16 x = INPUTS[i].x;
- float16 y = INPUTS[i].y;
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan2, INPUTS[i],
+ float16 x = inputs[i].x;
+ float16 y = inputs[i].y;
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan2, inputs[i],
LIBC_NAMESPACE::atan2f16(x, y),
TOLERANCE + 0.5);
- INPUTS[i].x = -INPUTS[i].x;
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan2, INPUTS[i],
+ inputs[i].x = -inputs[i].x;
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan2, inputs[i],
LIBC_NAMESPACE::atan2f16(-x, y),
TOLERANCE + 0.5);
- INPUTS[i].y = -INPUTS[i].y;
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan2, INPUTS[i],
+ inputs[i].y = -inputs[i].y;
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan2, inputs[i],
LIBC_NAMESPACE::atan2f16(-x, -y),
TOLERANCE + 0.5);
- INPUTS[i].x = -INPUTS[i].x;
- ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan2, INPUTS[i],
+ inputs[i].x = -inputs[i].x;
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan2, inputs[i],
LIBC_NAMESPACE::atan2f16(x, -y),
TOLERANCE + 0.5);
}
@@ -75,7 +78,7 @@ TEST_F(LlvmLibcAtan2f16Test, InFloat16Range) {
uint64_t fails = 0;
uint64_t finite_count = 0;
uint64_t total_count = 0;
- float16 failed_x = 0.0f, failed_y = 0.0f, failed_r = 0.0f;
+ float16 failed_x = zero, failed_y = zero, failed_r = zero;
double tol = 0.5;
for (uint32_t i = 0; i <= X_COUNT; ++i) {
diff --git a/libc/test/src/math/atan2f_test.cpp b/libc/test/src/math/atan2f_test.cpp
index 56b6967069523a..24a367afcd24bf 100644
--- a/libc/test/src/math/atan2f_test.cpp
+++ b/libc/test/src/math/atan2f_test.cpp
@@ -79,7 +79,7 @@ TEST_F(LlvmLibcAtan2fTest, InFloatRange) {
uint64_t fails = 0;
uint64_t finite_count = 0;
uint64_t total_count = 0;
- float failed_x, failed_y, failed_r = 0.0;
+ float failed_x = 0.0f, failed_y = 0.0f, failed_r = 0.0f;
double tol = 0.5;
for (uint32_t i = 0, v = X_START; i <= X_COUNT; ++i, v += X_STEP) {
diff --git a/libc/test/src/math/atan_test.cpp b/libc/test/src/math/atan_test.cpp
index ff50c4c3ad052e..5d2e45c938627b 100644
--- a/libc/test/src/math/atan_test.cpp
+++ b/libc/test/src/math/atan_test.cpp
@@ -32,7 +32,7 @@ TEST_F(LlvmLibcAtanTest, InDoubleRange) {
uint64_t fails = 0;
uint64_t count = 0;
uint64_t cc = 0;
- double mx, mr = 0.0;
+ double mx = 0.0, mr = 0.0;
double tol = 0.5;
for (uint64_t i = 0, v = START; i <= COUNT; ++i, v += STEP) {
diff --git a/libc/test/src/math/cbrt_test.cpp b/libc/test/src/math/cbrt_test.cpp
index da3db424d2423e..ae491b7e47dd6b 100644
--- a/libc/test/src/math/cbrt_test.cpp
+++ b/libc/test/src/math/cbrt_test.cpp
@@ -40,7 +40,7 @@ TEST_F(LlvmLibcCbrtTest, InDoubleRange) {
uint64_t fails = 0;
uint64_t tested = 0;
uint64_t total = 0;
- double worst_input, worst_output = 0.0;
+ double worst_input = 0.0, worst_output = 0.0;
double ulp = 0.5;
for (uint64_t i = 0, v = START; i <= COUNT; ++i, v += STEP) {
diff --git a/libc/test/src/math/cos_test.cpp b/libc/test/src/math/cos_test.cpp
index cb402f74ecac04..cedebe58762e3c 100644
--- a/libc/test/src/math/cos_test.cpp
+++ b/libc/test/src/math/cos_test.cpp
@@ -82,7 +82,7 @@ TEST_F(LlvmLibcCosTest, InDoubleRange) {
uint64_t fails = 0;
uint64_t tested = 0;
uint64_t total = 0;
- double worst_input, worst_output = 0.0;
+ double worst_input = 0.0, worst_output = 0.0;
double ulp = 0.5;
for (uint64_t i = 0, v = START; i <= COUNT; ++i, v += STEP) {
diff --git a/libc/test/src/math/erff_test.cpp b/libc/test/src/math/erff_test.cpp
index 505b0e011c2be5..c2907719330891 100644
--- a/libc/test/src/math/erff_test.cpp
+++ b/libc/test/src/math/erff_test.cpp
@@ -64,7 +64,7 @@ TEST_F(LlvmLibcErffTest, InFloatRange) {
uint32_t fails = 0;
uint32_t count = 0;
uint32_t cc = 0;
- float mx, mr = 0.0;
+ float mx = 0.0f, mr = 0.0f;
double tol = 0.5;
for (uint32_t i = 0, v = START; i <= COUNT; ++i, v += STEP) {
diff --git a/libc/test/src/math/exhaustive/exp2f_test.cpp b/libc/test/src/math/exhaustive/exp2f_test.cpp
index 79559d5bc2a52e..042ff5b076013e 100644
--- a/libc/test/src/math/exhaustive/exp2f_test.cpp
+++ b/libc/test/src/math/exhaustive/exp2f_test.cpp
@@ -56,10 +56,13 @@ TEST_F(LlvmLibcExp2fFloatExhaustiveTest, NegativeRange) {
// Statically rounded implementation: tested against double_eval across all
// roundings.
+static float exp2f_static_rounding(float x, int rounding) {
+ return LIBC_NAMESPACE::math::static_rounding::exp2f(x, rounding);
+}
+
using LlvmLibcExp2fStaticRoundingExhaustiveTest =
LlvmLibcStaticallyRoundedUnaryOpExhaustiveMathTest<
- float, LIBC_NAMESPACE::math::double_eval::exp2f,
- LIBC_NAMESPACE::math::static_rounding::exp2f>;
+ float, LIBC_NAMESPACE::math::double_eval::exp2f, exp2f_static_rounding>;
TEST_F(LlvmLibcExp2fStaticRoundingExhaustiveTest, PositiveRange) {
test_full_range_all_roundings(POS_START, POS_STOP);
diff --git a/libc/test/src/math/exhaustive/expf_test.cpp b/libc/test/src/math/exhaustive/expf_test.cpp
index 04bfaaf1b5a1e8..aa03447f46a658 100644
--- a/libc/test/src/math/exhaustive/expf_test.cpp
+++ b/libc/test/src/math/exhaustive/expf_test.cpp
@@ -78,10 +78,13 @@ TEST_F(LlvmLibcExpfFloatCrRnExhaustiveTest, NegativeRange) {
// Statically rounded implementation: tested against double_eval across all
// roundings.
+static float expf_static_rounding(float x, int rounding) {
+ return LIBC_NAMESPACE::math::static_rounding::expf(x, rounding);
+}
+
using LlvmLibcExpfStaticRoundingExhaustiveTest =
LlvmLibcStaticallyRoundedUnaryOpExhaustiveMathTest<
- float, LIBC_NAMESPACE::math::double_eval::expf,
- LIBC_NAMESPACE::math::static_rounding::expf>;
+ float, LIBC_NAMESPACE::math::double_eval::expf, expf_static_rounding>;
TEST_F(LlvmLibcExpfStaticRoundingExhaustiveTest, PositiveRange) {
test_full_range_all_roundings(POS_START, POS_STOP);
diff --git a/libc/test/src/math/expm1_test.cpp b/libc/test/src/math/expm1_test.cpp
index a8c3df471417e5..f04e5d7f12e379 100644
--- a/libc/test/src/math/expm1_test.cpp
+++ b/libc/test/src/math/expm1_test.cpp
@@ -62,7 +62,7 @@ TEST_F(LlvmLibcExpm1Test, InDoubleRange) {
uint64_t fails = 0;
uint64_t count = 0;
uint64_t cc = 0;
- double mx, mr = 0.0;
+ double mx = 0.0, mr = 0.0;
double tol = 0.5;
for (uint64_t i = 0, v = START; i <= COUNT; ++i, v += STEP) {
diff --git a/libc/test/src/math/hypotf_hard_to_round.h b/libc/test/src/math/hypotf_hard_to_round.h
index f85be91ca3ec4a..d54a0572761840 100644
--- a/libc/test/src/math/hypotf_hard_to_round.h
+++ b/libc/test/src/math/hypotf_hard_to_round.h
@@ -16,1224 +16,1224 @@ namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
constexpr int N_HARD_TO_ROUND = 1217;
constexpr mpfr::BinaryInput<float> HYPOTF_HARD_TO_ROUND[N_HARD_TO_ROUND] = {
{0x1.faf49ep+25f, 0x1.480002p+23f},
- {0x1.ffffecp-1f, 0x1.000002p+27},
- {0x1.900004p+34, 0x1.400002p+23}, /* 45 identical bits */
- {0x1.05555p+34, 0x1.bffffep+23}, /* 44 identical bits */
- {0x1.e5fffap+34, 0x1.affffep+23}, /* 45 identical bits */
- {0x1.260002p+34, 0x1.500002p+23}, /* 45 identical bits */
- {0x1.fffffap+34, 0x1.fffffep+23}, /* 45 identical bits */
- {0x1.8ffffap+34, 0x1.3ffffep+23}, /* 45 identical bits */
- {0x1.87fffcp+35, 0x1.bffffep+23}, /* 47 identical bits */
- {0x1.b8e50ap-52, -0x1.db1e78p-64},
- {0x1.03b54cp-33, 0x1.6ca6bep-45},
- {0x1.e2eff6p+97, -0x1.044cb2p+108},
- {-0x1.6b05c4p-127, 0x1.6b3146p-126},
- {-0x1.6b05c4p-127, 0x1.6b3146p-126},
- {0x1.26b188p-127, -0x1.a4f2fp-128},
- {0x1.e2eff6p+97, -0x1.044cb2p+108},
+ {0x1.ffffecp-1f, 0x1.000002p+27f},
+ {0x1.900004p+34f, 0x1.400002p+23f}, /* 45 identical bits */
+ {0x1.05555p+34f, 0x1.bffffep+23f}, /* 44 identical bits */
+ {0x1.e5fffap+34f, 0x1.affffep+23f}, /* 45 identical bits */
+ {0x1.260002p+34f, 0x1.500002p+23f}, /* 45 identical bits */
+ {0x1.fffffap+34f, 0x1.fffffep+23f}, /* 45 identical bits */
+ {0x1.8ffffap+34f, 0x1.3ffffep+23f}, /* 45 identical bits */
+ {0x1.87fffcp+35f, 0x1.bffffep+23f}, /* 47 identical bits */
+ {0x1.b8e50ap-52f, -0x1.db1e78p-64f},
+ {0x1.03b54cp-33f, 0x1.6ca6bep-45f},
+ {0x1.e2eff6p+97f, -0x1.044cb2p+108f},
+ {-0x1.6b05c4p-127f, 0x1.6b3146p-126f},
+ {-0x1.6b05c4p-127f, 0x1.6b3146p-126f},
+ {0x1.26b188p-127f, -0x1.a4f2fp-128f},
+ {0x1.e2eff6p+97f, -0x1.044cb2p+108f},
// only inexact hard-to-round case with ulp(x) = 2^12*ulp(y):
- {0x1.87fffcp+35, 0x1.bffffep+23},
+ {0x1.87fffcp+35f, 0x1.bffffep+23f},
// 1200 exact cases with ulp(x) = 2^12*ulp(y):
- {0x1.f0008p+35, 0x1.f7fp+23},
- {0x1.6401dp+35, 0x1.aafp+23},
- {0x1.c0029p+35, 0x1.defp+23},
- {0x1.100274p+35, 0x1.753p+23},
- {0x1.38030cp+35, 0x1.8fbp+23},
- {0x1.940334p+35, 0x1.c6dp+23},
- {0x1.cc041cp+35, 0x1.e55p+23},
- {0x1.0c03f8p+35, 0x1.727p+23},
- {0x1.e404a4p+35, 0x1.f1dp+23},
- {0x1.b004ecp+35, 0x1.d65p+23},
- {0x1.a804ep+35, 0x1.d1fp+23},
- {0x1.5804ccp+35, 0x1.a3bp+23},
- {0x1.98051p+35, 0x1.c91p+23},
- {0x1.480524p+35, 0x1.99dp+23},
- {0x1.900668p+35, 0x1.c49p+23},
- {0x1.28061cp+35, 0x1.855p+23},
- {0x1.7406d8p+35, 0x1.b47p+23},
- {0x1.dc07acp+35, 0x1.edbp+23},
- {0x1.2c078p+35, 0x1.87fp+23},
- {0x1.4407bcp+35, 0x1.975p+23},
- {0x1.4c08ccp+35, 0x1.9c5p+23},
- {0x1.14088p+35, 0x1.77fp+23},
- {0x1.0008ap+35, 0x1.6a1p+23},
- {0x1.bc0b14p+35, 0x1.dcdp+23},
- {0x1.9c0bfcp+35, 0x1.cb5p+23},
- {0x1.240b9cp+35, 0x1.82bp+23},
- {0x1.d00da8p+35, 0x1.e77p+23},
- {0x1.800e68p+35, 0x1.bb7p+23},
- {0x1.8c0eacp+35, 0x1.c25p+23},
- {0x1.080d0cp+35, 0x1.6fbp+23},
- {0x1.600ea8p+35, 0x1.a89p+23},
- {0x1.300fc8p+35, 0x1.8a9p+23},
- {0x1.ec12ap+35, 0x1.f5fp+23},
- {0x1.401094p+35, 0x1.94dp+23},
- {0x1.5012b4p+35, 0x1.9edp+23},
- {0x1.781634p+35, 0x1.b6dp+23},
- {0x1.b8181cp+35, 0x1.dabp+23},
- {0x1.a017f8p+35, 0x1.cd9p+23},
- {0x1.18161cp+35, 0x1.7abp+23},
- {0x1.d41bb8p+35, 0x1.e99p+23},
- {0x1.2018p+35, 0x1.801p+23},
- {0x1.881cp+35, 0x1.c01p+23},
- {0x1.ac1fc4p+35, 0x1.d43p+23},
- {0x1.fc21ep+35, 0x1.fe1p+23},
- {0x1.e02304p+35, 0x1.efdp+23},
- {0x1.341ef4p+35, 0x1.8d3p+23},
- {0x1.3c1facp+35, 0x1.925p+23},
- {0x1.041dbp+35, 0x1.6cfp+23},
- {0x1.5c2124p+35, 0x1.a63p+23},
- {0x1.f827cp+35, 0x1.fc1p+23},
- {0x1.5422dcp+35, 0x1.a15p+23},
- {0x1.e828cp+35, 0x1.f3fp+23},
- {0x1.b429a8p+35, 0x1.d89p+23},
- {0x1.a42904p+35, 0x1.cfdp+23},
- {0x1.d82e4cp+35, 0x1.ebbp+23},
- {0x1.7c2b34p+35, 0x1.b93p+23},
- {0x1.f431ap+35, 0x1.fa1p+23},
- {0x1.842e64p+35, 0x1.bddp+23},
- {0x1.6c2f04p+35, 0x1.afdp+23},
- {0x1.1c2b48p+35, 0x1.7d7p+23},
- {0x1.683048p+35, 0x1.ad7p+23},
- {0x1.703364p+35, 0x1.b23p+23},
- {0x1.10311cp+35, 0x1.755p+23},
- {0x1.c43ab4p+35, 0x1.e13p+23},
- {0x1.c83b7cp+35, 0x1.e35p+23},
- {0x1.383504p+35, 0x1.8fdp+23},
- {0x1.0c3248p+35, 0x1.729p+23},
- {0x1.64373p+35, 0x1.ab1p+23},
- {0x1.f03f8p+35, 0x1.f81p+23},
- {0x1.943c1p+35, 0x1.c6fp+23},
- {0x1.c03e7p+35, 0x1.df1p+23},
- {0x1.583944p+35, 0x1.a3dp+23},
- {0x1.48386p+35, 0x1.99fp+23},
- {0x1.2836c8p+35, 0x1.857p+23},
- {0x1.cc40c8p+35, 0x1.e57p+23},
- {0x1.a83f2p+35, 0x1.d21p+23},
- {0x1.b03fb8p+35, 0x1.d67p+23},
- {0x1.983e34p+35, 0x1.c93p+23},
- {0x1.2c388p+35, 0x1.881p+23},
- {0x1.e442ep+35, 0x1.f1fp+23},
- {0x1.0035e4p+35, 0x1.6a3p+23},
- {0x1.903efcp+35, 0x1.c4bp+23},
- {0x1.743d68p+35, 0x1.b49p+23},
- {0x1.443aa8p+35, 0x1.977p+23},
- {0x1.14378p+35, 0x1.781p+23},
- {0x1.4c3c58p+35, 0x1.9c7p+23},
- {0x1.dc4564p+35, 0x1.eddp+23},
- {0x1.243bf4p+35, 0x1.82dp+23},
- {0x1.bc46bp+35, 0x1.dcfp+23},
- {0x1.083b04p+35, 0x1.6fdp+23},
- {0x1.9c4568p+35, 0x1.cb7p+23},
- {0x1.d04a98p+35, 0x1.e79p+23},
- {0x1.6043bcp+35, 0x1.a8bp+23},
- {0x1.8045d8p+35, 0x1.bb9p+23},
- {0x1.8c46f8p+35, 0x1.c27p+23},
- {0x1.30411cp+35, 0x1.8abp+23},
- {0x1.40433p+35, 0x1.94fp+23},
- {0x1.50469p+35, 0x1.9efp+23},
- {0x1.ec516p+35, 0x1.f61p+23},
- {0x1.184574p+35, 0x1.7adp+23},
- {0x1.784d1p+35, 0x1.b6fp+23},
- {0x1.b85374p+35, 0x1.dadp+23},
- {0x1.204804p+35, 0x1.803p+23},
- {0x1.a051acp+35, 0x1.cdbp+23},
- {0x1.d458ecp+35, 0x1.e9bp+23},
- {0x1.885404p+35, 0x1.c03p+23},
- {0x1.044b5p+35, 0x1.6d1p+23},
- {0x1.34509cp+35, 0x1.8d5p+23},
- {0x1.ac5a4cp+35, 0x1.d45p+23},
- {0x1.3c51f8p+35, 0x1.927p+23},
- {0x1.fc61a4p+35, 0x1.fe3p+23},
- {0x1.5c55ecp+35, 0x1.a65p+23},
- {0x1.e061p+35, 0x1.effp+23},
- {0x1.545708p+35, 0x1.a17p+23},
- {0x1.f86744p+35, 0x1.fc3p+23},
- {0x1.e8674p+35, 0x1.f41p+23},
- {0x1.b464bcp+35, 0x1.d8bp+23},
- {0x1.a463p+35, 0x1.cffp+23},
- {0x1.7c625cp+35, 0x1.b95p+23},
- {0x1.d86bc4p+35, 0x1.ebdp+23},
- {0x1.1c5af8p+35, 0x1.7d9p+23},
- {0x1.84662p+35, 0x1.bdfp+23},
- {0x1.f470e4p+35, 0x1.fa3p+23},
- {0x1.6c65p+35, 0x1.affp+23},
- {0x1.6865f8p+35, 0x1.ad9p+23},
- {0x1.7069acp+35, 0x1.b25p+23},
- {0x1.105fc8p+35, 0x1.757p+23},
- {0x1.0c609cp+35, 0x1.72bp+23},
- {0x1.3867p+35, 0x1.8ffp+23},
- {0x1.646c94p+35, 0x1.ab3p+23},
- {0x1.c476dcp+35, 0x1.e15p+23},
- {0x1.c877e8p+35, 0x1.e37p+23},
- {0x1.286778p+35, 0x1.859p+23},
- {0x1.486bap+35, 0x1.9a1p+23},
- {0x1.586dcp+35, 0x1.a3fp+23},
- {0x1.00632cp+35, 0x1.6a5p+23},
- {0x1.2c6984p+35, 0x1.883p+23},
- {0x1.146684p+35, 0x1.783p+23},
- {0x1.9474fp+35, 0x1.c71p+23},
- {0x1.f07e84p+35, 0x1.f83p+23},
- {0x1.c07a54p+35, 0x1.df3p+23},
- {0x1.446d98p+35, 0x1.979p+23},
- {0x1.98775cp+35, 0x1.c95p+23},
- {0x1.a87964p+35, 0x1.d23p+23},
- {0x1.4c6fe8p+35, 0x1.9c9p+23},
- {0x1.b07a88p+35, 0x1.d69p+23},
- {0x1.7473fcp+35, 0x1.b4bp+23},
- {0x1.cc7d78p+35, 0x1.e59p+23},
- {0x1.907794p+35, 0x1.c4dp+23},
- {0x1.246c5p+35, 0x1.82fp+23},
- {0x1.e4812p+35, 0x1.f21p+23},
- {0x1.0869p+35, 0x1.6ffp+23},
- {0x1.dc832p+35, 0x1.edfp+23},
- {0x1.307274p+35, 0x1.8adp+23},
- {0x1.bc825p+35, 0x1.dd1p+23},
- {0x1.9c7ed8p+35, 0x1.cb9p+23},
- {0x1.6078d4p+35, 0x1.a8dp+23},
- {0x1.4075dp+35, 0x1.951p+23},
- {0x1.807d4cp+35, 0x1.bbbp+23},
- {0x1.8c7f48p+35, 0x1.c29p+23},
- {0x1.d0878cp+35, 0x1.e7bp+23},
- {0x1.507a7p+35, 0x1.9f1p+23},
- {0x1.1874dp+35, 0x1.7afp+23},
- {0x1.ec9024p+35, 0x1.f63p+23},
- {0x1.20780cp+35, 0x1.805...
[truncated]
|
| @@ -21,7 +21,7 @@ TEST_F(LlvmLibcAcosf16Test, SpecialNumbers) { | |||
| EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::acosf16(sNaN), FE_INVALID); | |||
| EXPECT_MATH_ERRNO(0); | |||
|
|
|||
| EXPECT_FP_EQ(zero, LIBC_NAMESPACE::acosf16(1.0f)); | |||
| EXPECT_FP_EQ(zero, LIBC_NAMESPACE::acosf16(0x1.0p+0f16)); | |||
There was a problem hiding this comment.
we can't use f16 literals because it will trigger compiler runtimes, which we are avoiding. Use fputil::cast<float16>() to wrap the float literals instead.
Replace the f16 literal suffixes and static_cast<float16> conversions in atan2f16_test and the six modified float16 smoke tests with fputil::cast<float16> per review feedback on llvm#241530, avoiding C++23 extended literal suffixes and soft-float runtime conversions. Add explicit libc.src.__support.FPUtil.cast dependencies to the corresponding CMake test targets. Co-authored-by: Tue Ly <lntue.h@gmail.com> Assisted-by: Automated tooling, human reviewed.
Building the math test suite with GCC surfaces conversion, narrowing, uninitialised-variable, and non-exhaustive return warnings, along with -Wattributes visibility warnings under -fvisibility-inlines-hidden when passing LIBC_ALWAYS_INLINE static_rounding functions as template arguments.
Initialise tracking locals across range and shared tests, suffix float and float16 test literals with exact f and f16 hexadecimal forms, cast FModTest inputs with fputil::cast, and wrap static_rounding helpers in static functions for exhaustive expf and exp2f tests. Guard the 64-bit long exponent checks in LdExpTest with if constexpr and mark the MPCUtils RoundingMode switch unreachable after covering all enumerators.
Assisted-by: Automated tooling, human reviewed.