Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1285)

Unified Diff: test/cctest/wasm/test-run-wasm.cc

Issue 2019693002: MIPS: Fix '[turbofan] Introduce new operators Float32SubPreserveNan and Float64SubPreserveNan'. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix instruction selector mips64. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm.cc
diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc
index 710b59276f97bbd2db466241958d3baa10a65318..efc0fd103f2e55f54fc33d1f8e8296ce98798950 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -609,15 +609,46 @@ WASM_EXEC_TEST(Float32SubMinusZero) {
WasmRunner<float> r(execution_mode, MachineType::Float32());
BUILD(r, WASM_F32_SUB(WASM_F32(-0.0), WASM_GET_LOCAL(0)));
- CHECK_EQ(0x7fe00000, bit_cast<uint32_t>(r.Call(bit_cast<float>(0x7fa00000))));
+ uint32_t sNanValue =
+ bit_cast<uint32_t>(std::numeric_limits<float>::signaling_NaN());
+ uint32_t payload = 0x00200000;
+
+ static const uint32_t kSignalingBit = 1 << 22;
+ uint32_t qNanValue =
+ bit_cast<uint32_t>(std::numeric_limits<float>::quiet_NaN());
+ if ((qNanValue & kSignalingBit) != 0) {
+ // On some machines, the signaling bit set indicates it's a quiet NaN.
+ qNanValue = sNanValue | kSignalingBit;
+ } else {
+ // On others, the signaling bit set indicates it's a signaling NaN.
+ qNanValue = qNanValue & ~kSignalingBit;
+ }
+ uint32_t expected = qNanValue | payload;
+ uint32_t operand = sNanValue | payload;
+ CHECK_EQ(expected, bit_cast<uint32_t>(r.Call(bit_cast<float>(operand))));
}
WASM_EXEC_TEST(Float64SubMinusZero) {
WasmRunner<double> r(execution_mode, MachineType::Float64());
BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0)));
- CHECK_EQ(0x7ff8123456789abc,
- bit_cast<uint64_t>(r.Call(bit_cast<double>(0x7ff0123456789abc))));
+ uint64_t sNanValue =
+ bit_cast<uint64_t>(std::numeric_limits<double>::signaling_NaN());
+ uint64_t payload = 0x0000123456789abc;
+
+ static const uint64_t kSignalingBit = 1ULL << 51;
+ uint64_t qNanValue =
+ bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN());
+ if ((qNanValue & kSignalingBit) != 0) {
+ // On some machines, the signaling bit set indicates it's a quiet NaN.
+ qNanValue = sNanValue | kSignalingBit;
+ } else {
+ // On others, the signaling bit set indicates it's a signaling NaN.
+ qNanValue = qNanValue & ~kSignalingBit;
+ }
+ uint64_t expected = qNanValue | payload;
+ uint64_t operand = sNanValue | payload;
+ CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand))));
}
WASM_EXEC_TEST(Float64Neg) {
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698