summaryrefslogtreecommitdiff
path: root/src/passes/Print.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2019-09-23 18:15:14 -0700
committerGitHub <noreply@github.com>2019-09-23 18:15:14 -0700
commit835581f58eb5040656243f7345ebcacf6d7deee5 (patch)
treed5f8878015be2edcdf3d69306c0a8bc20ecd9bf6 /src/passes/Print.cpp
parentfb217c80c6d9c4b52d90571c435fc52dc868df47 (diff)
downloadbinaryen-835581f58eb5040656243f7345ebcacf6d7deee5.tar.gz
binaryen-835581f58eb5040656243f7345ebcacf6d7deee5.tar.bz2
binaryen-835581f58eb5040656243f7345ebcacf6d7deee5.zip
vNxM.load_splat instructions (#2350)
Introduces a new instruction class, `SIMDLoad`. Implements encoding, decoding, parsing, printing, and interpretation of the load and splat instructions, including in the C and JS APIs. `v128.load` remains in the `Load` instruction class for now because the interpreter code expects a `Load` to be able to load any memory value type.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r--src/passes/Print.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index f8f5c1a56..afdb12444 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -391,6 +391,30 @@ struct PrintExpressionContents
break;
}
}
+ void visitSIMDLoad(SIMDLoad* curr) {
+ prepareColor(o);
+ switch (curr->op) {
+ case LoadSplatVec8x16:
+ o << "v8x16.load_splat";
+ break;
+ case LoadSplatVec16x8:
+ o << "v16x8.load_splat";
+ break;
+ case LoadSplatVec32x4:
+ o << "v32x4.load_splat";
+ break;
+ case LoadSplatVec64x2:
+ o << "v64x2.load_splat";
+ break;
+ }
+ restoreNormalColor(o);
+ if (curr->offset) {
+ o << " offset=" << curr->offset;
+ }
+ if (curr->align != curr->getMemBytes()) {
+ o << " align=" << curr->align;
+ }
+ }
void visitMemoryInit(MemoryInit* curr) {
prepareColor(o);
o << "memory.init " << curr->segment;
@@ -1604,6 +1628,13 @@ struct PrintSExpression : public OverriddenVisitor<PrintSExpression> {
printFullLine(curr->shift);
decIndent();
}
+ void visitSIMDLoad(SIMDLoad* curr) {
+ o << '(';
+ PrintExpressionContents(currFunction, o).visit(curr);
+ incIndent();
+ printFullLine(curr->ptr);
+ decIndent();
+ }
void visitMemoryInit(MemoryInit* curr) {
o << '(';
PrintExpressionContents(currFunction, o).visit(curr);