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

Side by Side Diff: src/wasm/ast-decoder.cc

Issue 2498283002: [wasm] implement simd lowering for replaceLane, load, store and test for phi (Closed)
Patch Set: [wasm] implement simd lowering for replaceLane, load, store and test for phi Created 4 years 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 unified diff | Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/signature.h" 5 #include "src/signature.h"
6 6
7 #include "src/bit-vector.h" 7 #include "src/bit-vector.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/zone/zone-containers.h" 10 #include "src/zone/zone-containers.h"
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 unsigned ExtractLane(WasmOpcode opcode, LocalType type) { 1331 unsigned ExtractLane(WasmOpcode opcode, LocalType type) {
1332 LaneOperand operand(this, pc_); 1332 LaneOperand operand(this, pc_);
1333 if (Validate(pc_, operand)) { 1333 if (Validate(pc_, operand)) {
1334 TFNode* input = Pop(0, LocalType::kSimd128).node; 1334 TFNode* input = Pop(0, LocalType::kSimd128).node;
1335 TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input); 1335 TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input);
1336 Push(type, node); 1336 Push(type, node);
1337 } 1337 }
1338 return operand.length; 1338 return operand.length;
1339 } 1339 }
1340 1340
1341 unsigned ReplaceLane(WasmOpcode opcode, LocalType type) {
1342 LaneOperand operand(this, pc_);
1343 if (Validate(pc_, operand)) {
1344 TFNode* input = Pop(0, LocalType::kSimd128).node;
1345 TFNode* replacement = Pop(1, type).node;
1346 TFNode* node =
1347 BUILD(SimdReplaceLane, opcode, operand.lane, input, replacement);
1348 Push(LocalType::kSimd128, node);
1349 }
1350 return operand.length;
1351 }
1352
1341 unsigned DecodeSimdOpcode(WasmOpcode opcode) { 1353 unsigned DecodeSimdOpcode(WasmOpcode opcode) {
1342 unsigned len = 0; 1354 unsigned len = 0;
1343 switch (opcode) { 1355 switch (opcode) {
1344 case kExprI32x4ExtractLane: { 1356 case kExprI32x4ExtractLane: {
1345 len = ExtractLane(opcode, LocalType::kWord32); 1357 len = ExtractLane(opcode, LocalType::kWord32);
1346 break; 1358 break;
1347 } 1359 }
1348 case kExprF32x4ExtractLane: { 1360 case kExprF32x4ExtractLane: {
1349 len = ExtractLane(opcode, LocalType::kFloat32); 1361 len = ExtractLane(opcode, LocalType::kFloat32);
1350 break; 1362 break;
1351 } 1363 }
1364 case kExprI32x4ReplaceLane: {
1365 len = ReplaceLane(opcode, LocalType::kWord32);
1366 break;
1367 }
1368 case kExprF32x4ReplaceLane: {
1369 len = ReplaceLane(opcode, LocalType::kFloat32);
1370 break;
1371 }
1352 default: { 1372 default: {
1353 FunctionSig* sig = WasmOpcodes::Signature(opcode); 1373 FunctionSig* sig = WasmOpcodes::Signature(opcode);
1354 if (sig != nullptr) { 1374 if (sig != nullptr) {
1355 compiler::NodeVector inputs(sig->parameter_count(), zone_); 1375 compiler::NodeVector inputs(sig->parameter_count(), zone_);
1356 for (size_t i = sig->parameter_count(); i > 0; i--) { 1376 for (size_t i = sig->parameter_count(); i > 0; i--) {
1357 Value val = Pop(static_cast<int>(i - 1), sig->GetParam(i - 1)); 1377 Value val = Pop(static_cast<int>(i - 1), sig->GetParam(i - 1));
1358 inputs[i - 1] = val.node; 1378 inputs[i - 1] = val.node;
1359 } 1379 }
1360 TFNode* node = BUILD(SimdOp, opcode, inputs); 1380 TFNode* node = BUILD(SimdOp, opcode, inputs);
1361 Push(GetReturnType(sig), node); 1381 Push(GetReturnType(sig), node);
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2058 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
2039 const byte* start, const byte* end) { 2059 const byte* start, const byte* end) {
2040 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 2060 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
2041 WasmFullDecoder decoder(zone, nullptr, body); 2061 WasmFullDecoder decoder(zone, nullptr, body);
2042 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 2062 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
2043 } 2063 }
2044 2064
2045 } // namespace wasm 2065 } // namespace wasm
2046 } // namespace internal 2066 } // namespace internal
2047 } // namespace v8 2067 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698