diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-09-03 14:13:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-03 14:13:29 -0700 |
commit | 0faa68b9dfbe478c6d238a5c55ac61b54a86a3c3 (patch) | |
tree | 9ca1c6e09858ebcefb0dc14f60c95293fb6976ef /test/example/c-api-kitchen-sink.c | |
parent | 445881f6c8a28faae22a764c96449be86b48a96b (diff) | |
download | binaryen-0faa68b9dfbe478c6d238a5c55ac61b54a86a3c3.tar.gz binaryen-0faa68b9dfbe478c6d238a5c55ac61b54a86a3c3.tar.bz2 binaryen-0faa68b9dfbe478c6d238a5c55ac61b54a86a3c3.zip |
QFMA/QFMS instructions (#2328)
Renames the SIMDBitselect class to SIMDTernary and adds the new
{f32x4,f64x2}.qfm{a,s} ternary instructions. Because the SIMDBitselect
class is no more, this is a backwards-incompatible change to the C
interface. The new instructions are not yet used in the fuzzer because
they are not yet implemented in V8.
The corresponding LLVM commit is https://reviews.llvm.org/rL370556.
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 65 |
1 files changed, 40 insertions, 25 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 95bc398b5..ad61ca528 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -109,11 +109,11 @@ BinaryenExpressionRef makeSIMDShuffle(BinaryenModuleRef module) { return BinaryenSIMDShuffle(module, left, right, (uint8_t[16]) {}); } -BinaryenExpressionRef makeSIMDBitselect(BinaryenModuleRef module) { - BinaryenExpressionRef left = makeVec128(module, v128_bytes); - BinaryenExpressionRef right = makeVec128(module, v128_bytes); - BinaryenExpressionRef cond = makeVec128(module, v128_bytes); - return BinaryenSIMDBitselect(module, left, right, cond); +BinaryenExpressionRef makeSIMDTernary(BinaryenModuleRef module, BinaryenOp op) { + BinaryenExpressionRef a = makeVec128(module, v128_bytes); + BinaryenExpressionRef b = makeVec128(module, v128_bytes); + BinaryenExpressionRef c = makeVec128(module, v128_bytes); + return BinaryenSIMDTernary(module, op, a, b, c); } BinaryenExpressionRef makeSIMDShift(BinaryenModuleRef module, BinaryenOp op) { @@ -472,7 +472,11 @@ void test_core() { makeSIMDShift(module, BinaryenShrUVecI64x2()), // Other SIMD makeSIMDShuffle(module), - makeSIMDBitselect(module), + makeSIMDTernary(module, BinaryenBitselectVec128()), + makeSIMDTernary(module, BinaryenQFMAVecF32x4()), + makeSIMDTernary(module, BinaryenQFMSVecF32x4()), + makeSIMDTernary(module, BinaryenQFMAVecF64x2()), + makeSIMDTernary(module, BinaryenQFMSVecF64x2()), // Bulk memory makeMemoryInit(module), makeDataDrop(module), @@ -489,19 +493,27 @@ void test_core() { BinaryenBreak(module, "the-value", NULL, makeInt32(module, 3)), BinaryenBreak(module, "the-nothing", NULL, NULL), BinaryenSwitch(module, switchValueNames, 1, "the-value", temp8, temp9), - BinaryenSwitch(module, switchBodyNames, 1, "the-nothing", makeInt32(module, 2), NULL), - BinaryenUnary(module, BinaryenEqZInt32(), // check the output type of the call node - BinaryenCall(module, "kitchen()sinker", callOperands4, 4, BinaryenTypeInt32()) - ), - BinaryenUnary(module, BinaryenEqZInt32(), // check the output type of the call node - BinaryenUnary(module, - BinaryenTruncSFloat32ToInt32(), - BinaryenCall(module, "an-imported", callOperands2, 2, BinaryenTypeFloat32()) - ) - ), - BinaryenUnary(module, BinaryenEqZInt32(), // check the output type of the call node - BinaryenCallIndirect(module, makeInt32(module, 2449), callOperands4b, 4, "iiIfF") - ), + BinaryenSwitch( + module, switchBodyNames, 1, "the-nothing", makeInt32(module, 2), NULL), + BinaryenUnary( + module, + BinaryenEqZInt32(), // check the output type of the call node + BinaryenCall( + module, "kitchen()sinker", callOperands4, 4, BinaryenTypeInt32())), + BinaryenUnary(module, + BinaryenEqZInt32(), // check the output type of the call node + BinaryenUnary(module, + BinaryenTruncSFloat32ToInt32(), + BinaryenCall(module, + "an-imported", + callOperands2, + 2, + BinaryenTypeFloat32()))), + BinaryenUnary( + module, + BinaryenEqZInt32(), // check the output type of the call node + BinaryenCallIndirect( + module, makeInt32(module, 2449), callOperands4b, 4, "iiIfF")), BinaryenDrop(module, BinaryenLocalGet(module, 0, BinaryenTypeInt32())), BinaryenLocalSet(module, 0, makeInt32(module, 101)), BinaryenDrop(module, BinaryenLocalTee(module, 0, makeInt32(module, 102))), @@ -523,13 +535,16 @@ void test_core() { // Exception handling BinaryenTry(module, tryBody, catchBody), // Atomics - BinaryenAtomicStore(module, 4, 0, temp6, + BinaryenAtomicStore( + module, + 4, + 0, + temp6, BinaryenAtomicLoad(module, 4, 0, BinaryenTypeInt32(), temp6), - BinaryenTypeInt32() - ), - BinaryenDrop(module, - BinaryenAtomicWait(module, temp6, temp6, temp16, BinaryenTypeInt32()) - ), + BinaryenTypeInt32()), + BinaryenDrop( + module, + BinaryenAtomicWait(module, temp6, temp6, temp16, BinaryenTypeInt32())), BinaryenDrop(module, BinaryenAtomicNotify(module, temp6, temp6)), BinaryenAtomicFence(module), |