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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "test/unittests/test-utils.h" 5 #include "test/unittests/test-utils.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "test/cctest/wasm/test-signatures.h" 9 #include "test/cctest/wasm/test-signatures.h"
10 10
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 WASM_LOOP(1, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO))); 1884 WASM_LOOP(1, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)));
1885 EXPECT_VERIFIES_INLINE(&env_v_v, WASM_LOOP(1, WASM_BR_IF(0, WASM_ZERO))); 1885 EXPECT_VERIFIES_INLINE(&env_v_v, WASM_LOOP(1, WASM_BR_IF(0, WASM_ZERO)));
1886 1886
1887 EXPECT_VERIFIES_INLINE(&env_v_v, WASM_LOOP(1, WASM_BRV(1, WASM_ZERO))); 1887 EXPECT_VERIFIES_INLINE(&env_v_v, WASM_LOOP(1, WASM_BRV(1, WASM_ZERO)));
1888 EXPECT_VERIFIES_INLINE(&env_v_v, WASM_LOOP(1, WASM_BR(1))); 1888 EXPECT_VERIFIES_INLINE(&env_v_v, WASM_LOOP(1, WASM_BR(1)));
1889 } 1889 }
1890 1890
1891 1891
1892 TEST_F(WasmDecoderTest, Select) { 1892 TEST_F(WasmDecoderTest, Select) {
1893 EXPECT_VERIFIES_INLINE( 1893 EXPECT_VERIFIES_INLINE(
1894 &env_i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_ZERO));
1895 EXPECT_VERIFIES_INLINE(&env_f_ff,
1896 WASM_SELECT(WASM_F32(0.0), WASM_F32(0.0), WASM_ZERO));
1897 EXPECT_VERIFIES_INLINE(&env_d_dd,
1898 WASM_SELECT(WASM_F64(0.0), WASM_F64(0.0), WASM_ZERO));
1899 EXPECT_VERIFIES_INLINE(&env_l_l,
1900 WASM_SELECT(WASM_I64(0), WASM_I64(0), WASM_ZERO));
1901 }
1902
1903 TEST_F(WasmDecoderTest, Select_fail1) {
1904 EXPECT_FAILURE_INLINE(&env_i_i, WASM_SELECT(WASM_F32(0.0), WASM_GET_LOCAL(0),
1905 WASM_GET_LOCAL(0)));
1906 EXPECT_FAILURE_INLINE(&env_i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_F32(0.0),
1907 WASM_GET_LOCAL(0)));
1908 EXPECT_FAILURE_INLINE(
1894 &env_i_i, 1909 &env_i_i,
1895 WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); 1910 WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_F32(0.0)));
1911 }
1912
1913 TEST_F(WasmDecoderTest, Select_fail2) {
1914 for (size_t i = 0; i < arraysize(kLocalTypes); i++) {
1915 LocalType type = kLocalTypes[i];
1916 if (type == kAstI32) continue;
1917
1918 LocalType types[] = {type, kAstI32, type};
1919 FunctionSig sig(1, 2, types);
1920 FunctionEnv env;
1921 init_env(&env, &sig);
1922
1923 EXPECT_VERIFIES_INLINE(
1924 &env,
1925 WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)));
1926
1927 EXPECT_FAILURE_INLINE(
1928 &env,
1929 WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
1930
1931 EXPECT_FAILURE_INLINE(
1932 &env,
1933 WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)));
1934
1935 EXPECT_FAILURE_INLINE(
1936 &env,
1937 WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
1938 }
1896 } 1939 }
1897 1940
1898 1941
1899 TEST_F(WasmDecoderTest, Select_TypeCheck) { 1942 TEST_F(WasmDecoderTest, Select_TypeCheck) {
1900 EXPECT_FAILURE_INLINE(&env_i_i, WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), 1943 EXPECT_FAILURE_INLINE(&env_i_i, WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0),
1901 WASM_GET_LOCAL(0))); 1944 WASM_GET_LOCAL(0)));
1902 1945
1903 EXPECT_FAILURE_INLINE(&env_i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_F64(0.25), 1946 EXPECT_FAILURE_INLINE(&env_i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_F64(0.25),
1904 WASM_GET_LOCAL(0))); 1947 WASM_GET_LOCAL(0)));
1905 1948
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 EXPECT_ARITY(1, kExprF64SConvertI64); 2416 EXPECT_ARITY(1, kExprF64SConvertI64);
2374 EXPECT_ARITY(1, kExprF64UConvertI64); 2417 EXPECT_ARITY(1, kExprF64UConvertI64);
2375 EXPECT_ARITY(1, kExprF64ConvertF32); 2418 EXPECT_ARITY(1, kExprF64ConvertF32);
2376 EXPECT_ARITY(1, kExprF64ReinterpretI64); 2419 EXPECT_ARITY(1, kExprF64ReinterpretI64);
2377 EXPECT_ARITY(1, kExprI32ReinterpretF32); 2420 EXPECT_ARITY(1, kExprI32ReinterpretF32);
2378 EXPECT_ARITY(1, kExprI64ReinterpretF64); 2421 EXPECT_ARITY(1, kExprI64ReinterpretF64);
2379 } 2422 }
2380 } // namespace wasm 2423 } // namespace wasm
2381 } // namespace internal 2424 } // namespace internal
2382 } // namespace v8 2425 } // namespace v8
OLDNEW
« 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