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

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

Issue 998503002: MIPS: [turbofan] Unify Math.floor / Math.ceil optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/compiler/mips64/instruction-codes-mips64.h ('k') | no next file » | 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/base/bits.h" 5 #include "src/base/bits.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 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 Emit(kMips64CvtSD, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); 574 Emit(kMips64CvtSD, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
575 } 575 }
576 576
577 577
578 void InstructionSelector::VisitFloat64Add(Node* node) { 578 void InstructionSelector::VisitFloat64Add(Node* node) {
579 VisitRRR(this, kMips64AddD, node); 579 VisitRRR(this, kMips64AddD, node);
580 } 580 }
581 581
582 582
583 void InstructionSelector::VisitFloat64Sub(Node* node) { 583 void InstructionSelector::VisitFloat64Sub(Node* node) {
584 Mips64OperandGenerator g(this);
585 Float64BinopMatcher m(node);
586 if (m.left().IsMinusZero() && m.right().IsFloat64RoundDown() &&
587 CanCover(m.node(), m.right().node())) {
588 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub &&
589 CanCover(m.right().node(), m.right().InputAt(0))) {
590 Float64BinopMatcher mright0(m.right().InputAt(0));
591 if (mright0.left().IsMinusZero()) {
592 Emit(kMips64Float64RoundUp, g.DefineAsRegister(node),
593 g.UseRegister(mright0.right().node()));
594 return;
595 }
596 }
597 }
584 VisitRRR(this, kMips64SubD, node); 598 VisitRRR(this, kMips64SubD, node);
585 } 599 }
586 600
587 601
588 void InstructionSelector::VisitFloat64Mul(Node* node) { 602 void InstructionSelector::VisitFloat64Mul(Node* node) {
589 VisitRRR(this, kMips64MulD, node); 603 VisitRRR(this, kMips64MulD, node);
590 } 604 }
591 605
592 606
593 void InstructionSelector::VisitFloat64Div(Node* node) { 607 void InstructionSelector::VisitFloat64Div(Node* node) {
594 VisitRRR(this, kMips64DivD, node); 608 VisitRRR(this, kMips64DivD, node);
595 } 609 }
596 610
597 611
598 void InstructionSelector::VisitFloat64Mod(Node* node) { 612 void InstructionSelector::VisitFloat64Mod(Node* node) {
599 Mips64OperandGenerator g(this); 613 Mips64OperandGenerator g(this);
600 Emit(kMips64ModD, g.DefineAsFixed(node, f0), 614 Emit(kMips64ModD, g.DefineAsFixed(node, f0),
601 g.UseFixed(node->InputAt(0), f12), 615 g.UseFixed(node->InputAt(0), f12),
602 g.UseFixed(node->InputAt(1), f14))->MarkAsCall(); 616 g.UseFixed(node->InputAt(1), f14))->MarkAsCall();
603 } 617 }
604 618
605 619
606 void InstructionSelector::VisitFloat64Sqrt(Node* node) { 620 void InstructionSelector::VisitFloat64Sqrt(Node* node) {
607 Mips64OperandGenerator g(this); 621 Mips64OperandGenerator g(this);
608 Emit(kMips64SqrtD, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); 622 Emit(kMips64SqrtD, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
609 } 623 }
610 624
611 625
612 void InstructionSelector::VisitFloat64Floor(Node* node) { 626 void InstructionSelector::VisitFloat64RoundDown(Node* node) {
613 VisitRR(this, kMips64Float64Floor, node); 627 VisitRR(this, kMips64Float64RoundDown, node);
614 } 628 }
615 629
616 630
617 void InstructionSelector::VisitFloat64Ceil(Node* node) {
618 VisitRR(this, kMips64Float64Ceil, node);
619 }
620
621
622 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { 631 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) {
623 VisitRR(this, kMips64Float64RoundTruncate, node); 632 VisitRR(this, kMips64Float64RoundTruncate, node);
624 } 633 }
625 634
626 635
627 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { 636 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
628 UNREACHABLE(); 637 UNREACHABLE();
629 } 638 }
630 639
631 640
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 Node* left = node->InputAt(0); 1174 Node* left = node->InputAt(0);
1166 Node* right = node->InputAt(1); 1175 Node* right = node->InputAt(1);
1167 Emit(kMips64FmoveHighDUw, g.DefineSameAsFirst(node), g.UseRegister(left), 1176 Emit(kMips64FmoveHighDUw, g.DefineSameAsFirst(node), g.UseRegister(left),
1168 g.UseRegister(right)); 1177 g.UseRegister(right));
1169 } 1178 }
1170 1179
1171 1180
1172 // static 1181 // static
1173 MachineOperatorBuilder::Flags 1182 MachineOperatorBuilder::Flags
1174 InstructionSelector::SupportedMachineOperatorFlags() { 1183 InstructionSelector::SupportedMachineOperatorFlags() {
1175 return MachineOperatorBuilder::kFloat64Floor | 1184 return MachineOperatorBuilder::kFloat64RoundDown |
1176 MachineOperatorBuilder::kFloat64Ceil |
1177 MachineOperatorBuilder::kFloat64RoundTruncate; 1185 MachineOperatorBuilder::kFloat64RoundTruncate;
1178 } 1186 }
1179 1187
1180 } // namespace compiler 1188 } // namespace compiler
1181 } // namespace internal 1189 } // namespace internal
1182 } // namespace v8 1190 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips64/instruction-codes-mips64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698