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

Side by Side Diff: src/compiler/move-optimizer.cc

Issue 2092103004: [Turbofan] Add Simd128 registers to RegisterConfiguration. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Eliminate some dead code, simplify. Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/arm64/assembler-arm64.h ('k') | src/compiler/register-allocator.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/move-optimizer.h" 5 #include "src/compiler/move-optimizer.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 14 matching lines...) Expand all
25 }; 25 };
26 26
27 typedef ZoneMap<MoveKey, unsigned, MoveKeyCompare> MoveMap; 27 typedef ZoneMap<MoveKey, unsigned, MoveKeyCompare> MoveMap;
28 typedef ZoneSet<InstructionOperand, CompareOperandModuloType> OperandSet; 28 typedef ZoneSet<InstructionOperand, CompareOperandModuloType> OperandSet;
29 29
30 bool Blocks(const OperandSet& set, const InstructionOperand& operand) { 30 bool Blocks(const OperandSet& set, const InstructionOperand& operand) {
31 if (set.find(operand) != set.end()) return true; 31 if (set.find(operand) != set.end()) return true;
32 // Only FP registers on archs with non-simple aliasing need extra checks. 32 // Only FP registers on archs with non-simple aliasing need extra checks.
33 if (!operand.IsFPRegister() || kSimpleFPAliasing) return false; 33 if (!operand.IsFPRegister() || kSimpleFPAliasing) return false;
34 34
35 // Check operand against operands of other FP types for interference.
35 const LocationOperand& loc = LocationOperand::cast(operand); 36 const LocationOperand& loc = LocationOperand::cast(operand);
36 MachineRepresentation rep = loc.representation(); 37 MachineRepresentation rep = loc.representation();
37 MachineRepresentation other_fp_rep = rep == MachineRepresentation::kFloat64 38 MachineRepresentation other_rep1, other_rep2;
38 ? MachineRepresentation::kFloat32 39 switch (rep) {
39 : MachineRepresentation::kFloat64; 40 case MachineRepresentation::kFloat32:
41 other_rep1 = MachineRepresentation::kFloat64;
42 other_rep2 = MachineRepresentation::kSimd128;
43 break;
44 case MachineRepresentation::kFloat64:
45 other_rep1 = MachineRepresentation::kFloat32;
46 other_rep2 = MachineRepresentation::kSimd128;
47 break;
48 case MachineRepresentation::kSimd128:
49 other_rep1 = MachineRepresentation::kFloat32;
50 other_rep2 = MachineRepresentation::kFloat64;
51 break;
52 default:
53 UNREACHABLE();
54 break;
55 }
40 const RegisterConfiguration* config = RegisterConfiguration::Turbofan(); 56 const RegisterConfiguration* config = RegisterConfiguration::Turbofan();
41 if (config->fp_aliasing_kind() != RegisterConfiguration::COMBINE) { 57 int base = -1;
42 // Overlap aliasing case. 58 int aliases = config->GetAliases(rep, loc.register_code(), other_rep1, &base);
43 return set.find(LocationOperand(loc.kind(), loc.location_kind(), 59 DCHECK(aliases > 0 || (aliases == 0 && base == -1));
44 other_fp_rep, loc.register_code())) != 60 while (aliases--) {
45 set.end(); 61 if (set.find(LocationOperand(loc.kind(), loc.location_kind(), other_rep1,
62 base + aliases)) != set.end())
63 return true;
46 } 64 }
47 // Combine aliasing case. 65 aliases = config->GetAliases(rep, loc.register_code(), other_rep2, &base);
48 int alias_base_index = -1; 66 DCHECK(aliases > 0 || (aliases == 0 && base == -1));
49 int aliases = config->GetAliases(rep, loc.register_code(), other_fp_rep,
50 &alias_base_index);
51 while (aliases--) { 67 while (aliases--) {
52 int aliased_reg = alias_base_index + aliases; 68 if (set.find(LocationOperand(loc.kind(), loc.location_kind(), other_rep2,
53 if (set.find(LocationOperand(loc.kind(), loc.location_kind(), other_fp_rep, 69 base + aliases)) != set.end())
54 aliased_reg)) != set.end())
55 return true; 70 return true;
56 } 71 }
57 return false; 72 return false;
58 } 73 }
59 74
60 int FindFirstNonEmptySlot(const Instruction* instr) { 75 int FindFirstNonEmptySlot(const Instruction* instr) {
61 int i = Instruction::FIRST_GAP_POSITION; 76 int i = Instruction::FIRST_GAP_POSITION;
62 for (; i <= Instruction::LAST_GAP_POSITION; i++) { 77 for (; i <= Instruction::LAST_GAP_POSITION; i++) {
63 ParallelMove* moves = instr->parallel_moves()[i]; 78 ParallelMove* moves = instr->parallel_moves()[i];
64 if (moves == nullptr) continue; 79 if (moves == nullptr) continue;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 static_cast<Instruction::GapPosition>(1), code_zone()); 515 static_cast<Instruction::GapPosition>(1), code_zone());
501 slot_1->AddMove(group_begin->destination(), load->destination()); 516 slot_1->AddMove(group_begin->destination(), load->destination());
502 load->Eliminate(); 517 load->Eliminate();
503 } 518 }
504 loads.clear(); 519 loads.clear();
505 } 520 }
506 521
507 } // namespace compiler 522 } // namespace compiler
508 } // namespace internal 523 } // namespace internal
509 } // namespace v8 524 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/assembler-arm64.h ('k') | src/compiler/register-allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698