Revert "[lldb] Fix UB in half2float and add some more tests."
This reverts commit 4b074b49be206306330076b9fa40632ef1960823. Some of the new tests are failing on Debian.
This commit is contained in:
parent
745ddd27ea
commit
30a5ddaef3
@ -52,9 +52,7 @@ static float half2float(uint16_t half) {
|
||||
float f;
|
||||
uint32_t u;
|
||||
} u;
|
||||
// Sign extend to 4 byte.
|
||||
int32_t sign_extended = static_cast<int16_t>(half);
|
||||
uint32_t v = static_cast<uint32_t>(sign_extended);
|
||||
int32_t v = (int16_t)half;
|
||||
|
||||
if (0 == (v & 0x7c00)) {
|
||||
u.u = v & 0x80007FFFU;
|
||||
|
@ -174,30 +174,8 @@ TEST(DumpDataExtractorTest, Formats) {
|
||||
"{0x0000000000000000 0xaaaabbbbccccdddd}");
|
||||
|
||||
// See half2float for format details.
|
||||
// Test zeroes.
|
||||
TestDump(std::vector<uint16_t>{0x0000, 0x8000},
|
||||
lldb::Format::eFormatVectorOfFloat16, "{0 -0}");
|
||||
// Some subnormal numbers.
|
||||
TestDump(std::vector<uint16_t>{0x0001, 0x8001},
|
||||
lldb::Format::eFormatVectorOfFloat16, "{5.96046e-08 -5.96046e-08}");
|
||||
// A full mantisse and empty expontent.
|
||||
TestDump(std::vector<uint16_t>{0x83ff, 0x03ff},
|
||||
lldb::Format::eFormatVectorOfFloat16, "{-6.09756e-05 6.09756e-05}");
|
||||
// Some normal numbers.
|
||||
TestDump(std::vector<uint16_t>{0b0100001001001000},
|
||||
lldb::Format::eFormatVectorOfFloat16, "{3.14062}");
|
||||
TestDump(std::vector<uint16_t>{0xabcd, 0x1234},
|
||||
lldb::Format::eFormatVectorOfFloat16, "{-0.0609436 0.000757217}");
|
||||
// Largest and smallest normal number.
|
||||
TestDump(std::vector<uint16_t>{0x0400, 0x7bff},
|
||||
lldb::Format::eFormatVectorOfFloat16, "{6.10352e-05 65504}");
|
||||
// quiet/signaling NaNs.
|
||||
TestDump(std::vector<uint16_t>{0xffff, 0xffc0, 0x7fff, 0x7fc0},
|
||||
lldb::Format::eFormatVectorOfFloat16, "{nan nan nan nan}");
|
||||
// +/-Inf.
|
||||
TestDump(std::vector<uint16_t>{0xfc00, 0x7c00},
|
||||
lldb::Format::eFormatVectorOfFloat16, "{-inf inf}");
|
||||
|
||||
TestDump(std::vector<float>{std::numeric_limits<float>::min(),
|
||||
std::numeric_limits<float>::max()},
|
||||
lldb::Format::eFormatVectorOfFloat32, "{1.17549e-38 3.40282e+38}");
|
||||
|
Loading…
x
Reference in New Issue
Block a user