Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: src/wasm/function-body-decoder.cc

Issue 2801183002: [WASM SIMD] Implement primitive shuffles. (Closed)
Patch Set: Fix non-ARM build. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/function-body-decoder-impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/function-body-decoder.cc
diff --git a/src/wasm/function-body-decoder.cc b/src/wasm/function-body-decoder.cc
index cf7d92f88cd6f191b0260f83dc04f3a899186c88..a583d40cdfb77f2b1d5c703a5fd37f46dde294a6 100644
--- a/src/wasm/function-body-decoder.cc
+++ b/src/wasm/function-body-decoder.cc
@@ -411,6 +411,17 @@ class WasmDecoder : public Decoder {
}
}
+ inline bool Validate(const byte* pc, WasmOpcode opcode,
+ SimdConcatOperand<true>& operand) {
+ DCHECK_EQ(wasm::kExprS8x16Concat, opcode);
+ if (operand.bytes <= 0 || operand.bytes >= kSimd128Size) {
+ error(pc_ + 2, "invalid byte amount");
+ return false;
+ } else {
+ return true;
+ }
+ }
+
static unsigned OpcodeLength(Decoder* decoder, const byte* pc) {
switch (static_cast<byte>(*pc)) {
#define DECLARE_OPCODE_CASE(name, opcode, sig) case kExpr##name:
@@ -1475,6 +1486,19 @@ class WasmFullDecoder : public WasmDecoder {
return operand.length;
}
+ unsigned SimdConcatOp(WasmOpcode opcode) {
+ DCHECK_EQ(wasm::kExprS8x16Concat, opcode);
+ SimdConcatOperand<true> operand(this, pc_);
+ if (Validate(pc_, opcode, operand)) {
+ compiler::NodeVector inputs(2, zone_);
+ inputs[1] = Pop(1, ValueType::kSimd128).node;
+ inputs[0] = Pop(0, ValueType::kSimd128).node;
+ TFNode* node = BUILD(SimdConcatOp, operand.bytes, inputs);
+ Push(ValueType::kSimd128, node);
+ }
+ return operand.length;
+ }
+
unsigned DecodeSimdOpcode(WasmOpcode opcode) {
unsigned len = 0;
switch (opcode) {
@@ -1510,6 +1534,10 @@ class WasmFullDecoder : public WasmDecoder {
len = SimdShiftOp(opcode);
break;
}
+ case kExprS8x16Concat: {
+ len = SimdConcatOp(opcode);
+ break;
+ }
default: {
FunctionSig* sig = WasmOpcodes::Signature(opcode);
if (sig != nullptr) {
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/function-body-decoder-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698