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

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

Issue 705983002: [turbofan][arm64] Optimize shifts combined with truncations or extensions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/unittests/compiler/arm64/instruction-selector-arm64-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/instruction-selector-impl.h" 5 #include "src/compiler/instruction-selector-impl.h"
6 #include "src/compiler/node-matchers.h" 6 #include "src/compiler/node-matchers.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 CanCover(node, m.right().node()), kLogical64Imm); 535 CanCover(node, m.right().node()), kLogical64Imm);
536 } 536 }
537 537
538 538
539 void InstructionSelector::VisitWord32Shl(Node* node) { 539 void InstructionSelector::VisitWord32Shl(Node* node) {
540 VisitRRO(this, kArm64Lsl32, node, kShift32Imm); 540 VisitRRO(this, kArm64Lsl32, node, kShift32Imm);
541 } 541 }
542 542
543 543
544 void InstructionSelector::VisitWord64Shl(Node* node) { 544 void InstructionSelector::VisitWord64Shl(Node* node) {
545 Arm64OperandGenerator g(this);
546 Int64BinopMatcher m(node);
547 if ((m.left().IsChangeInt32ToInt64() || m.left().IsChangeUint32ToUint64()) &&
548 m.right().IsInRange(32, 63)) {
549 // There's no need to sign/zero-extend to 64-bit if we shift out the upper
550 // 32 bits anyway.
551 Emit(kArm64Lsl, g.DefineAsRegister(node),
552 g.UseRegister(m.left().node()->InputAt(0)),
553 g.UseImmediate(m.right().node()));
554 return;
555 }
545 VisitRRO(this, kArm64Lsl, node, kShift64Imm); 556 VisitRRO(this, kArm64Lsl, node, kShift64Imm);
546 } 557 }
547 558
548 559
549 void InstructionSelector::VisitWord32Shr(Node* node) { 560 void InstructionSelector::VisitWord32Shr(Node* node) {
550 Arm64OperandGenerator g(this); 561 Arm64OperandGenerator g(this);
551 Int32BinopMatcher m(node); 562 Int32BinopMatcher m(node);
552 if (m.left().IsWord32And() && m.right().IsInRange(0, 31)) { 563 if (m.left().IsWord32And() && m.right().IsInRange(0, 31)) {
553 int32_t lsb = m.right().Value(); 564 int32_t lsb = m.right().Value();
554 Int32BinopMatcher mleft(m.left().node()); 565 Int32BinopMatcher mleft(m.left().node());
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 888
878 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { 889 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
879 Arm64OperandGenerator g(this); 890 Arm64OperandGenerator g(this);
880 Emit(kArm64Float64ToFloat32, g.DefineAsRegister(node), 891 Emit(kArm64Float64ToFloat32, g.DefineAsRegister(node),
881 g.UseRegister(node->InputAt(0))); 892 g.UseRegister(node->InputAt(0)));
882 } 893 }
883 894
884 895
885 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { 896 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) {
886 Arm64OperandGenerator g(this); 897 Arm64OperandGenerator g(this);
898 Node* value = node->InputAt(0);
899 if (CanCover(node, value)) {
900 Int64BinopMatcher m(value);
901 if ((m.IsWord64Sar() && m.right().HasValue() &&
902 (m.right().Value() == 32)) ||
903 (m.IsWord64Shr() && m.right().IsInRange(32, 63))) {
904 Emit(kArm64Lsr, g.DefineAsRegister(node), g.UseRegister(m.left().node()),
905 g.UseImmediate(m.right().node()));
906 return;
907 }
908 }
909
887 Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); 910 Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
888 } 911 }
889 912
890 913
891 void InstructionSelector::VisitFloat64Add(Node* node) { 914 void InstructionSelector::VisitFloat64Add(Node* node) {
892 VisitRRRFloat64(this, kArm64Float64Add, node); 915 VisitRRRFloat64(this, kArm64Float64Add, node);
893 } 916 }
894 917
895 918
896 void InstructionSelector::VisitFloat64Sub(Node* node) { 919 void InstructionSelector::VisitFloat64Sub(Node* node) {
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 MachineOperatorBuilder::Flags 1409 MachineOperatorBuilder::Flags
1387 InstructionSelector::SupportedMachineOperatorFlags() { 1410 InstructionSelector::SupportedMachineOperatorFlags() {
1388 return MachineOperatorBuilder::kFloat64Floor | 1411 return MachineOperatorBuilder::kFloat64Floor |
1389 MachineOperatorBuilder::kFloat64Ceil | 1412 MachineOperatorBuilder::kFloat64Ceil |
1390 MachineOperatorBuilder::kFloat64RoundTruncate | 1413 MachineOperatorBuilder::kFloat64RoundTruncate |
1391 MachineOperatorBuilder::kFloat64RoundTiesAway; 1414 MachineOperatorBuilder::kFloat64RoundTiesAway;
1392 } 1415 }
1393 } // namespace compiler 1416 } // namespace compiler
1394 } // namespace internal 1417 } // namespace internal
1395 } // namespace v8 1418 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698