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

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

Issue 1516143004: [wasm] Fixed F32Neg and F64Neg for -0.0. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/compiler/wasm-compiler.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 7db7cb740e6483f4a446fb81c23331df7c24886b..7f456a7f025c8822be66b821e967921c23e616d1 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -1148,6 +1148,30 @@ TEST(Run_WasmFloat64Unops) {
}
+TEST(Run_WasmFloat32Neg) {
+ WasmRunner<float> r(MachineType::Float32());
+ BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT32_INPUTS(i) { CheckFloatEq(-(*i), r.Call(*i)); }
+
+ // The difference between +0 and -0 matters here.
+ CHECK_EQ(bit_cast<uint32_t>(-0.0f), bit_cast<uint32_t>(r.Call(0.0f)));
+ CHECK_EQ(bit_cast<uint32_t>(0.0f), bit_cast<uint32_t>(r.Call(-0.0f)));
+}
+
+
+TEST(Run_WasmFloat64Neg) {
+ WasmRunner<double> r(MachineType::Float64());
+ BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(-(*i), r.Call(*i)); }
+
+ // The difference between +0 and -0 matters here.
+ CHECK_EQ(bit_cast<uint64_t>(-0.0), bit_cast<uint64_t>(r.Call(0.0)));
+ CHECK_EQ(bit_cast<uint64_t>(0.0), bit_cast<uint64_t>(r.Call(-0.0)));
+}
+
+
TEST(Run_Wasm_IfElse_P) {
WasmRunner<int32_t> r(MachineType::Int32());
// if (p0) return 11; else return 22;
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698