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

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

Issue 677433002: Add floor, ceil, round (truncate) instructions for ia32, x64 (if SSE4.1) and (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address changes and fix compilation on mac. 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 | « src/compiler/ia32/instruction-codes-ia32.h ('k') | src/compiler/instruction-selector.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 #include "src/compiler/node-properties-inl.h" 7 #include "src/compiler/node-properties-inl.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 static const int kMaxInputCount = 3; 137 static const int kMaxInputCount = 3;
138 InstructionOperand* base_operand_; 138 InstructionOperand* base_operand_;
139 InstructionOperand* index_operand_; 139 InstructionOperand* index_operand_;
140 InstructionOperand* displacement_operand_; 140 InstructionOperand* displacement_operand_;
141 AddressingMode mode_; 141 AddressingMode mode_;
142 }; 142 };
143 143
144 144
145 static void VisitRRFloat64(InstructionSelector* selector, ArchOpcode opcode,
146 Node* node) {
147 IA32OperandGenerator g(selector);
148 selector->Emit(opcode, g.DefineAsRegister(node),
149 g.UseRegister(node->InputAt(0)));
150 }
151
152
145 void InstructionSelector::VisitLoad(Node* node) { 153 void InstructionSelector::VisitLoad(Node* node) {
146 MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node)); 154 MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node));
147 MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node)); 155 MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node));
148 Node* base = node->InputAt(0); 156 Node* base = node->InputAt(0);
149 Node* index = node->InputAt(1); 157 Node* index = node->InputAt(1);
150 158
151 ArchOpcode opcode; 159 ArchOpcode opcode;
152 // TODO(titzer): signed/unsigned small loads 160 // TODO(titzer): signed/unsigned small loads
153 switch (rep) { 161 switch (rep) {
154 case kRepFloat32: 162 case kRepFloat32:
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 temps); 597 temps);
590 } 598 }
591 599
592 600
593 void InstructionSelector::VisitFloat64Sqrt(Node* node) { 601 void InstructionSelector::VisitFloat64Sqrt(Node* node) {
594 IA32OperandGenerator g(this); 602 IA32OperandGenerator g(this);
595 Emit(kSSEFloat64Sqrt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 603 Emit(kSSEFloat64Sqrt, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
596 } 604 }
597 605
598 606
607 void InstructionSelector::VisitFloat64Floor(Node* node) {
608 DCHECK(CpuFeatures::IsSupported(SSE4_1));
609 VisitRRFloat64(this, kSSEFloat64Floor, node);
610 }
611
612
613 void InstructionSelector::VisitFloat64Ceil(Node* node) {
614 DCHECK(CpuFeatures::IsSupported(SSE4_1));
615 VisitRRFloat64(this, kSSEFloat64Ceil, node);
616 }
617
618
619 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) {
620 DCHECK(CpuFeatures::IsSupported(SSE4_1));
621 VisitRRFloat64(this, kSSEFloat64RoundTruncate, node);
622 }
623
624
625 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
626 UNREACHABLE();
627 }
628
629
599 void InstructionSelector::VisitCall(Node* node) { 630 void InstructionSelector::VisitCall(Node* node) {
600 IA32OperandGenerator g(this); 631 IA32OperandGenerator g(this);
601 CallDescriptor* descriptor = OpParameter<CallDescriptor*>(node); 632 CallDescriptor* descriptor = OpParameter<CallDescriptor*>(node);
602 633
603 FrameStateDescriptor* frame_state_descriptor = NULL; 634 FrameStateDescriptor* frame_state_descriptor = NULL;
604 635
605 if (descriptor->NeedsFrameState()) { 636 if (descriptor->NeedsFrameState()) {
606 frame_state_descriptor = 637 frame_state_descriptor =
607 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); 638 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount()));
608 } 639 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 905
875 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { 906 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) {
876 FlagsContinuation cont(kUnorderedLessThanOrEqual, node); 907 FlagsContinuation cont(kUnorderedLessThanOrEqual, node);
877 VisitFloat64Compare(this, node, &cont); 908 VisitFloat64Compare(this, node, &cont);
878 } 909 }
879 910
880 911
881 // static 912 // static
882 MachineOperatorBuilder::Flags 913 MachineOperatorBuilder::Flags
883 InstructionSelector::SupportedMachineOperatorFlags() { 914 InstructionSelector::SupportedMachineOperatorFlags() {
884 return MachineOperatorBuilder::kNoFlags; 915 if (CpuFeatures::IsSupported(SSE4_1)) {
916 return MachineOperatorBuilder::kFloat64Floor |
917 MachineOperatorBuilder::kFloat64Ceil |
918 MachineOperatorBuilder::kFloat64RoundTruncate;
919 }
920 return MachineOperatorBuilder::Flag::kNoFlags;
885 } 921 }
886
887 } // namespace compiler 922 } // namespace compiler
888 } // namespace internal 923 } // namespace internal
889 } // namespace v8 924 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/instruction-codes-ia32.h ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698