Commit f550ba8d authored by Manos Koukoutos's avatar Manos Koukoutos Committed by V8 LUCI CQ

[wasm][test] Add missing unrolling test

Bug: v8:12166
Change-Id: Ib1d9ac90a2b9c03915c496f1d23586ab8a94aef7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3891209
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83137}
parent a3d42f56
......@@ -38,7 +38,28 @@ d8.file.execute("test/mjsunit/wasm/exceptions-utils.js");
(function MultiBlockResultTest() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
// TODO(manoskouk): Rewrite this test.
let sig = builder.addType(kSig_ii_ii);
// f(a, b) = a + b + b + b - a*b*b*b
builder.addFunction("main", kSig_i_ii)
.addLocals(kWasmI32, 2)
.addBody([
kExprLocalGet, 0, kExprLocalGet, 0,
kExprLoop, sig,
kExprLocalSet, 2, // Temporarily store the second value.
kExprLocalGet, 1, kExprI32Add,
// multiply the second value by 2
kExprLocalGet, 2, kExprLocalGet, 1, kExprI32Mul,
// Increment counter, then loop if <= 3.
kExprLocalGet, 3, kExprI32Const, 1, kExprI32Add, kExprLocalSet, 3,
kExprLocalGet, 3, kExprI32Const, 3, kExprI32LtS,
kExprBrIf, 0,
kExprEnd,
kExprI32Sub])
.exportFunc();
let instance = builder.instantiate();
assertEquals(10 + 5 + 5 + 5 - (10 * 5 * 5 * 5), instance.exports.main(10, 5))
})();
// Test the interaction between tail calls and loop unrolling.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment