a345a442d3
- Add d8.file.read() and d8.file.execute() helpers - Change tools and tests to use new d8.file helper - Unify error throwing in v8::Shell::ReadFile Change-Id: I5ef4cb27f217508a367106f01e872a4059d5e399 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2928505 Commit-Queue: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Maya Lekova <mslekova@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/master@{#74883}
93 lines
2.9 KiB
JavaScript
93 lines
2.9 KiB
JavaScript
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --experimental-wasm-simd --experimental-wasm-mv
|
|
|
|
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
|
|
|
(function MultiReturnS128Test() {
|
|
print("MultiReturnS128Test");
|
|
// Most backends only support 2 fp return registers, so the third v128
|
|
// onwards here will written to caller stack slot.
|
|
let builder = new WasmModuleBuilder();
|
|
let sig_v_sssss = builder.addType(
|
|
makeSig([], [kWasmS128, kWasmS128, kWasmS128, kWasmS128, kWasmS128]));
|
|
let sig_iiiiiiiiii_v = builder.addType(
|
|
makeSig([], [kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32,
|
|
kWasmI32, kWasmI32, kWasmI32, kWasmI32] ));
|
|
|
|
let callee = builder.addFunction("callee", sig_v_sssss)
|
|
.addBody([
|
|
kExprI32Const, 0,
|
|
kSimdPrefix, kExprI32x4Splat,
|
|
kExprI32Const, 1,
|
|
kSimdPrefix, kExprI32x4Splat,
|
|
kExprI32Const, 2,
|
|
kSimdPrefix, kExprI32x4Splat,
|
|
kExprI32Const, 3,
|
|
kSimdPrefix, kExprI32x4Splat,
|
|
kExprI32Const, 4,
|
|
kSimdPrefix, kExprI32x4Splat,
|
|
kExprReturn]);
|
|
// For each v128 on the stack, we return the first and last lane. This help
|
|
// catch bugs with reading/writing the wrong stack slots.
|
|
builder.addFunction("main", sig_iiiiiiiiii_v)
|
|
.addLocals(kWasmI32, 10).addLocals(kWasmS128, 1)
|
|
.addBody([
|
|
kExprCallFunction, callee.index,
|
|
|
|
kExprLocalTee, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 0,
|
|
kExprLocalSet, 0,
|
|
kExprLocalGet, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 3,
|
|
kExprLocalSet, 1,
|
|
|
|
kExprLocalTee, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 0,
|
|
kExprLocalSet, 2,
|
|
kExprLocalGet, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 3,
|
|
kExprLocalSet, 3,
|
|
|
|
kExprLocalTee, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 0,
|
|
kExprLocalSet, 4,
|
|
kExprLocalGet, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 3,
|
|
kExprLocalSet, 5,
|
|
|
|
kExprLocalTee, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 0,
|
|
kExprLocalSet, 6,
|
|
kExprLocalGet, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 3,
|
|
kExprLocalSet, 7,
|
|
|
|
kExprLocalTee, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 0,
|
|
kExprLocalSet, 8,
|
|
kExprLocalGet, 10,
|
|
kSimdPrefix, kExprI32x4ExtractLane, 3,
|
|
kExprLocalSet, 9,
|
|
|
|
// Return all the stored locals.
|
|
kExprLocalGet, 0,
|
|
kExprLocalGet, 1,
|
|
kExprLocalGet, 2,
|
|
kExprLocalGet, 3,
|
|
kExprLocalGet, 4,
|
|
kExprLocalGet, 5,
|
|
kExprLocalGet, 6,
|
|
kExprLocalGet, 7,
|
|
kExprLocalGet, 8,
|
|
kExprLocalGet, 9,
|
|
])
|
|
.exportAs("main");
|
|
|
|
let module = new WebAssembly.Module(builder.toBuffer());
|
|
let instance = new WebAssembly.Instance(module);
|
|
assertEquals(instance.exports.main(), [4, 4, 3, 3, 2, 2, 1, 1, 0, 0]);
|
|
})();
|