summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-stack.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-01-06 14:36:27 -0500
committerGitHub <noreply@github.com>2021-01-06 11:36:27 -0800
commit3d414652d36aeb27896cc6666ef15db39f245786 (patch)
tree695c7bc5a3c47dff0330b625f2e61cb040accc6d /src/wasm/wasm-stack.cpp
parentb79661ee03fc74b3f860bf04e6f1019f7b11c722 (diff)
downloadbinaryen-3d414652d36aeb27896cc6666ef15db39f245786.tar.gz
binaryen-3d414652d36aeb27896cc6666ef15db39f245786.tar.bz2
binaryen-3d414652d36aeb27896cc6666ef15db39f245786.zip
Prototype prefetch instructions (#3467)
As proposed in https://github.com/WebAssembly/simd/pull/352, using the opcodes used in the LLVM and V8 implementations.
Diffstat (limited to 'src/wasm/wasm-stack.cpp')
-rw-r--r--src/wasm/wasm-stack.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp
index 776928b88..b31aaf4d4 100644
--- a/src/wasm/wasm-stack.cpp
+++ b/src/wasm/wasm-stack.cpp
@@ -694,6 +694,20 @@ void BinaryInstWriter::visitSIMDLoadStoreLane(SIMDLoadStoreLane* curr) {
o << curr->index;
}
+void BinaryInstWriter::visitPrefetch(Prefetch* curr) {
+ o << int8_t(BinaryConsts::SIMDPrefix);
+ switch (curr->op) {
+ case PrefetchTemporal:
+ o << U32LEB(BinaryConsts::PrefetchT);
+ break;
+ case PrefetchNontemporal:
+ o << U32LEB(BinaryConsts::PrefetchNT);
+ break;
+ }
+ assert(curr->align);
+ emitMemoryAccess(curr->align, /*(unused) bytes=*/0, curr->offset);
+}
+
void BinaryInstWriter::visitMemoryInit(MemoryInit* curr) {
o << int8_t(BinaryConsts::MiscPrefix);
o << U32LEB(BinaryConsts::MemoryInit);