MCPcopy Create free account
hub / github.com/nodejs/node / MakeBody

Function MakeBody

deps/v8/test/mjsunit/wasm/simd-relaxed-lane-select.js:11–32  ·  view source on GitHub ↗
(lane_width)

Source from the content-addressed store, hash-verified

9const builder = new WasmModuleBuilder();
10
11function MakeBody(lane_width) {
12 let select_instr = lane_width == 8 ? kExprI8x16RelaxedLaneSelect :
13 lane_width == 16 ? kExprI16x8RelaxedLaneSelect :
14 lane_width == 32 ? kExprI32x4RelaxedLaneSelect :
15 lane_width == 64 ? kExprI64x2RelaxedLaneSelect : null;
16 assertNotNull(select_instr);
17 return [
18 // Value A: all 0-bits.
19 kExprI32Const, 0x00,
20 kSimdPrefix, kExprI8x16Splat,
21 // Value B: all 1-bits.
22 ...wasmI32Const(0xFF),
23 kSimdPrefix, kExprI8x16Splat,
24 // Mask: a wild mix of bit patterns.
25 ...wasmS128Const([0x80, 0x7F, 0xC0, 0x3F, 0x40, 0x9F, 0x20, 0x1F,
26 0x70, 0xA0, 0xFF, 0x00, 0xFF, 0xFF, 0x10, 0x01]),
27 // The main point of the test: use the mask to select lanes.
28 kSimdPrefix, ...select_instr,
29 // Let's see which lanes were selected for each byte.
30 kSimdPrefix, kExprI8x16BitMask, 0x01,
31 ];
32}
33
34builder.addFunction('test8', kSig_i_v).exportFunc().addBody(MakeBody(8));
35builder.addFunction('test16', kSig_i_v).exportFunc().addBody(MakeBody(16));

Callers 1

Calls 3

assertNotNullFunction · 0.85
wasmS128ConstFunction · 0.85
wasmI32ConstFunction · 0.70

Tested by

no test coverage detected