nodejs/deps/v8/test/mjsunit/regress/wasm/regress-329032153.js
Michaël Zasso cfbf9e0d14 deps: update V8 to 12.4.254.14
PR-URL: https://github.com/nodejs/node/pull/52465
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2024-04-22 21:25:15 +00:00

33 lines
1.2 KiB
JavaScript

// Copyright 2024 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.
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
let $sig4 = builder.addType(kSig_i_iii);
let $mem0 = builder.addMemory(16, 32);
// func $main: [kWasmI32, kWasmI32, kWasmI32] -> [kWasmI32]
builder.addFunction('main', $sig4).exportFunc().addBody([
// Load from memory. The memory is zero-initialized, so the loaded value is
// 0.
kExprI32Const, 1,
kExprI64LoadMem32S, 1, 0,
// Store to memory using a SIMD store instruction. This store overlaps with
// the load above.
...wasmI32Const(3),
...wasmI32Const(0xFF),
kSimdPrefix, kExprI8x16Splat,
kSimdPrefix, kExprS128Store64Lane, 0, 0, 0,
// Consume the loaded value. Due to a bug the load was "delayed" to this
// point behind the store causing the load to partially load the stored
// value.
kSimdPrefix, kExprI64x2Splat,
...SimdInstr(kExprI32x4BitMask),
]);
const instance = builder.instantiate({});
assertEquals(0, instance.exports.main(1, 2, 3));