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 5548f55a1e2c88488fbbb840eaa8197858ebf02e..e22aeed81f916b828553ccc2245a4146658232f2 100644 |
--- a/src/compiler/ia32/instruction-selector-ia32.cc |
+++ b/src/compiler/ia32/instruction-selector-ia32.cc |
@@ -771,18 +771,83 @@ void InstructionSelector::VisitWord32Ror(Node* node) { |
VisitShift(this, node, kIA32Ror); |
} |
+#define RO_OP_LIST(V) \ |
+ V(Word32Clz, kIA32Lzcnt) \ |
+ V(Word32Ctz, kIA32Tzcnt) \ |
+ V(Word32Popcnt, kIA32Popcnt) \ |
+ V(ChangeFloat32ToFloat64, kSSEFloat32ToFloat64) \ |
+ V(RoundInt32ToFloat32, kSSEInt32ToFloat32) \ |
+ V(ChangeInt32ToFloat64, kSSEInt32ToFloat64) \ |
+ V(ChangeUint32ToFloat64, kSSEUint32ToFloat64) \ |
+ V(TruncateFloat32ToInt32, kSSEFloat32ToInt32) \ |
+ V(TruncateFloat32ToUint32, kSSEFloat32ToUint32) \ |
+ V(ChangeFloat64ToInt32, kSSEFloat64ToInt32) \ |
+ V(ChangeFloat64ToUint32, kSSEFloat64ToUint32) \ |
+ V(TruncateFloat64ToUint32, kSSEFloat64ToUint32) \ |
+ V(TruncateFloat64ToFloat32, kSSEFloat64ToFloat32) \ |
+ V(RoundFloat64ToInt32, kSSEFloat64ToInt32) \ |
+ V(BitcastFloat32ToInt32, kIA32BitcastFI) \ |
+ V(BitcastInt32ToFloat32, kIA32BitcastIF) \ |
+ V(Float32Sqrt, kSSEFloat32Sqrt) \ |
+ V(Float64Sqrt, kSSEFloat64Sqrt) \ |
+ V(Float64ExtractLowWord32, kSSEFloat64ExtractLowWord32) \ |
+ V(Float64ExtractHighWord32, kSSEFloat64ExtractHighWord32) |
+ |
+#define RR_OP_LIST(V) \ |
+ V(TruncateFloat64ToWord32, kArchTruncateDoubleToI) \ |
+ V(Float32RoundDown, kSSEFloat32Round | MiscField::encode(kRoundDown)) \ |
+ V(Float64RoundDown, kSSEFloat64Round | MiscField::encode(kRoundDown)) \ |
+ V(Float32RoundUp, kSSEFloat32Round | MiscField::encode(kRoundUp)) \ |
+ V(Float64RoundUp, kSSEFloat64Round | MiscField::encode(kRoundUp)) \ |
+ V(Float32RoundTruncate, kSSEFloat32Round | MiscField::encode(kRoundToZero)) \ |
+ V(Float64RoundTruncate, kSSEFloat64Round | MiscField::encode(kRoundToZero)) \ |
+ V(Float32RoundTiesEven, \ |
+ kSSEFloat32Round | MiscField::encode(kRoundToNearest)) \ |
+ V(Float64RoundTiesEven, kSSEFloat64Round | MiscField::encode(kRoundToNearest)) |
+ |
+#define RRO_FLOAT_OP_LIST(V) \ |
+ V(Float32Add, kAVXFloat32Add, kSSEFloat32Add) \ |
+ V(Float64Add, kAVXFloat64Add, kSSEFloat64Add) \ |
+ V(Float32Sub, kAVXFloat32Sub, kSSEFloat32Sub) \ |
+ V(Float64Sub, kAVXFloat64Sub, kSSEFloat64Sub) \ |
+ V(Float32Mul, kAVXFloat32Mul, kSSEFloat32Mul) \ |
+ V(Float64Mul, kAVXFloat64Mul, kSSEFloat64Mul) \ |
+ V(Float32Div, kAVXFloat32Div, kSSEFloat32Div) \ |
+ V(Float64Div, kAVXFloat64Div, kSSEFloat64Div) |
+ |
+#define FLOAT_UNOP_LIST(V) \ |
+ V(Float32Abs, kAVXFloat32Abs, kSSEFloat32Abs) \ |
+ V(Float64Abs, kAVXFloat64Abs, kSSEFloat64Abs) \ |
+ V(Float32Neg, kAVXFloat32Neg, kSSEFloat32Neg) \ |
+ V(Float64Neg, kAVXFloat64Neg, kSSEFloat64Neg) |
+ |
+#define RO_VISITOR(Name, opcode) \ |
+ void InstructionSelector::Visit##Name(Node* node) { \ |
+ VisitRO(this, node, opcode); \ |
+ } |
+RO_OP_LIST(RO_VISITOR) |
+#undef RO_VISITOR |
-void InstructionSelector::VisitWord32Clz(Node* node) { |
- IA32OperandGenerator g(this); |
- Emit(kIA32Lzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
-} |
- |
+#define RR_VISITOR(Name, opcode) \ |
+ void InstructionSelector::Visit##Name(Node* node) { \ |
+ VisitRR(this, node, opcode); \ |
+ } |
+RR_OP_LIST(RR_VISITOR) |
+#undef RR_VISITOR |
-void InstructionSelector::VisitWord32Ctz(Node* node) { |
- IA32OperandGenerator g(this); |
- Emit(kIA32Tzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
-} |
+#define RRO_FLOAT_VISITOR(Name, avx, sse) \ |
+ void InstructionSelector::Visit##Name(Node* node) { \ |
+ VisitRROFloat(this, node, avx, sse); \ |
+ } |
+RRO_FLOAT_OP_LIST(RRO_FLOAT_VISITOR) |
+#undef RRO_FLOAT_VISITOR |
+#define FLOAT_UNOP_VISITOR(Name, avx, sse) \ |
+ void InstructionSelector::Visit##Name(Node* node) { \ |
+ VisitFloatUnop(this, node, node->InputAt(0), avx, sse); \ |
+ } |
+FLOAT_UNOP_LIST(FLOAT_UNOP_VISITOR) |
+#undef FLOAT_UNOP_VISITOR |
void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); } |
@@ -790,12 +855,6 @@ void InstructionSelector::VisitWord64ReverseBytes(Node* node) { UNREACHABLE(); } |
void InstructionSelector::VisitWord32ReverseBytes(Node* node) { UNREACHABLE(); } |
-void InstructionSelector::VisitWord32Popcnt(Node* node) { |
- IA32OperandGenerator g(this); |
- Emit(kIA32Popcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
-} |
- |
- |
void InstructionSelector::VisitInt32Add(Node* node) { |
IA32OperandGenerator g(this); |
@@ -890,16 +949,6 @@ void InstructionSelector::VisitUint32Mod(Node* node) { |
} |
-void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) { |
- VisitRO(this, node, kSSEFloat32ToFloat64); |
-} |
- |
- |
-void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) { |
- VisitRO(this, node, kSSEInt32ToFloat32); |
-} |
- |
- |
void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) { |
IA32OperandGenerator g(this); |
InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; |
@@ -907,103 +956,6 @@ void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) { |
arraysize(temps), temps); |
} |
- |
-void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) { |
- VisitRO(this, node, kSSEInt32ToFloat64); |
-} |
- |
- |
-void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) { |
- VisitRO(this, node, kSSEUint32ToFloat64); |
-} |
- |
- |
-void InstructionSelector::VisitTruncateFloat32ToInt32(Node* node) { |
- VisitRO(this, node, kSSEFloat32ToInt32); |
-} |
- |
- |
-void InstructionSelector::VisitTruncateFloat32ToUint32(Node* node) { |
- VisitRO(this, node, kSSEFloat32ToUint32); |
-} |
- |
- |
-void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) { |
- VisitRO(this, node, kSSEFloat64ToInt32); |
-} |
- |
- |
-void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { |
- VisitRO(this, node, kSSEFloat64ToUint32); |
-} |
- |
-void InstructionSelector::VisitTruncateFloat64ToUint32(Node* node) { |
- VisitRO(this, node, kSSEFloat64ToUint32); |
-} |
- |
-void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { |
- VisitRO(this, node, kSSEFloat64ToFloat32); |
-} |
- |
-void InstructionSelector::VisitTruncateFloat64ToWord32(Node* node) { |
- VisitRR(this, node, kArchTruncateDoubleToI); |
-} |
- |
-void InstructionSelector::VisitRoundFloat64ToInt32(Node* node) { |
- VisitRO(this, node, kSSEFloat64ToInt32); |
-} |
- |
- |
-void InstructionSelector::VisitBitcastFloat32ToInt32(Node* node) { |
- IA32OperandGenerator g(this); |
- Emit(kIA32BitcastFI, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
-} |
- |
- |
-void InstructionSelector::VisitBitcastInt32ToFloat32(Node* node) { |
- IA32OperandGenerator g(this); |
- Emit(kIA32BitcastIF, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
-} |
- |
- |
-void InstructionSelector::VisitFloat32Add(Node* node) { |
- VisitRROFloat(this, node, kAVXFloat32Add, kSSEFloat32Add); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64Add(Node* node) { |
- VisitRROFloat(this, node, kAVXFloat64Add, kSSEFloat64Add); |
-} |
- |
- |
-void InstructionSelector::VisitFloat32Sub(Node* node) { |
- VisitRROFloat(this, node, kAVXFloat32Sub, kSSEFloat32Sub); |
-} |
- |
-void InstructionSelector::VisitFloat64Sub(Node* node) { |
- VisitRROFloat(this, node, kAVXFloat64Sub, kSSEFloat64Sub); |
-} |
- |
-void InstructionSelector::VisitFloat32Mul(Node* node) { |
- VisitRROFloat(this, node, kAVXFloat32Mul, kSSEFloat32Mul); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64Mul(Node* node) { |
- VisitRROFloat(this, node, kAVXFloat64Mul, kSSEFloat64Mul); |
-} |
- |
- |
-void InstructionSelector::VisitFloat32Div(Node* node) { |
- VisitRROFloat(this, node, kAVXFloat32Div, kSSEFloat32Div); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64Div(Node* node) { |
- VisitRROFloat(this, node, kAVXFloat64Div, kSSEFloat64Div); |
-} |
- |
- |
void InstructionSelector::VisitFloat64Mod(Node* node) { |
IA32OperandGenerator g(this); |
InstructionOperand temps[] = {g.TempRegister(eax)}; |
@@ -1044,80 +996,10 @@ void InstructionSelector::VisitFloat64Min(Node* node) { |
arraysize(temps), temps); |
} |
- |
-void InstructionSelector::VisitFloat32Abs(Node* node) { |
- IA32OperandGenerator g(this); |
- VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat32Abs, kSSEFloat32Abs); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64Abs(Node* node) { |
- IA32OperandGenerator g(this); |
- VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat64Abs, kSSEFloat64Abs); |
-} |
- |
-void InstructionSelector::VisitFloat32Sqrt(Node* node) { |
- VisitRO(this, node, kSSEFloat32Sqrt); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64Sqrt(Node* node) { |
- VisitRO(this, node, kSSEFloat64Sqrt); |
-} |
- |
- |
-void InstructionSelector::VisitFloat32RoundDown(Node* node) { |
- VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundDown)); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64RoundDown(Node* node) { |
- VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundDown)); |
-} |
- |
- |
-void InstructionSelector::VisitFloat32RoundUp(Node* node) { |
- VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundUp)); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64RoundUp(Node* node) { |
- VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundUp)); |
-} |
- |
- |
-void InstructionSelector::VisitFloat32RoundTruncate(Node* node) { |
- VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToZero)); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
- VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToZero)); |
-} |
- |
- |
void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
UNREACHABLE(); |
} |
- |
-void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) { |
- VisitRR(this, node, kSSEFloat32Round | MiscField::encode(kRoundToNearest)); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { |
- VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToNearest)); |
-} |
- |
-void InstructionSelector::VisitFloat32Neg(Node* node) { |
- VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat32Neg, kSSEFloat32Neg); |
-} |
- |
-void InstructionSelector::VisitFloat64Neg(Node* node) { |
- VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat64Neg, kSSEFloat64Neg); |
-} |
- |
void InstructionSelector::VisitFloat64Ieee754Binop(Node* node, |
InstructionCode opcode) { |
IA32OperandGenerator g(this); |
@@ -1683,19 +1565,6 @@ void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { |
} |
-void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) { |
- IA32OperandGenerator g(this); |
- Emit(kSSEFloat64ExtractLowWord32, g.DefineAsRegister(node), |
- g.Use(node->InputAt(0))); |
-} |
- |
- |
-void InstructionSelector::VisitFloat64ExtractHighWord32(Node* node) { |
- IA32OperandGenerator g(this); |
- Emit(kSSEFloat64ExtractHighWord32, g.DefineAsRegister(node), |
- g.Use(node->InputAt(0))); |
-} |
- |
void InstructionSelector::VisitFloat64InsertLowWord32(Node* node) { |
IA32OperandGenerator g(this); |