summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2017-09-06 14:13:29 -0700
committerGitHub <noreply@github.com>2017-09-06 14:13:29 -0700
commitd2a401d27ef3592638e0e7689eebed317966334a (patch)
tree13f627f7cd3aaeb20ac1708ad1bf244bf7ec07c4 /src/wasm/wasm-s-parser.cpp
parent192b59a8bc8e5376ca120dc592d5abad7c654230 (diff)
downloadbinaryen-d2a401d27ef3592638e0e7689eebed317966334a.tar.gz
binaryen-d2a401d27ef3592638e0e7689eebed317966334a.tar.bz2
binaryen-d2a401d27ef3592638e0e7689eebed317966334a.zip
Add support for sign-extension operators from threading proposal (#1167)
These are not atomic operations, but are added with the atomic operations to keep from having to define atomic versions of all the sign-extending loads (an atomic zero-extending load + signext operation can be used instead).
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index fd7c7e7ae..a95b551ea 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -699,7 +699,12 @@ Expression* SExpressionWasmBuilder::makeExpression(Element& s) {
if (op[2] == 0) return makeBinary(s, BINARY_INT_OR_FLOAT(Eq), type);
if (op[2] == 'z') return makeUnary(s, type == i32 ? UnaryOp::EqZInt32 : UnaryOp::EqZInt64, type);
}
- if (op[1] == 'x') return makeUnary(s, op[7] == 'u' ? UnaryOp::ExtendUInt32 : UnaryOp::ExtendSInt32, type);
+ if (op[1] == 'x') {
+ if (op[6] == '8') return makeUnary(s, type == i32 ? UnaryOp::ExtendS8Int32 : UnaryOp::ExtendS8Int64, type);
+ if (op[6] == '1') return makeUnary(s, type == i32 ? UnaryOp::ExtendS16Int32 : UnaryOp::ExtendS16Int64, type);
+ if (op[6] == '3') return makeUnary(s, UnaryOp::ExtendS32Int64, type);
+ return makeUnary(s, op[7] == 'u' ? UnaryOp::ExtendUInt32 : UnaryOp::ExtendSInt32, type);
+ }
abort_on(op);
}
case 'f': {
@@ -920,6 +925,8 @@ Expression* SExpressionWasmBuilder::makeUnary(Element& s, UnaryOp op, WasmType t
break;
}
case ExtendSInt32: case ExtendUInt32:
+ case ExtendS8Int32: case ExtendS16Int32:
+ case ExtendS8Int64: case ExtendS16Int64: case ExtendS32Int64:
case WrapInt64:
case PromoteFloat32:
case DemoteFloat64: