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

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

Issue 1624323003: [wasm] Put the condition last in kExprSelect. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/ast-decoder.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | 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 10152471e522e201711ef1fabd31080193f6ca5e..3c9f86afaffb8f072cc6bb2919783a0920f9f510 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -978,8 +978,8 @@ TEST(Run_Wasm_Return_F64) {
TEST(Run_Wasm_Select) {
WasmRunner<int32_t> r(MachineType::Int32());
- // return select(a, 11, 22);
- BUILD(r, WASM_SELECT(WASM_GET_LOCAL(0), WASM_I8(11), WASM_I8(22)));
+ // return select(11, 22, a);
+ BUILD(r, WASM_SELECT(WASM_I8(11), WASM_I8(22), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) {
int32_t expected = *i ? 11 : 22;
CHECK_EQ(expected, r.Call(*i));
@@ -989,22 +989,38 @@ TEST(Run_Wasm_Select) {
TEST(Run_Wasm_Select_strict1) {
WasmRunner<int32_t> r(MachineType::Int32());
- // select(a, a = 11, 22); return a
- BUILD(r,
- WASM_BLOCK(2, WASM_SELECT(WASM_GET_LOCAL(0),
- WASM_SET_LOCAL(0, WASM_I8(11)), WASM_I8(22)),
- WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(11, r.Call(*i)); }
+ // select(a=0, a=1, a=2); return a
+ BUILD(r, WASM_BLOCK(2, WASM_SELECT(WASM_SET_LOCAL(0, WASM_I8(0)),
+ WASM_SET_LOCAL(0, WASM_I8(1)),
+ WASM_SET_LOCAL(0, WASM_I8(2))),
+ WASM_GET_LOCAL(0)));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); }
}
TEST(Run_Wasm_Select_strict2) {
WasmRunner<int32_t> r(MachineType::Int32());
- // select(a, 11, a = 22); return a;
- BUILD(r, WASM_BLOCK(2, WASM_SELECT(WASM_GET_LOCAL(0), WASM_I8(11),
- WASM_SET_LOCAL(0, WASM_I8(22))),
- WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(22, r.Call(*i)); }
+ r.env()->AddLocals(kAstI32, 2);
+ // select(b=5, c=6, a)
+ BUILD(r, WASM_SELECT(WASM_SET_LOCAL(1, WASM_I8(5)),
+ WASM_SET_LOCAL(2, WASM_I8(6)), WASM_GET_LOCAL(0)));
+ FOR_INT32_INPUTS(i) {
+ int32_t expected = *i ? 5 : 6;
+ CHECK_EQ(expected, r.Call(*i));
+ }
+}
+
+TEST(Run_Wasm_Select_strict3) {
+ WasmRunner<int32_t> r(MachineType::Int32());
+ r.env()->AddLocals(kAstI32, 2);
+ // select(b=5, c=6, a=b)
+ BUILD(r, WASM_SELECT(WASM_SET_LOCAL(1, WASM_I8(5)),
+ WASM_SET_LOCAL(2, WASM_I8(6)),
+ WASM_SET_LOCAL(0, WASM_GET_LOCAL(1))));
+ FOR_INT32_INPUTS(i) {
+ int32_t expected = 5;
+ CHECK_EQ(expected, r.Call(*i));
+ }
}
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698