diff options
author | Daniel Wirtz <dcode@dcode.io> | 2021-04-08 23:50:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 23:50:51 +0200 |
commit | 0efebfe68cb0e2759b88093e1811d034ef3e8a79 (patch) | |
tree | a676971fc2f671ea6817b2e218ef440d7847a827 /test | |
parent | 6921dd30dc82b3df2511def7c941f4a1a9aeeec2 (diff) | |
download | binaryen-0efebfe68cb0e2759b88093e1811d034ef3e8a79.tar.gz binaryen-0efebfe68cb0e2759b88093e1811d034ef3e8a79.tar.bz2 binaryen-0efebfe68cb0e2759b88093e1811d034ef3e8a79.zip |
Add v128.load/storeN_lane SIMD instructions to C/JS API (#3784)
Adds C/JS APIs for the SIMD instructions
* Load8LaneVec128 (was LoadLaneVec8x16)
* Load16LaneVec128 (was LoadLaneVec16x8)
* Load32LaneVec128 (was LoadLaneVec32x4)
* Load64LaneVec128 (was LoadLaneVec64x2)
* Store8LaneVec128 (was StoreLaneVec8x16)
* Store16LaneVec128 (was StoreLaneVec16x8)
* Store32LaneVec128 (was StoreLaneVec32x4)
* Store64LaneVec128 (was StoreLaneVec64x2)
Diffstat (limited to 'test')
-rw-r--r-- | test/binaryen.js/kitchen-sink.js | 17 | ||||
-rw-r--r-- | test/binaryen.js/kitchen-sink.js.txt | 160 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 58 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 40 |
4 files changed, 275 insertions, 0 deletions
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 76193b0bf..0798741cf 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -517,6 +517,23 @@ function test_core() { module.v128.load32x2_u(0, 8, module.i32.const(128)), module.v128.load32_zero(0, 4, module.i32.const(128)), module.v128.load64_zero(0, 8, module.i32.const(128)), + // SIMD load/store lane + module.v128.load8_lane(0, 1, 0, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.load8_lane(1, 1, 15, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.load16_lane(0, 2, 0, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.load16_lane(2, 1, 7, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.load32_lane(0, 4, 0, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.load32_lane(4, 2, 3, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.load64_lane(0, 8, 0, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.load64_lane(8, 4, 1, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.store8_lane(0, 1, 0, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.store8_lane(1, 1, 15, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.store16_lane(0, 2, 0, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.store16_lane(2, 1, 7, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.store32_lane(0, 4, 0, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.store32_lane(4, 2, 3, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.store64_lane(0, 8, 0, module.i32.const(128), module.v128.const(v128_bytes)), + module.v128.store64_lane(8, 4, 1, module.i32.const(128), module.v128.const(v128_bytes)), // Other SIMD module.i8x16.shuffle(module.v128.const(v128_bytes), module.v128.const(v128_bytes), v128_bytes), module.v128.bitselect(module.v128.const(v128_bytes), module.v128.const(v128_bytes), module.v128.const(v128_bytes)), diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index c835fe299..623a8207c 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -1812,6 +1812,86 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) ) (drop + (v128.load8_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load8_lane offset=1 15 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load16_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load16_lane offset=2 align=1 7 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load32_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load32_lane offset=4 align=2 3 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load64_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load64_lane offset=8 align=4 1 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (v128.store8_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store8_lane offset=1 15 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store16_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store16_lane offset=2 align=1 7 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store32_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store32_lane offset=4 align=2 3 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store64_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store64_lane offset=8 align=4 1 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (drop (i8x16.shuffle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) @@ -3824,6 +3904,86 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) ) (drop + (v128.load8_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load8_lane offset=1 15 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load16_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load16_lane offset=2 align=1 7 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load32_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load32_lane offset=4 align=2 3 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load64_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load64_lane offset=8 align=4 1 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (v128.store8_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store8_lane offset=1 15 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store16_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store16_lane offset=2 align=1 7 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store32_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store32_lane offset=4 align=2 3 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store64_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store64_lane offset=8 align=4 1 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (drop (i8x16.shuffle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index bbffb1ea2..2dc167adc 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -685,6 +685,64 @@ void test_core() { 0, 8, makeInt32(module, 128)), + // SIMD load/store lane + BinaryenSIMDLoadStoreLane(module, + BinaryenLoad8LaneVec128(), + 0, + 1, + 0, + makeInt32(module, 128), + makeVec128(module, v128_bytes)), + BinaryenSIMDLoadStoreLane(module, + BinaryenLoad16LaneVec128(), + 0, + 2, + 0, + makeInt32(module, 128), + makeVec128(module, v128_bytes)), + BinaryenSIMDLoadStoreLane(module, + BinaryenLoad32LaneVec128(), + 0, + 4, + 0, + makeInt32(module, 128), + makeVec128(module, v128_bytes)), + BinaryenSIMDLoadStoreLane(module, + BinaryenLoad64LaneVec128(), + 0, + 8, + 0, + makeInt32(module, 128), + makeVec128(module, v128_bytes)), + + BinaryenSIMDLoadStoreLane(module, + BinaryenStore8LaneVec128(), + 0, + 1, + 0, + makeInt32(module, 128), + makeVec128(module, v128_bytes)), + BinaryenSIMDLoadStoreLane(module, + BinaryenStore16LaneVec128(), + 0, + 2, + 0, + makeInt32(module, 128), + makeVec128(module, v128_bytes)), + BinaryenSIMDLoadStoreLane(module, + BinaryenStore32LaneVec128(), + 0, + 4, + 0, + makeInt32(module, 128), + makeVec128(module, v128_bytes)), + BinaryenSIMDLoadStoreLane(module, + BinaryenStore64LaneVec128(), + 0, + 8, + 0, + makeInt32(module, 128), + makeVec128(module, v128_bytes)), // Other SIMD makeSIMDShuffle(module), makeSIMDTernary(module, BinaryenBitselectVec128()), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 16dde8c00..0bdec4c37 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1722,6 +1722,46 @@ BinaryenFeatureAll: 8191 ) ) (drop + (v128.load8_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load16_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load32_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (v128.load64_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (v128.store8_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store16_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store32_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (v128.store64_lane 0 + (i32.const 128) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + (drop (i8x16.shuffle 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) |