summaryrefslogtreecommitdiff
path: root/src/wat-writer.cc
diff options
context:
space:
mode:
authornlewycky <nick@wasmer.io>2019-07-19 15:32:54 -0700
committerBen Smith <binji@chromium.org>2019-07-19 15:32:54 -0700
commitc36c95d34aacced046314d444f89e1cd07fa4ba2 (patch)
treeeb825ce5bf790e8e6768987090394bdb01edc45d /src/wat-writer.cc
parent3ae2f6df453206ff80f35958b7ab4a1583395dc3 (diff)
downloadwabt-c36c95d34aacced046314d444f89e1cd07fa4ba2.tar.gz
wabt-c36c95d34aacced046314d444f89e1cd07fa4ba2.tar.bz2
wabt-c36c95d34aacced046314d444f89e1cd07fa4ba2.zip
Add support for v8x16.swizzle and the load_splats. (#1116)
* Add support for v8x16.shuffle1 and v8x16.shuffle2_imm. v8x16.shuffle2_imm is a rename of the previous v8x16.shuffle, but I add a copy of the code as if it were a new instruction in case the spec proposal makes further changes. The tests for old v8x16.shuffle remain in place and while there are new tests for the new v8x16.shuffle1, there are not for v8x16.shuffle2_imm. The behaviour and implementation are the same as for v8x16.shuffle, so we should simply search and replace the existing tests at some point, leaving one of them untested, probably the deprecated v8x16.shuffle. I did test v8x16.shuffle1 against the SIMD spec test from WAVM and it passes. The WAVM spec tests for v8x16.shuffle2_imm parse but it has no invocations of the instruction. * Rename v8x16.shuffle1 and x8v16.shuffle2_imm to v8x16.swizzle and v8x16.shuffle_imm. * Update SIMD operands. * Swizzle is just a binary operator. * Shuffle is named "v8x16.shuffle". * Add 4 new opcodes for load_splat. * Remove legacy 0xfd 0x03 opcode for shuffle. * Test all four load splats.
Diffstat (limited to 'src/wat-writer.cc')
-rw-r--r--src/wat-writer.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wat-writer.cc b/src/wat-writer.cc
index 10fa9eb2..8a9d08d4 100644
--- a/src/wat-writer.cc
+++ b/src/wat-writer.cc
@@ -579,6 +579,7 @@ class WatWriter::ExprVisitorDelegate : public ExprVisitor::Delegate {
Result OnTernaryExpr(TernaryExpr*) override;
Result OnSimdLaneOpExpr(SimdLaneOpExpr*) override;
Result OnSimdShuffleOpExpr(SimdShuffleOpExpr*) override;
+ Result OnLoadSplatExpr(LoadSplatExpr*) override;
private:
WatWriter* writer_;
@@ -952,6 +953,11 @@ Result WatWriter::ExprVisitorDelegate::OnSimdShuffleOpExpr(
return Result::Ok;
}
+Result WatWriter::ExprVisitorDelegate::OnLoadSplatExpr(LoadSplatExpr* expr) {
+ writer_->WriteLoadStoreExpr<LoadSplatExpr>(expr);
+ return Result::Ok;
+}
+
void WatWriter::WriteExpr(const Expr* expr) {
WABT_TRACE(WriteExprList);
ExprVisitorDelegate delegate(this);