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

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: Rebasing 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
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | test/mjsunit/regress/wasm/regression-5800.js » ('j') | 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 <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 // The i64 add and subtract regression tests need a 64-bit value with a non-zero
140 // upper half. This upper half was clobbering eax, leading to the function
141 // returning 1 rather than 0.
142 const int64_t kHasBit33On = 0x100000000;
143
144 WASM_EXEC_TEST(Regress5800_Add) {
145 REQUIRE(I64Add);
146 WasmRunner<int32_t> r(execution_mode);
147 BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_ADD(
148 WASM_I64V(0), WASM_I64V(kHasBit33On)))),
149 WASM_RETURN1(WASM_I32V(0))),
150 WASM_I32V(0));
151 CHECK_EQ(0, r.Call());
152 }
153
139 WASM_EXEC_TEST(I64Sub) { 154 WASM_EXEC_TEST(I64Sub) {
140 REQUIRE(I64Sub); 155 REQUIRE(I64Sub);
141 WasmRunner<int64_t, int64_t, int64_t> r(execution_mode); 156 WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
142 BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); 157 BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
143 FOR_INT64_INPUTS(i) { 158 FOR_INT64_INPUTS(i) {
144 FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); } 159 FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); }
145 } 160 }
146 } 161 }
147 162
163 WASM_EXEC_TEST(Regress5800_Sub) {
164 REQUIRE(I64Sub);
165 WasmRunner<int32_t> r(execution_mode);
166 BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_SUB(
167 WASM_I64V(0), WASM_I64V(kHasBit33On)))),
168 WASM_RETURN1(WASM_I32V(0))),
169 WASM_I32V(0));
170 CHECK_EQ(0, r.Call());
171 }
172
148 WASM_EXEC_TEST(I64AddUseOnlyLowWord) { 173 WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
149 REQUIRE(I64Add); 174 REQUIRE(I64Add);
150 REQUIRE(I32ConvertI64); 175 REQUIRE(I32ConvertI64);
151 WasmRunner<int32_t, int64_t, int64_t> r(execution_mode); 176 WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
152 BUILD(r, WASM_I32_CONVERT_I64( 177 BUILD(r, WASM_I32_CONVERT_I64(
153 WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); 178 WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
154 FOR_INT64_INPUTS(i) { 179 FOR_INT64_INPUTS(i) {
155 FOR_INT64_INPUTS(j) { 180 FOR_INT64_INPUTS(j) {
156 CHECK_EQ(static_cast<int32_t>(*i + *j), r.Call(*i, *j)); 181 CHECK_EQ(static_cast<int32_t>(*i + *j), r.Call(*i, *j));
157 } 182 }
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 CHECK_EQ(expected, result); 1615 CHECK_EQ(expected, result);
1591 } 1616 }
1592 } 1617 }
1593 } 1618 }
1594 } 1619 }
1595 1620
1596 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); } 1621 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); } 1622 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); } 1623 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); } 1624 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); }
OLDNEW
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | test/mjsunit/regress/wasm/regression-5800.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698