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

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: Whitespace. 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
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 if (!CpuFeatures::IsSupported(SSE4_1)) {
Benedikt Meurer 2014/10/30 11:59:12 I think this should be DCHECK(CpuFeatures::IsSuppo
sigurds 2014/10/30 12:18:26 Done.
609 UNSUPPORTED_OPERATOR(node);
610 }
611 VisitRRFloat64(this, kSSEFloat64Floor, node);
612 }
613
614
615 void InstructionSelector::VisitFloat64Ceil(Node* node) {
616 if (!CpuFeatures::IsSupported(SSE4_1)) {
Benedikt Meurer 2014/10/30 11:59:13 I think this should be DCHECK(CpuFeatures::IsSuppo
sigurds 2014/10/30 12:18:26 Done.
617 UNSUPPORTED_OPERATOR(node);
618 }
619 VisitRRFloat64(this, kSSEFloat64Ceil, node);
620 }
621
622
623 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) {
624 if (!CpuFeatures::IsSupported(SSE4_1)) {
Benedikt Meurer 2014/10/30 11:59:12 I think this should be DCHECK(CpuFeatures::IsSuppo
sigurds 2014/10/30 12:18:26 Done.
625 UNSUPPORTED_OPERATOR(node);
626 }
627 VisitRRFloat64(this, kSSEFloat64RoundTruncate, node);
628 }
629
630
631 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
632 UNSUPPORTED_OPERATOR(node);
633 }
634
635
599 void InstructionSelector::VisitCall(Node* node) { 636 void InstructionSelector::VisitCall(Node* node) {
600 IA32OperandGenerator g(this); 637 IA32OperandGenerator g(this);
601 CallDescriptor* descriptor = OpParameter<CallDescriptor*>(node); 638 CallDescriptor* descriptor = OpParameter<CallDescriptor*>(node);
602 639
603 FrameStateDescriptor* frame_state_descriptor = NULL; 640 FrameStateDescriptor* frame_state_descriptor = NULL;
604 641
605 if (descriptor->NeedsFrameState()) { 642 if (descriptor->NeedsFrameState()) {
606 frame_state_descriptor = 643 frame_state_descriptor =
607 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); 644 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount()));
608 } 645 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 911
875 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { 912 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) {
876 FlagsContinuation cont(kUnorderedLessThanOrEqual, node); 913 FlagsContinuation cont(kUnorderedLessThanOrEqual, node);
877 VisitFloat64Compare(this, node, &cont); 914 VisitFloat64Compare(this, node, &cont);
878 } 915 }
879 916
880 917
881 // static 918 // static
882 MachineOperatorBuilder::Flags 919 MachineOperatorBuilder::Flags
883 InstructionSelector::SupportedMachineOperatorFlags() { 920 InstructionSelector::SupportedMachineOperatorFlags() {
884 return MachineOperatorBuilder::kNoFlags; 921 if (CpuFeatures::IsSupported(SSE4_1)) {
922 return MachineOperatorBuilder::kFloat64Floor |
923 MachineOperatorBuilder::kFloat64Ceil |
924 MachineOperatorBuilder::kFloat64RoundTruncate;
925 }
926 return MachineOperatorBuilder::Flag::kNoFlags;
885 } 927 }
886
887 } // namespace compiler 928 } // namespace compiler
888 } // namespace internal 929 } // namespace internal
889 } // namespace v8 930 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698