OLD | NEW |
---|---|
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/compiler/simd-scalar-lowering.h" | 5 #include "src/compiler/simd-scalar-lowering.h" |
6 #include "src/compiler/diamond.h" | 6 #include "src/compiler/diamond.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 } | 67 } |
68 state_.Set(input, State::kOnStack); | 68 state_.Set(input, State::kOnStack); |
69 } | 69 } |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 #define FOREACH_INT32X4_OPCODE(V) \ | 74 #define FOREACH_INT32X4_OPCODE(V) \ |
75 V(Int32x4Add) \ | 75 V(Int32x4Add) \ |
76 V(Int32x4ExtractLane) \ | 76 V(Int32x4ExtractLane) \ |
77 V(CreateInt32x4) \ | 77 V(Int32x4Splat) \ |
78 V(Int32x4ReplaceLane) | 78 V(Int32x4ReplaceLane) |
79 | 79 |
80 #define FOREACH_FLOAT32X4_OPCODE(V) \ | 80 #define FOREACH_FLOAT32X4_OPCODE(V) \ |
81 V(Float32x4Add) \ | 81 V(Float32x4Add) \ |
82 V(Float32x4ExtractLane) \ | 82 V(Float32x4ExtractLane) \ |
83 V(CreateFloat32x4) \ | 83 V(Float32x4Splat) \ |
84 V(Float32x4ReplaceLane) | 84 V(Float32x4ReplaceLane) |
85 | 85 |
86 void SimdScalarLowering::SetLoweredType(Node* node, Node* output) { | 86 void SimdScalarLowering::SetLoweredType(Node* node, Node* output) { |
87 switch (node->opcode()) { | 87 switch (node->opcode()) { |
88 #define CASE_STMT(name) case IrOpcode::k##name: | 88 #define CASE_STMT(name) case IrOpcode::k##name: |
89 FOREACH_INT32X4_OPCODE(CASE_STMT) | 89 FOREACH_INT32X4_OPCODE(CASE_STMT) |
90 case IrOpcode::kReturn: | 90 case IrOpcode::kReturn: |
91 case IrOpcode::kParameter: | 91 case IrOpcode::kParameter: |
92 case IrOpcode::kCall: { | 92 case IrOpcode::kCall: { |
93 replacements_[node->id()].type = SimdType::kInt32; | 93 replacements_[node->id()].type = SimdType::kInt32; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 break; | 378 break; |
379 } | 379 } |
380 case IrOpcode::kInt32x4Add: { | 380 case IrOpcode::kInt32x4Add: { |
381 LowerBinaryOp(node, rep_type, machine()->Int32Add()); | 381 LowerBinaryOp(node, rep_type, machine()->Int32Add()); |
382 break; | 382 break; |
383 } | 383 } |
384 case IrOpcode::kFloat32x4Add: { | 384 case IrOpcode::kFloat32x4Add: { |
385 LowerBinaryOp(node, rep_type, machine()->Float32Add()); | 385 LowerBinaryOp(node, rep_type, machine()->Float32Add()); |
386 break; | 386 break; |
387 } | 387 } |
388 case IrOpcode::kCreateInt32x4: | 388 case IrOpcode::kInt32x4Splat: |
389 case IrOpcode::kCreateFloat32x4: { | 389 case IrOpcode::kFloat32x4Splat: { |
390 Node* rep_node[kMaxLanes]; | 390 Node* rep_node[kMaxLanes]; |
391 for (int i = 0; i < kMaxLanes; ++i) { | 391 for (int i = 0; i < kMaxLanes; ++i) { |
392 if (HasReplacement(0, node->InputAt(i))) { | 392 if (HasReplacement(0, node->InputAt(0))) { |
393 rep_node[i] = GetReplacements(node->InputAt(i))[0]; | 393 rep_node[i] = GetReplacements(node->InputAt(0))[0]; |
394 } else { | 394 } else { |
395 rep_node[i] = node->InputAt(i); | 395 rep_node[i] = node->InputAt(0); |
bbudge
2017/02/24 13:23:47
Aseem, I wasn't sure what to do here. This seemed
| |
396 } | 396 } |
397 } | 397 } |
398 ReplaceNode(node, rep_node); | 398 ReplaceNode(node, rep_node); |
399 break; | 399 break; |
400 } | 400 } |
401 case IrOpcode::kInt32x4ExtractLane: | 401 case IrOpcode::kInt32x4ExtractLane: |
402 case IrOpcode::kFloat32x4ExtractLane: { | 402 case IrOpcode::kFloat32x4ExtractLane: { |
403 int32_t lane = OpParameter<int32_t>(node); | 403 int32_t lane = OpParameter<int32_t>(node); |
404 Node* rep_node[kMaxLanes] = { | 404 Node* rep_node[kMaxLanes] = { |
405 GetReplacementsWithType(node->InputAt(0), rep_type)[lane], nullptr, | 405 GetReplacementsWithType(node->InputAt(0), rep_type)[lane], nullptr, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
528 } else { | 528 } else { |
529 UNREACHABLE(); | 529 UNREACHABLE(); |
530 } | 530 } |
531 } | 531 } |
532 ReplaceNode(phi, rep_nodes); | 532 ReplaceNode(phi, rep_nodes); |
533 } | 533 } |
534 } | 534 } |
535 } // namespace compiler | 535 } // namespace compiler |
536 } // namespace internal | 536 } // namespace internal |
537 } // namespace v8 | 537 } // namespace v8 |
OLD | NEW |