Index: src/compiler/ia32/instruction-selector-ia32.cc |
diff --git a/src/compiler/ia32/instruction-selector-ia32.cc b/src/compiler/ia32/instruction-selector-ia32.cc |
index 090645212e9f16928258f3ce0fa1104dd0fd83ad..b725f2032986663f920dd50e49047f90115399ac 100644 |
--- a/src/compiler/ia32/instruction-selector-ia32.cc |
+++ b/src/compiler/ia32/instruction-selector-ia32.cc |
@@ -861,32 +861,74 @@ void InstructionSelector::VisitFloat64Sqrt(Node* node) { |
void InstructionSelector::VisitFloat32RoundDown(Node* node) { |
- VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundDown)); |
+ if (CpuFeatures::IsSupported(SSE4_1)) { |
+ VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundDown)); |
+ } else { |
+ IA32OperandGenerator g(this); |
+ InstructionOperand temps[] = {g.TempRegister()}; |
+ Emit(kSSEFloat32Round | MiscField::encode(kRoundDown), |
+ g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 1, temps); |
+ } |
} |
void InstructionSelector::VisitFloat64RoundDown(Node* node) { |
- VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundDown)); |
+ if (CpuFeatures::IsSupported(SSE4_1)) { |
+ VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundDown)); |
+ } else { |
+ IA32OperandGenerator g(this); |
+ InstructionOperand temps[] = {g.TempRegister()}; |
+ Emit(kSSEFloat64Round | MiscField::encode(kRoundDown), |
+ g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 1, temps); |
+ } |
} |
void InstructionSelector::VisitFloat32RoundUp(Node* node) { |
- VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundUp)); |
+ if (CpuFeatures::IsSupported(SSE4_1)) { |
+ VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundUp)); |
+ } else { |
+ IA32OperandGenerator g(this); |
+ InstructionOperand temps[] = {g.TempRegister()}; |
+ Emit(kSSEFloat32Round | MiscField::encode(kRoundUp), |
+ g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 1, temps); |
+ } |
} |
void InstructionSelector::VisitFloat64RoundUp(Node* node) { |
- VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundUp)); |
+ if (CpuFeatures::IsSupported(SSE4_1)) { |
+ VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundUp)); |
+ } else { |
+ IA32OperandGenerator g(this); |
+ InstructionOperand temps[] = {g.TempRegister()}; |
+ Emit(kSSEFloat64Round | MiscField::encode(kRoundUp), |
+ g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 1, temps); |
+ } |
} |
void InstructionSelector::VisitFloat32RoundTruncate(Node* node) { |
- VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToZero)); |
+ if (CpuFeatures::IsSupported(SSE4_1)) { |
+ VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToZero)); |
+ } else { |
+ IA32OperandGenerator g(this); |
+ InstructionOperand temps[] = {g.TempRegister()}; |
+ Emit(kSSEFloat32Round | MiscField::encode(kRoundToZero), |
+ g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 1, temps); |
+ } |
} |
void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
- VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToZero)); |
+ if (CpuFeatures::IsSupported(SSE4_1)) { |
+ VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToZero)); |
+ } else { |
+ IA32OperandGenerator g(this); |
+ InstructionOperand temps[] = {g.TempRegister()}; |
+ Emit(kSSEFloat64Round | MiscField::encode(kRoundToZero), |
+ g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 1, temps); |
+ } |
} |
@@ -896,12 +938,26 @@ void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) { |
- VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToNearest)); |
+ if (CpuFeatures::IsSupported(SSE4_1)) { |
+ VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToNearest)); |
+ } else { |
+ IA32OperandGenerator g(this); |
+ InstructionOperand temps[] = {g.TempRegister()}; |
+ Emit(kSSEFloat32Round | MiscField::encode(kRoundToNearest), |
+ g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 1, temps); |
+ } |
} |
void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { |
- VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToNearest)); |
+ if (CpuFeatures::IsSupported(SSE4_1)) { |
+ VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToNearest)); |
+ } else { |
+ IA32OperandGenerator g(this); |
+ InstructionOperand temps[] = {g.TempRegister()}; |
+ Emit(kSSEFloat64Round | MiscField::encode(kRoundToNearest), |
+ g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 1, temps); |
+ } |
} |
@@ -1313,20 +1369,19 @@ InstructionSelector::SupportedMachineOperatorFlags() { |
MachineOperatorBuilder::kFloat64Max | |
MachineOperatorBuilder::kFloat64Min | |
MachineOperatorBuilder::kWord32ShiftIsSafe | |
- MachineOperatorBuilder::kWord32Ctz; |
+ MachineOperatorBuilder::kWord32Ctz | |
+ MachineOperatorBuilder::kFloat32RoundDown | |
+ MachineOperatorBuilder::kFloat32RoundUp | |
+ MachineOperatorBuilder::kFloat32RoundTruncate | |
+ MachineOperatorBuilder::kFloat32RoundTiesEven | |
+ MachineOperatorBuilder::kFloat64RoundDown | |
+ MachineOperatorBuilder::kFloat64RoundUp | |
+ MachineOperatorBuilder::kFloat64RoundTruncate | |
+ MachineOperatorBuilder::kFloat64RoundTiesEven; |
+ |
if (CpuFeatures::IsSupported(POPCNT)) { |
flags |= MachineOperatorBuilder::kWord32Popcnt; |
} |
- if (CpuFeatures::IsSupported(SSE4_1)) { |
- flags |= MachineOperatorBuilder::kFloat32RoundDown | |
- MachineOperatorBuilder::kFloat64RoundDown | |
- MachineOperatorBuilder::kFloat32RoundUp | |
- MachineOperatorBuilder::kFloat64RoundUp | |
- MachineOperatorBuilder::kFloat32RoundTruncate | |
- MachineOperatorBuilder::kFloat64RoundTruncate | |
- MachineOperatorBuilder::kFloat32RoundTiesEven | |
- MachineOperatorBuilder::kFloat64RoundTiesEven; |
- } |
return flags; |
} |