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

Side by Side Diff: test/mjsunit/regress/wasm/regression-5800.js

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 | « test/cctest/wasm/test-run-wasm-64.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
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 load("test/mjsunit/wasm/wasm-constants.js");
6 load("test/mjsunit/wasm/wasm-module-builder.js");
7
8 (function AddTest() {
9 let builder = new WasmModuleBuilder();
10
11 builder.addFunction("main", kSig_i_v)
12 .addBody([
13 kExprBlock, kWasmStmt,
14 kExprI64Const, 0,
15 // 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so
16 // that the 64-bit constant has a non-zero top half. In this bug, the
17 // top half was clobbering eax, leading to the function return 1 rather
18 // than 0.
19 kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x10,
20 kExprI64Add,
21 kExprI64Eqz,
22 kExprBrIf, 0,
23 kExprI32Const, 0,
24 kExprReturn,
25 kExprEnd,
26 kExprI32Const, 0
27 ])
28 .exportFunc();
29 let module = builder.instantiate();
30 assertEquals(0, module.exports.main());
31 })();
32
33 (function SubTest() {
34 let builder = new WasmModuleBuilder();
35
36 builder.addFunction("main", kSig_i_v)
37 .addBody([
38 kExprBlock, kWasmStmt,
39 kExprI64Const, 0,
40 // 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so
41 // that the 64-bit constant has a non-zero top half. In this bug, the
42 // top half was clobbering eax, leading to the function return 1 rather
43 // than 0.
44 kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x10,
45 kExprI64Sub,
46 kExprI64Eqz,
47 kExprBrIf, 0,
48 kExprI32Const, 0,
49 kExprReturn,
50 kExprEnd,
51 kExprI32Const, 0
52 ])
53 .exportFunc();
54 let module = builder.instantiate();
55 assertEquals(0, module.exports.main());
56 })();
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm-64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698