diff options
author | dcode <dcode@dcode.io> | 2023-02-07 23:24:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-07 14:24:53 -0800 |
commit | cfda51c6c87267a7f42a28165bc8cce43f41621e (patch) | |
tree | 64aefefca5b9e0facfbbb205a93198702e88e25f /test/example | |
parent | 90c726a606cf8f99307a41d8f889de4e1221c4f8 (diff) | |
download | binaryen-cfda51c6c87267a7f42a28165bc8cce43f41621e.tar.gz binaryen-cfda51c6c87267a7f42a28165bc8cce43f41621e.tar.bz2 binaryen-cfda51c6c87267a7f42a28165bc8cce43f41621e.zip |
[C API] Add relaxed SIMD operations (#5482)
Exposes the constants
**Unary**
* BinaryenRelaxedTruncSVecF32x4ToVecI32x4
* BinaryenRelaxedTruncSVecF32x4ToVecI32x4
* BinaryenRelaxedTruncZeroSVecF64x2ToVecI32x4
* BinaryenRelaxedTruncZeroUVecF64x2ToVecI32x4
**Binary**
* BinaryenRelaxedSwizzleVecI8x16
* BinaryenRelaxedMinVecF32x4
* BinaryenRelaxedMaxVecF32x4
* BinaryenRelaxedMinVecF64x2
* BinaryenRelaxedMaxVecF64x2
* BinaryenRelaxedQ15MulrSVecI16x8
* BinaryenDotI8x16I7x16SToVecI16x8
**SIMDTernary**
* BinaryenRelaxedFmaVecF32x4
* BinaryenRelaxedFmsVecF32x4
* BinaryenRelaxedFmaVecF64x2
* BinaryenRelaxedFmsVecF64x2
* BinaryenLaneselectI8x16
* BinaryenLaneselectI16x8
* BinaryenLaneselectI32x4
* BinaryenLaneselectI64x2
* BinaryenDotI8x16I7x16AddSToVecI32x4
so the respective instructions can be produced and inspected with the C API.
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 20 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 125 |
2 files changed, 145 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 4a1f53e3c..a8d07d717 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -647,6 +647,10 @@ void test_core() { makeUnary(module, BinaryenTruncSatZeroUVecF64x2ToVecI32x4(), v128), makeUnary(module, BinaryenDemoteZeroVecF64x2ToVecF32x4(), v128), makeUnary(module, BinaryenPromoteLowVecF32x4ToVecF64x2(), v128), + makeUnary(module, BinaryenRelaxedTruncSVecF32x4ToVecI32x4(), v128), + makeUnary(module, BinaryenRelaxedTruncUVecF32x4ToVecI32x4(), v128), + makeUnary(module, BinaryenRelaxedTruncZeroSVecF64x2ToVecI32x4(), v128), + makeUnary(module, BinaryenRelaxedTruncZeroUVecF64x2ToVecI32x4(), v128), // Binary makeBinary(module, BinaryenAddInt32(), i32), makeBinary(module, BinaryenSubFloat64(), f64), @@ -812,6 +816,13 @@ void test_core() { makeBinary(module, BinaryenNarrowSVecI32x4ToVecI16x8(), v128), makeBinary(module, BinaryenNarrowUVecI32x4ToVecI16x8(), v128), makeBinary(module, BinaryenSwizzleVecI8x16(), v128), + makeBinary(module, BinaryenRelaxedSwizzleVecI8x16(), v128), + makeBinary(module, BinaryenRelaxedMinVecF32x4(), v128), + makeBinary(module, BinaryenRelaxedMaxVecF32x4(), v128), + makeBinary(module, BinaryenRelaxedMinVecF64x2(), v128), + makeBinary(module, BinaryenRelaxedMaxVecF64x2(), v128), + makeBinary(module, BinaryenRelaxedQ15MulrSVecI16x8(), v128), + makeBinary(module, BinaryenDotI8x16I7x16SToVecI16x8(), v128), // SIMD lane manipulation makeSIMDExtract(module, BinaryenExtractLaneSVecI8x16()), makeSIMDExtract(module, BinaryenExtractLaneUVecI8x16()), @@ -933,6 +944,15 @@ void test_core() { // Other SIMD makeSIMDShuffle(module), makeSIMDTernary(module, BinaryenBitselectVec128()), + makeSIMDTernary(module, BinaryenRelaxedFmaVecF32x4()), + makeSIMDTernary(module, BinaryenRelaxedFmsVecF32x4()), + makeSIMDTernary(module, BinaryenRelaxedFmaVecF64x2()), + makeSIMDTernary(module, BinaryenRelaxedFmsVecF64x2()), + makeSIMDTernary(module, BinaryenLaneselectI8x16()), + makeSIMDTernary(module, BinaryenLaneselectI16x8()), + makeSIMDTernary(module, BinaryenLaneselectI32x4()), + makeSIMDTernary(module, BinaryenLaneselectI64x2()), + makeSIMDTernary(module, BinaryenDotI8x16I7x16AddSToVecI32x4()), // Bulk memory makeMemoryInit(module), makeDataDrop(module), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index bd0d0e16f..ecfdfc081 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -592,6 +592,26 @@ BinaryenFeatureAll: 126975 ) ) (drop + (i32x4.relaxed_trunc_f32x4_s + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i32x4.relaxed_trunc_f32x4_u + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i32x4.relaxed_trunc_f64x2_s_zero + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i32x4.relaxed_trunc_f64x2_u_zero + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop (i32.add (i32.const -10) (i32.const -11) @@ -1564,6 +1584,48 @@ BinaryenFeatureAll: 126975 ) ) (drop + (i8x16.relaxed_swizzle + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.relaxed_min + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.relaxed_max + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.relaxed_min + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.relaxed_max + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i16x8.relaxed_q15mulr_s + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i16x8.dot_i8x16_i7x16_s + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop (i8x16.extract_lane_s 0 (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) ) @@ -1824,6 +1886,69 @@ BinaryenFeatureAll: 126975 (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) ) ) + (drop + (f32x4.relaxed_fma + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f32x4.relaxed_fms + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.relaxed_fma + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (f64x2.relaxed_fms + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i8x16.laneselect + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i16x8.laneselect + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i32x4.laneselect + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i64x2.laneselect + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) + (drop + (i32x4.dot_i8x16_i7x16_add_s + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + (v128.const i32x4 0x04030201 0x08070605 0x0c0b0a09 0x100f0e0d) + ) + ) (memory.init 0 (i32.const 1024) (i32.const 0) |