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

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

Issue 2454193002: [Turbofan] SIMD tests for Int32x4Add, Sub, ReplaceLane. (Closed)
Patch Set: Pass expected value in to Wasm code. Created 4 years, 2 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/x64/instruction-selector-x64.cc ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/ast-decoder.cc
diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc
index 84b64d6d8ddf3d02306fbe94d6f1c90abbb17aae..bd9a07de920081ee5ba7a826a0682aeac679b9e5 100644
--- a/src/wasm/ast-decoder.cc
+++ b/src/wasm/ast-decoder.cc
@@ -1290,6 +1290,14 @@ class WasmFullDecoder : public WasmDecoder {
return 1 + operand.length;
}
+ uint8_t LaneValue(uint8_t max_lanes) {
+ uint8_t lane = this->checked_read_u8(pc_, 2, "lane number");
+ if (lane < 0 || lane > (max_lanes - 1)) {
+ error(pc_, pc_ + 2, "invalid Simd128 lane value");
+ }
+ return lane;
+ }
+
unsigned ExtractLane(WasmOpcode opcode, LocalType type) {
LaneOperand operand(this, pc_);
if (Validate(pc_, operand)) {
@@ -1302,7 +1310,18 @@ class WasmFullDecoder : public WasmDecoder {
unsigned DecodeSimdOpcode(WasmOpcode opcode) {
unsigned len = 0;
+ static const int kInt32x4MaxLanes = 4;
switch (opcode) {
+ case kExprI32x4ReplaceLane: {
+ compiler::NodeVector inputs(3, zone_);
+ inputs[2] = Pop(1, LocalType::kWord32).node;
+ inputs[1] = builder_->Int32Constant(LaneValue(kInt32x4MaxLanes));
+ inputs[0] = Pop(0, LocalType::kSimd128).node;
+ TFNode* node = BUILD(SimdOp, opcode, inputs);
+ Push(LocalType::kSimd128, node);
+ len++;
+ break;
+ }
case kExprI32x4ExtractLane: {
len = ExtractLane(opcode, LocalType::kWord32);
break;
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698