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

Unified Diff: test/unittests/wasm/ast-decoder-unittest.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 | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/wasm/ast-decoder-unittest.cc
diff --git a/test/unittests/wasm/ast-decoder-unittest.cc b/test/unittests/wasm/ast-decoder-unittest.cc
index d0c467053c39e3ab60fd98fd2b376efcc4c473a6..ae71c9b21ac38b6ce14cb7a470653ec87dc928dc 100644
--- a/test/unittests/wasm/ast-decoder-unittest.cc
+++ b/test/unittests/wasm/ast-decoder-unittest.cc
@@ -1891,8 +1891,51 @@ TEST_F(WasmDecoderTest, ExprBreakNesting1) {
TEST_F(WasmDecoderTest, Select) {
EXPECT_VERIFIES_INLINE(
+ &env_i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_ZERO));
+ EXPECT_VERIFIES_INLINE(&env_f_ff,
+ WASM_SELECT(WASM_F32(0.0), WASM_F32(0.0), WASM_ZERO));
+ EXPECT_VERIFIES_INLINE(&env_d_dd,
+ WASM_SELECT(WASM_F64(0.0), WASM_F64(0.0), WASM_ZERO));
+ EXPECT_VERIFIES_INLINE(&env_l_l,
+ WASM_SELECT(WASM_I64(0), WASM_I64(0), WASM_ZERO));
+}
+
+TEST_F(WasmDecoderTest, Select_fail1) {
+ EXPECT_FAILURE_INLINE(&env_i_i, WASM_SELECT(WASM_F32(0.0), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(0)));
+ EXPECT_FAILURE_INLINE(&env_i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_F32(0.0),
+ WASM_GET_LOCAL(0)));
+ EXPECT_FAILURE_INLINE(
&env_i_i,
- WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
+ WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_F32(0.0)));
+}
+
+TEST_F(WasmDecoderTest, Select_fail2) {
+ for (size_t i = 0; i < arraysize(kLocalTypes); i++) {
+ LocalType type = kLocalTypes[i];
+ if (type == kAstI32) continue;
+
+ LocalType types[] = {type, kAstI32, type};
+ FunctionSig sig(1, 2, types);
+ FunctionEnv env;
+ init_env(&env, &sig);
+
+ EXPECT_VERIFIES_INLINE(
+ &env,
+ WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)));
+
+ EXPECT_FAILURE_INLINE(
+ &env,
+ WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
+
+ EXPECT_FAILURE_INLINE(
+ &env,
+ WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)));
+
+ EXPECT_FAILURE_INLINE(
+ &env,
+ WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+ }
}
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698