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

Side by Side Diff: test/cctest/wasm/test-run-wasm-64.cc

Issue 2637583002: [wasm] Fix codegen issue for i64.add and i64.sub on ia32 (Closed)
Patch Set: Add test-run-wasm-64.cc tests Created 3 years, 11 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
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 <stdint.h> 5 #include <stdint.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/wasm/wasm-macro-gen.h" 10 #include "src/wasm/wasm-macro-gen.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 WASM_EXEC_TEST(I64Add) { 130 WASM_EXEC_TEST(I64Add) {
131 REQUIRE(I64Add); 131 REQUIRE(I64Add);
132 WasmRunner<int64_t, int64_t, int64_t> r(execution_mode); 132 WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
133 BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); 133 BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
134 FOR_INT64_INPUTS(i) { 134 FOR_INT64_INPUTS(i) {
135 FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); } 135 FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); }
136 } 136 }
137 } 137 }
138 138
139 WASM_EXEC_TEST(I64AddRegress5800) {
Mircea Trofin 2017/01/18 21:01:56 Elsewhere in cctest, we appear to have the naming
Eric Holk 2017/01/18 21:20:50 Done.
140 REQUIRE(I64Add);
141 WasmRunner<int32_t> r(execution_mode);
142 BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_ADD(
143 WASM_I64V(0), WASM_I64V(0x100000000)))),
Mircea Trofin 2017/01/18 21:01:56 add comment explaining why you picked 0x100000000
Eric Holk 2017/01/18 21:20:50 Done.
144 WASM_RETURN1(WASM_I32V(0))),
145 WASM_I32V(0));
146 CHECK_EQ(0, r.Call());
147 }
148
139 WASM_EXEC_TEST(I64Sub) { 149 WASM_EXEC_TEST(I64Sub) {
140 REQUIRE(I64Sub); 150 REQUIRE(I64Sub);
141 WasmRunner<int64_t, int64_t, int64_t> r(execution_mode); 151 WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
142 BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); 152 BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
143 FOR_INT64_INPUTS(i) { 153 FOR_INT64_INPUTS(i) {
144 FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); } 154 FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); }
145 } 155 }
146 } 156 }
147 157
158 WASM_EXEC_TEST(I64SubRegress5800) {
159 REQUIRE(I64Add);
160 WasmRunner<int32_t> r(execution_mode);
161 BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_SUB(
162 WASM_I64V(0), WASM_I64V(0x100000000)))),
163 WASM_RETURN1(WASM_I32V(0))),
164 WASM_I32V(0));
165 CHECK_EQ(0, r.Call());
166 }
167
148 WASM_EXEC_TEST(I64AddUseOnlyLowWord) { 168 WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
149 REQUIRE(I64Add); 169 REQUIRE(I64Add);
150 REQUIRE(I32ConvertI64); 170 REQUIRE(I32ConvertI64);
151 WasmRunner<int32_t, int64_t, int64_t> r(execution_mode); 171 WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
152 BUILD(r, WASM_I32_CONVERT_I64( 172 BUILD(r, WASM_I32_CONVERT_I64(
153 WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); 173 WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
154 FOR_INT64_INPUTS(i) { 174 FOR_INT64_INPUTS(i) {
155 FOR_INT64_INPUTS(j) { 175 FOR_INT64_INPUTS(j) {
156 CHECK_EQ(static_cast<int32_t>(*i + *j), r.Call(*i, *j)); 176 CHECK_EQ(static_cast<int32_t>(*i + *j), r.Call(*i, *j));
157 } 177 }
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 CHECK_EQ(expected, result); 1610 CHECK_EQ(expected, result);
1591 } 1611 }
1592 } 1612 }
1593 } 1613 }
1594 } 1614 }
1595 1615
1596 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); } 1616 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); }
1597 WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); } 1617 WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); }
1598 WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); } 1618 WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); }
1599 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); } 1619 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698