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

Side by Side Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 729853005: Generalize ScaledWithOffsetMatcher to support 64 bits (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix addressing mode Created 6 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/node-matchers.h ('k') | test/unittests/compiler/node-matchers-unittest.cc » ('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/generic-node-inl.h" 5 #include "src/compiler/generic-node-inl.h"
6 #include "src/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 inputs[(*input_count)++] = g->UseImmediate(constant); 381 inputs[(*input_count)++] = g->UseImmediate(constant);
382 static const AddressingMode kMRnI_modes[] = {kMode_MR1I, kMode_MR2I, 382 static const AddressingMode kMRnI_modes[] = {kMode_MR1I, kMode_MR2I,
383 kMode_MR4I, kMode_MR8I}; 383 kMode_MR4I, kMode_MR8I};
384 mode = kMRnI_modes[scale_exponent]; 384 mode = kMRnI_modes[scale_exponent];
385 } else { 385 } else {
386 static const AddressingMode kMRn_modes[] = {kMode_MR1, kMode_MR2, 386 static const AddressingMode kMRn_modes[] = {kMode_MR1, kMode_MR2,
387 kMode_MR4, kMode_MR8}; 387 kMode_MR4, kMode_MR8};
388 mode = kMRn_modes[scale_exponent]; 388 mode = kMRn_modes[scale_exponent];
389 } 389 }
390 } else { 390 } else {
391 DCHECK(constant != NULL); 391 if (constant == NULL) {
392 inputs[(*input_count)++] = g->UseImmediate(constant); 392 mode = kMode_MR;
393 mode = kMode_MRI; 393 } else {
394 inputs[(*input_count)++] = g->UseImmediate(constant);
395 mode = kMode_MRI;
396 }
394 } 397 }
395 } else { 398 } else {
396 DCHECK(scaled != NULL); 399 DCHECK(scaled != NULL);
397 DCHECK(scale_exponent >= 0 && scale_exponent <= 3); 400 DCHECK(scale_exponent >= 0 && scale_exponent <= 3);
398 inputs[(*input_count)++] = g->UseRegister(scaled); 401 inputs[(*input_count)++] = g->UseRegister(scaled);
399 if (constant != NULL) { 402 if (constant != NULL) {
400 inputs[(*input_count)++] = g->UseImmediate(constant); 403 inputs[(*input_count)++] = g->UseImmediate(constant);
401 static const AddressingMode kMnI_modes[] = {kMode_M1I, kMode_M2I, 404 static const AddressingMode kMnI_modes[] = {kMode_M1I, kMode_M2I,
402 kMode_M4I, kMode_M8I}; 405 kMode_M4I, kMode_M8I};
403 mode = kMnI_modes[scale_exponent]; 406 mode = kMnI_modes[scale_exponent];
404 } else { 407 } else {
405 static const AddressingMode kMn_modes[] = {kMode_M1, kMode_M2, kMode_M4, 408 static const AddressingMode kMn_modes[] = {kMode_M1, kMode_M2, kMode_M4,
406 kMode_M8}; 409 kMode_M8};
407 mode = kMn_modes[scale_exponent]; 410 mode = kMn_modes[scale_exponent];
408 } 411 }
409 } 412 }
410 return mode; 413 return mode;
411 } 414 }
412 415
413 } // namespace 416 } // namespace
414 417
415 418
416 void InstructionSelector::VisitInt32Add(Node* node) { 419 void InstructionSelector::VisitInt32Add(Node* node) {
417 // Try to match the Add to a leal pattern 420 // Try to match the Add to a leal pattern
418 ScaledWithOffsetMatcher m(node); 421 ScaledWithOffset32Matcher m(node);
419 X64OperandGenerator g(this); 422 X64OperandGenerator g(this);
420 if (m.matches() && (m.constant() == NULL || g.CanBeImmediate(m.constant()))) { 423 if (m.matches() && (m.constant() == NULL || g.CanBeImmediate(m.constant()))) {
421 InstructionOperand* inputs[4]; 424 InstructionOperand* inputs[4];
422 size_t input_count = 0; 425 size_t input_count = 0;
423 426
424 AddressingMode mode = GenerateMemoryOperandInputs( 427 AddressingMode mode = GenerateMemoryOperandInputs(
425 &g, m.scaled(), m.scale_exponent(), m.offset(), m.constant(), inputs, 428 &g, m.scaled(), m.scale_exponent(), m.offset(), m.constant(), inputs,
426 &input_count); 429 &input_count);
427 430
428 DCHECK_NE(0, static_cast<int>(input_count)); 431 DCHECK_NE(0, static_cast<int>(input_count));
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 if (CpuFeatures::IsSupported(SSE4_1)) { 1157 if (CpuFeatures::IsSupported(SSE4_1)) {
1155 return MachineOperatorBuilder::kFloat64Floor | 1158 return MachineOperatorBuilder::kFloat64Floor |
1156 MachineOperatorBuilder::kFloat64Ceil | 1159 MachineOperatorBuilder::kFloat64Ceil |
1157 MachineOperatorBuilder::kFloat64RoundTruncate; 1160 MachineOperatorBuilder::kFloat64RoundTruncate;
1158 } 1161 }
1159 return MachineOperatorBuilder::kNoFlags; 1162 return MachineOperatorBuilder::kNoFlags;
1160 } 1163 }
1161 } // namespace compiler 1164 } // namespace compiler
1162 } // namespace internal 1165 } // namespace internal
1163 } // namespace v8 1166 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/node-matchers.h ('k') | test/unittests/compiler/node-matchers-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698