Commit 7e2cc993 authored by bbudge's avatar bbudge Committed by Commit bot

Revert of [Turbofan] Macro-ize instruction selection for ia32. (patchset #1...

Revert of [Turbofan] Macro-ize instruction selection for ia32. (patchset #1 id:1 of https://codereview.chromium.org/2669683002/ )

Reason for revert:
Breaks Issue 1398

Original issue's description:
> [Turbofan] Macro-ize instruction selection for ia32.
> - Uses macros to reduce code duplication.
> - Uses calls to VisitRO, VisitRR, VisitRROFloat, and VisitFloatUnop to
>   reduce code bloat.
>
> LOG=N
> BUG=v8:4124
>
> Review-Url: https://codereview.chromium.org/2669683002
> Cr-Commit-Position: refs/heads/master@{#42830}
> Committed: https://chromium.googlesource.com/v8/v8/+/5e6eb91d0d66c9a118f1cc576accb649a17c5a9d

TBR=titzer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4124

Review-Url: https://codereview.chromium.org/2664403002
Cr-Commit-Position: refs/heads/master@{#42832}
parent f328f3e5
...@@ -771,83 +771,18 @@ void InstructionSelector::VisitWord32Ror(Node* node) { ...@@ -771,83 +771,18 @@ void InstructionSelector::VisitWord32Ror(Node* node) {
VisitShift(this, node, kIA32Ror); VisitShift(this, node, kIA32Ror);
} }
#define RO_OP_LIST(V) \
V(Word32Clz, kIA32Lzcnt) \ void InstructionSelector::VisitWord32Clz(Node* node) {
V(Word32Ctz, kIA32Tzcnt) \ IA32OperandGenerator g(this);
V(Word32Popcnt, kIA32Popcnt) \ Emit(kIA32Lzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
V(ChangeFloat32ToFloat64, kSSEFloat32ToFloat64) \ }
V(RoundInt32ToFloat32, kSSEInt32ToFloat32) \
V(ChangeInt32ToFloat64, kSSEInt32ToFloat64) \
V(ChangeUint32ToFloat64, kSSEUint32ToFloat64) \ void InstructionSelector::VisitWord32Ctz(Node* node) {
V(TruncateFloat32ToInt32, kSSEFloat32ToInt32) \ IA32OperandGenerator g(this);
V(TruncateFloat32ToUint32, kSSEFloat32ToUint32) \ Emit(kIA32Tzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
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
#define RR_VISITOR(Name, opcode) \
void InstructionSelector::Visit##Name(Node* node) { \
VisitRR(this, node, opcode); \
}
RR_OP_LIST(RR_VISITOR)
#undef RR_VISITOR
#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(); } void InstructionSelector::VisitWord32ReverseBits(Node* node) { UNREACHABLE(); }
...@@ -855,6 +790,12 @@ void InstructionSelector::VisitWord64ReverseBytes(Node* node) { UNREACHABLE(); } ...@@ -855,6 +790,12 @@ void InstructionSelector::VisitWord64ReverseBytes(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitWord32ReverseBytes(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) { void InstructionSelector::VisitInt32Add(Node* node) {
IA32OperandGenerator g(this); IA32OperandGenerator g(this);
...@@ -949,6 +890,16 @@ void InstructionSelector::VisitUint32Mod(Node* node) { ...@@ -949,6 +890,16 @@ 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) { void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) {
IA32OperandGenerator g(this); IA32OperandGenerator g(this);
InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()};
...@@ -956,6 +907,103 @@ void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) { ...@@ -956,6 +907,103 @@ void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) {
arraysize(temps), temps); 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) { void InstructionSelector::VisitFloat64Mod(Node* node) {
IA32OperandGenerator g(this); IA32OperandGenerator g(this);
InstructionOperand temps[] = {g.TempRegister(eax)}; InstructionOperand temps[] = {g.TempRegister(eax)};
...@@ -996,10 +1044,80 @@ void InstructionSelector::VisitFloat64Min(Node* node) { ...@@ -996,10 +1044,80 @@ void InstructionSelector::VisitFloat64Min(Node* node) {
arraysize(temps), temps); 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) { void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
UNREACHABLE(); 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, void InstructionSelector::VisitFloat64Ieee754Binop(Node* node,
InstructionCode opcode) { InstructionCode opcode) {
IA32OperandGenerator g(this); IA32OperandGenerator g(this);
...@@ -1565,6 +1683,19 @@ void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { ...@@ -1565,6 +1683,19 @@ 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) { void InstructionSelector::VisitFloat64InsertLowWord32(Node* node) {
IA32OperandGenerator g(this); IA32OperandGenerator g(this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment