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

Side by Side 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, 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 unified diff | 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 »
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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 int DecodeStoreMem(LocalType type, MachineType mem_type) { 1283 int DecodeStoreMem(LocalType type, MachineType mem_type) {
1284 MemoryAccessOperand operand(this, pc_, 1284 MemoryAccessOperand operand(this, pc_,
1285 ElementSizeLog2Of(mem_type.representation())); 1285 ElementSizeLog2Of(mem_type.representation()));
1286 Value val = Pop(1, type); 1286 Value val = Pop(1, type);
1287 Value index = Pop(0, kAstI32); 1287 Value index = Pop(0, kAstI32);
1288 BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment, 1288 BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment,
1289 val.node, position()); 1289 val.node, position());
1290 return 1 + operand.length; 1290 return 1 + operand.length;
1291 } 1291 }
1292 1292
1293 uint8_t LaneValue(uint8_t max_lanes) {
1294 uint8_t lane = this->checked_read_u8(pc_, 2, "lane number");
1295 if (lane < 0 || lane > (max_lanes - 1)) {
1296 error(pc_, pc_ + 2, "invalid Simd128 lane value");
1297 }
1298 return lane;
1299 }
1300
1293 unsigned ExtractLane(WasmOpcode opcode, LocalType type) { 1301 unsigned ExtractLane(WasmOpcode opcode, LocalType type) {
1294 LaneOperand operand(this, pc_); 1302 LaneOperand operand(this, pc_);
1295 if (Validate(pc_, operand)) { 1303 if (Validate(pc_, operand)) {
1296 TFNode* input = Pop(0, LocalType::kSimd128).node; 1304 TFNode* input = Pop(0, LocalType::kSimd128).node;
1297 TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input); 1305 TFNode* node = BUILD(SimdExtractLane, opcode, operand.lane, input);
1298 Push(type, node); 1306 Push(type, node);
1299 } 1307 }
1300 return operand.length; 1308 return operand.length;
1301 } 1309 }
1302 1310
1303 unsigned DecodeSimdOpcode(WasmOpcode opcode) { 1311 unsigned DecodeSimdOpcode(WasmOpcode opcode) {
1304 unsigned len = 0; 1312 unsigned len = 0;
1313 static const int kInt32x4MaxLanes = 4;
1305 switch (opcode) { 1314 switch (opcode) {
1315 case kExprI32x4ReplaceLane: {
1316 compiler::NodeVector inputs(3, zone_);
1317 inputs[2] = Pop(1, LocalType::kWord32).node;
1318 inputs[1] = builder_->Int32Constant(LaneValue(kInt32x4MaxLanes));
1319 inputs[0] = Pop(0, LocalType::kSimd128).node;
1320 TFNode* node = BUILD(SimdOp, opcode, inputs);
1321 Push(LocalType::kSimd128, node);
1322 len++;
1323 break;
1324 }
1306 case kExprI32x4ExtractLane: { 1325 case kExprI32x4ExtractLane: {
1307 len = ExtractLane(opcode, LocalType::kWord32); 1326 len = ExtractLane(opcode, LocalType::kWord32);
1308 break; 1327 break;
1309 } 1328 }
1310 case kExprF32x4ExtractLane: { 1329 case kExprF32x4ExtractLane: {
1311 len = ExtractLane(opcode, LocalType::kFloat32); 1330 len = ExtractLane(opcode, LocalType::kFloat32);
1312 break; 1331 break;
1313 } 1332 }
1314 default: { 1333 default: {
1315 FunctionSig* sig = WasmOpcodes::Signature(opcode); 1334 FunctionSig* sig = WasmOpcodes::Signature(opcode);
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2018 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
2000 const byte* start, const byte* end) { 2019 const byte* start, const byte* end) {
2001 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 2020 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
2002 WasmFullDecoder decoder(zone, nullptr, body); 2021 WasmFullDecoder decoder(zone, nullptr, body);
2003 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 2022 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
2004 } 2023 }
2005 2024
2006 } // namespace wasm 2025 } // namespace wasm
2007 } // namespace internal 2026 } // namespace internal
2008 } // namespace v8 2027 } // namespace v8
OLDNEW
« 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