mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-21 10:42:35 +00:00
[libc][NFC] Fix "type qualifiers ignored on cast result type" GCC warning (#78509)
GCC complains about "type qualifiers ignored on cast result type". Upon investigation the correct fix was to remove all `volatile` and use the `-frounding-math` option.
This commit is contained in:
parent
c6cfd5350e
commit
508c6aa8f3
@ -9,6 +9,9 @@ add_fp_unittest(
|
||||
dyadic_float_test.cpp
|
||||
DEPENDS
|
||||
libc.src.__support.FPUtil.dyadic_float
|
||||
COMPILE_OPTIONS
|
||||
# Prevent constant folding with a default rounding mode.
|
||||
"-frounding-math"
|
||||
)
|
||||
|
||||
add_libc_test(
|
||||
|
@ -20,49 +20,39 @@ using Sign = LIBC_NAMESPACE::fputil::Sign;
|
||||
TEST(LlvmLibcDyadicFloatTest, BasicConversions) {
|
||||
Float128 x(Sign::POS, /*exponent*/ 0,
|
||||
/*mantissa*/ Float128::MantissaType(1));
|
||||
volatile float xf = float(x);
|
||||
volatile double xd = double(x);
|
||||
ASSERT_FP_EQ(1.0f, xf);
|
||||
ASSERT_FP_EQ(1.0, xd);
|
||||
ASSERT_FP_EQ(1.0f, float(x));
|
||||
ASSERT_FP_EQ(1.0, double(x));
|
||||
|
||||
Float128 y(0x1.0p-53);
|
||||
volatile float yf = float(y);
|
||||
volatile double yd = double(y);
|
||||
ASSERT_FP_EQ(0x1.0p-53f, yf);
|
||||
ASSERT_FP_EQ(0x1.0p-53, yd);
|
||||
ASSERT_FP_EQ(0x1.0p-53f, float(y));
|
||||
ASSERT_FP_EQ(0x1.0p-53, double(y));
|
||||
|
||||
Float128 z = quick_add(x, y);
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(xf + yf, float(z));
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(xd + yd, double(z));
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(float(x) + float(y), float(z));
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(double(x) + double(y), double(z));
|
||||
}
|
||||
|
||||
TEST(LlvmLibcDyadicFloatTest, QuickAdd) {
|
||||
Float192 x(Sign::POS, /*exponent*/ 0,
|
||||
/*mantissa*/ Float192::MantissaType(0x123456));
|
||||
volatile double xd = double(x);
|
||||
ASSERT_FP_EQ(0x1.23456p20, xd);
|
||||
ASSERT_FP_EQ(0x1.23456p20, double(x));
|
||||
|
||||
Float192 y(0x1.abcdefp-20);
|
||||
volatile double yd = double(y);
|
||||
ASSERT_FP_EQ(0x1.abcdefp-20, yd);
|
||||
ASSERT_FP_EQ(0x1.abcdefp-20, double(y));
|
||||
|
||||
Float192 z = quick_add(x, y);
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(xd + yd, (volatile double)(z));
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(double(x) + double(y), double(z));
|
||||
}
|
||||
|
||||
TEST(LlvmLibcDyadicFloatTest, QuickMul) {
|
||||
Float256 x(Sign::POS, /*exponent*/ 0,
|
||||
/*mantissa*/ Float256::MantissaType(0x123456));
|
||||
volatile double xd = double(x);
|
||||
ASSERT_FP_EQ(0x1.23456p20, xd);
|
||||
ASSERT_FP_EQ(0x1.23456p20, double(x));
|
||||
|
||||
Float256 y(0x1.abcdefp-25);
|
||||
volatile double yd = double(y);
|
||||
ASSERT_FP_EQ(0x1.abcdefp-25, yd);
|
||||
ASSERT_FP_EQ(0x1.abcdefp-25, double(y));
|
||||
|
||||
Float256 z = quick_mul(x, y);
|
||||
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(xd * yd, double(z));
|
||||
EXPECT_FP_EQ_ALL_ROUNDING(double(x) * double(y), double(z));
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ libc_test(
|
||||
libc_test(
|
||||
name = "dyadic_float_test",
|
||||
srcs = ["dyadic_float_test.cpp"],
|
||||
copts = ["-frounding-math"],
|
||||
deps = [
|
||||
"//libc:__support_fputil_dyadic_float",
|
||||
"//libc:__support_uint",
|
||||
|
Loading…
x
Reference in New Issue
Block a user