diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2018-12-13 17:40:27 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-13 17:40:27 -0800 |
commit | 3325a9cc203932e58b6e85dfefe5feb6e72839a4 (patch) | |
tree | 1d969ab30854fd773fdc615d799c9a9ed7e9c0be /src/wasm-builder.h | |
parent | 0fd96e6b07f0a0907737c0f44e55060e057c2bb9 (diff) | |
download | binaryen-3325a9cc203932e58b6e85dfefe5feb6e72839a4.tar.gz binaryen-3325a9cc203932e58b6e85dfefe5feb6e72839a4.tar.bz2 binaryen-3325a9cc203932e58b6e85dfefe5feb6e72839a4.zip |
SIMD (#1820)
Implement and test the following functionality for SIMD.
- Parsing and printing
- Assembling and disassembling
- Interpretation
- C API
- JS API
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r-- | src/wasm-builder.h | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h index f36ec7a88..dccefa144 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -293,6 +293,47 @@ public: ret->finalize(); return ret; } + SIMDExtract* makeSIMDExtract(SIMDExtractOp op, Expression* vec, uint8_t idx) { + auto* ret = allocator.alloc<SIMDExtract>(); + ret->op = op; + ret->vec = vec; + ret->idx = idx; + ret->finalize(); + return ret; + } + SIMDReplace* makeSIMDReplace(SIMDReplaceOp op, Expression* vec, uint8_t idx, Expression* value) { + auto* ret = allocator.alloc<SIMDReplace>(); + ret->op = op; + ret->vec = vec; + ret->idx = idx; + ret->value = value; + ret->finalize(); + return ret; + } + SIMDShuffle* makeSIMDShuffle(Expression* left, Expression* right, const std::array<uint8_t, 16>& mask) { + auto* ret = allocator.alloc<SIMDShuffle>(); + ret->left = left; + ret->right = right; + ret->mask = mask; + ret->finalize(); + return ret; + } + SIMDBitselect* makeSIMDBitselect(Expression* left, Expression* right, Expression* cond) { + auto* ret = allocator.alloc<SIMDBitselect>(); + ret->left = left; + ret->right = right; + ret->cond = cond; + ret->finalize(); + return ret; + } + SIMDShift* makeSIMDShift(SIMDShiftOp op, Expression* vec, Expression* shift) { + auto* ret = allocator.alloc<SIMDShift>(); + ret->op = op; + ret->vec = vec; + ret->shift = shift; + ret->finalize(); + return ret; + } Const* makeConst(Literal value) { assert(isConcreteType(value.type)); auto* ret = allocator.alloc<Const>(); @@ -474,7 +515,12 @@ public: case i64: value = Literal(int64_t(0)); break; case f32: value = Literal(float(0)); break; case f64: value = Literal(double(0)); break; - case v128: assert(false && "v128 not implemented yet"); + case v128: { + std::array<uint8_t, 16> bytes; + bytes.fill(0); + value = Literal(bytes.data()); + break; + } case none: return ExpressionManipulator::nop(curr); case unreachable: return ExpressionManipulator::convert<T, Unreachable>(curr); } |