[libc-commits] [libc] [libc] Make `BigInt` bitwise shift consistent with regular integral semantics. (PR #87762)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Fri Apr 5 09:34:31 PDT 2024
================
@@ -122,15 +122,17 @@ template <size_t Bits> struct DyadicFloat {
int exp_lo = exp_hi - static_cast<int>(PRECISION) - 1;
- MantissaType m_hi(mantissa >> shift);
+ MantissaType m_hi =
+ shift >= MantissaType::BITS ? MantissaType(0) : mantissa >> shift;
----------------
gchatelet wrote:
The failing tests:
```
@llvm-project//libc/test/src/__support/FPUtil:dyadic_float_test FAILED in 0.1s
@llvm-project//libc/test/src/math:ldexp_test FAILED in 0.0s
@llvm-project//libc/test/src/math:ldexpf_test FAILED in 0.0s
@llvm-project//libc/test/src/math:ldexpl_test FAILED in 0.0s
@llvm-project//libc/test/src/math:scalbn_test FAILED in 0.1s
@llvm-project//libc/test/src/math:scalbnf_test FAILED in 0.1s
@llvm-project//libc/test/src/math:scalbnl_test FAILED in 0.0s
@llvm-project//libc/test/src/math/smoke:ldexpf128_test FAILED in 0.0s
```
A few failure logs below
```
[ RUN ] LlvmLibcScalbnTest.UnderflowToZeroOnNormal
external/llvm-project/libc/test/src/math/LdExpTest.h:79: FAILURE
Failed to match x > 0 ? zero : neg_zero against LIBC_NAMESPACE::testing::getMatcher< LIBC_NAMESPACE::testing::TestCond::EQ>(func(x, -exp)).
Expected floating point value: 0x000091A0 = (S: 0, E: 0x0000, M: 0x000091A0)
Actual floating point value: 0x00000000 = (S: 0, E: 0x0000, M: 0x00000000)
[ FAILED ] LlvmLibcScalbnTest.UnderflowToZeroOnNormal
[ RUN ] LlvmLibcScalbnTest.UnderflowToZeroOnSubnormal
external/llvm-project/libc/test/src/math/LdExpTest.h:92: FAILURE
Failed to match x > 0 ? zero : neg_zero against LIBC_NAMESPACE::testing::getMatcher< LIBC_NAMESPACE::testing::TestCond::EQ>(func(x, -exp)).
Expected floating point value: 0x00012340 = (S: 0, E: 0x0000, M: 0x00012340)
Actual floating point value: 0x00000000 = (S: 0, E: 0x0000, M: 0x00000000)
[ FAILED ] LlvmLibcScalbnTest.UnderflowToZeroOnSubnormal
[ RUN ] LlvmLibcScalbnTest.NormalOperation
external/llvm-project/libc/test/src/math/LdExpTest.h:118: FAILURE
Failed to match x / two_to_exp against LIBC_NAMESPACE::testing::getMatcher< LIBC_NAMESPACE::testing::TestCond::EQ>(func(x, -exp)).
Expected floating point value: 0x00123401 = (S: 0, E: 0x0000, M: 0x00123401)
Actual floating point value: 0x00000001 = (S: 0, E: 0x0000, M: 0x00000001)
[ FAILED ] LlvmLibcScalbnTest.NormalOperation
```
---
```
[ RUN ] LlvmLibcDyadicFloatTest.EdgeRangesFloat
external/llvm-project/libc/test/src/__support/FPUtil/dyadic_float_test.cpp:89: FAILURE
Failed to match static_cast<float>(z) against LIBC_NAMESPACE::testing::getMatcher< LIBC_NAMESPACE::testing::TestCond::EQ>(Bits::zero().get_val()).
Expected floating point value: 0x00000000 = (S: 0, E: 0x0000, M: 0x00000000)
Actual floating point value: 0xF4800000 = (S: 1, E: 0x00E9, M: 0x00000000)
[ FAILED ] LlvmLibcDyadicFloatTest.EdgeRangesFloat
```
https://github.com/llvm/llvm-project/pull/87762
More information about the libc-commits
mailing list