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

Unified Diff: src/wasm/ast-decoder.cc

Issue 2385393002: [wasm] Implement I32x4ReplaceLane, I32x4Add, I32x4Sub. (Closed)
Patch Set: Bill's review Created 4 years, 1 month 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
Index: src/wasm/ast-decoder.cc
diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc
index a869206e5be5f49aa7e95b6cb50bafa0ba67d15c..594ad7af48d44477de7aace1af2100d9bc2efa02 100644
--- a/src/wasm/ast-decoder.cc
+++ b/src/wasm/ast-decoder.cc
@@ -1331,16 +1331,35 @@ class WasmFullDecoder : public WasmDecoder {
unsigned ExtractLane(WasmOpcode opcode, LocalType type) {
LaneOperand operand(this, pc_);
if (Validate(pc_, operand)) {
- TFNode* input = Pop(0, LocalType::kSimd128).node;
- TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input);
+ compiler::NodeVector inputs(2, zone_);
+ inputs[1] = builder_->Int32Constant(operand.lane);
+ inputs[0] = Pop(0, LocalType::kSimd128).node;
+ TFNode* node = BUILD(SimdOp, opcode, inputs);
Push(type, node);
}
return operand.length;
}
+ unsigned ReplaceLane(WasmOpcode opcode, LocalType type) {
+ LaneOperand operand(this, pc_);
+ if (Validate(pc_, operand)) {
+ compiler::NodeVector inputs(3, zone_);
+ inputs[2] = Pop(1, type).node;
+ inputs[1] = builder_->Int32Constant(operand.lane);
+ inputs[0] = Pop(0, LocalType::kSimd128).node;
+ TFNode* node = BUILD(SimdOp, opcode, inputs);
+ Push(LocalType::kSimd128, node);
+ }
+ return operand.length;
+ }
+
unsigned DecodeSimdOpcode(WasmOpcode opcode) {
unsigned len = 0;
switch (opcode) {
+ case kExprI32x4ReplaceLane: {
+ len = ReplaceLane(opcode, LocalType::kWord32);
+ break;
+ }
case kExprI32x4ExtractLane: {
len = ExtractLane(opcode, LocalType::kWord32);
break;

Powered by Google App Engine
This is Rietveld 408576698