Commit e3aef1cc authored by bbudge's avatar bbudge Committed by Commit bot

[Turbofan] Macro-ize instruction selection for arm64.

- Uses macros to reduce code duplication.
- Uses calls to VisitRR and VisitRRR to reduce code bloat.

LOG=N
BUG=v8:4124

Review-Url: https://codereview.chromium.org/2668633003
Cr-Commit-Position: refs/heads/master@{#42829}
parent e8e2e3c8
......@@ -1227,44 +1227,99 @@ void InstructionSelector::VisitWord64Ror(Node* node) {
VisitRRO(this, kArm64Ror, node, kShift64Imm);
}
void InstructionSelector::VisitWord64Clz(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Clz, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitWord32Clz(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Clz32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)));
}
#define RR_OP_LIST(V) \
V(Word64Clz, kArm64Clz) \
V(Word32Clz, kArm64Clz32) \
V(Word32ReverseBits, kArm64Rbit32) \
V(Word64ReverseBits, kArm64Rbit) \
V(ChangeFloat32ToFloat64, kArm64Float32ToFloat64) \
V(RoundInt32ToFloat32, kArm64Int32ToFloat32) \
V(RoundUint32ToFloat32, kArm64Uint32ToFloat32) \
V(ChangeInt32ToFloat64, kArm64Int32ToFloat64) \
V(ChangeUint32ToFloat64, kArm64Uint32ToFloat64) \
V(TruncateFloat32ToInt32, kArm64Float32ToInt32) \
V(ChangeFloat64ToInt32, kArm64Float64ToInt32) \
V(TruncateFloat32ToUint32, kArm64Float32ToUint32) \
V(ChangeFloat64ToUint32, kArm64Float64ToUint32) \
V(TruncateFloat64ToUint32, kArm64Float64ToUint32) \
V(TruncateFloat64ToFloat32, kArm64Float64ToFloat32) \
V(TruncateFloat64ToWord32, kArchTruncateDoubleToI) \
V(RoundFloat64ToInt32, kArm64Float64ToInt32) \
V(RoundInt64ToFloat32, kArm64Int64ToFloat32) \
V(RoundInt64ToFloat64, kArm64Int64ToFloat64) \
V(RoundUint64ToFloat32, kArm64Uint64ToFloat32) \
V(RoundUint64ToFloat64, kArm64Uint64ToFloat64) \
V(BitcastFloat32ToInt32, kArm64Float64ExtractLowWord32) \
V(BitcastFloat64ToInt64, kArm64U64MoveFloat64) \
V(BitcastInt32ToFloat32, kArm64Float64MoveU64) \
V(BitcastInt64ToFloat64, kArm64Float64MoveU64) \
V(Float32Abs, kArm64Float32Abs) \
V(Float64Abs, kArm64Float64Abs) \
V(Float32Sqrt, kArm64Float32Sqrt) \
V(Float64Sqrt, kArm64Float64Sqrt) \
V(Float32RoundDown, kArm64Float32RoundDown) \
V(Float64RoundDown, kArm64Float64RoundDown) \
V(Float32RoundUp, kArm64Float32RoundUp) \
V(Float64RoundUp, kArm64Float64RoundUp) \
V(Float32RoundTruncate, kArm64Float32RoundTruncate) \
V(Float64RoundTruncate, kArm64Float64RoundTruncate) \
V(Float64RoundTiesAway, kArm64Float64RoundTiesAway) \
V(Float32RoundTiesEven, kArm64Float32RoundTiesEven) \
V(Float64RoundTiesEven, kArm64Float64RoundTiesEven) \
V(Float32Neg, kArm64Float32Neg) \
V(Float64Neg, kArm64Float64Neg) \
V(Float64ExtractLowWord32, kArm64Float64ExtractLowWord32) \
V(Float64ExtractHighWord32, kArm64Float64ExtractHighWord32) \
V(Float64SilenceNaN, kArm64Float64SilenceNaN)
#define RRR_OP_LIST(V) \
V(Int32Div, kArm64Idiv32) \
V(Int64Div, kArm64Idiv) \
V(Uint32Div, kArm64Udiv32) \
V(Uint64Div, kArm64Udiv) \
V(Int32Mod, kArm64Imod32) \
V(Int64Mod, kArm64Imod) \
V(Uint32Mod, kArm64Umod32) \
V(Uint64Mod, kArm64Umod) \
V(Float32Add, kArm64Float32Add) \
V(Float64Add, kArm64Float64Add) \
V(Float32Sub, kArm64Float32Sub) \
V(Float64Sub, kArm64Float64Sub) \
V(Float32Mul, kArm64Float32Mul) \
V(Float64Mul, kArm64Float64Mul) \
V(Float32Div, kArm64Float32Div) \
V(Float64Div, kArm64Float64Div) \
V(Float32Max, kArm64Float32Max) \
V(Float64Max, kArm64Float64Max) \
V(Float32Min, kArm64Float32Min) \
V(Float64Min, kArm64Float64Min)
#define RR_VISITOR(Name, opcode) \
void InstructionSelector::Visit##Name(Node* node) { \
VisitRR(this, opcode, node); \
}
RR_OP_LIST(RR_VISITOR)
#undef RR_VISITOR
#define RRR_VISITOR(Name, opcode) \
void InstructionSelector::Visit##Name(Node* node) { \
VisitRRR(this, opcode, node); \
}
RRR_OP_LIST(RRR_VISITOR)
#undef RRR_VISITOR
void InstructionSelector::VisitWord32Ctz(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitWord64Ctz(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitWord32ReverseBits(Node* node) {
VisitRR(this, kArm64Rbit32, node);
}
void InstructionSelector::VisitWord64ReverseBits(Node* node) {
VisitRR(this, kArm64Rbit, node);
}
void InstructionSelector::VisitWord64ReverseBytes(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitWord32ReverseBytes(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitWord32Popcnt(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitWord64Popcnt(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitInt32Add(Node* node) {
Arm64OperandGenerator g(this);
Int32BinopMatcher m(node);
......@@ -1499,94 +1554,6 @@ void InstructionSelector::VisitUint32MulHigh(Node* node) {
}
void InstructionSelector::VisitInt32Div(Node* node) {
VisitRRR(this, kArm64Idiv32, node);
}
void InstructionSelector::VisitInt64Div(Node* node) {
VisitRRR(this, kArm64Idiv, node);
}
void InstructionSelector::VisitUint32Div(Node* node) {
VisitRRR(this, kArm64Udiv32, node);
}
void InstructionSelector::VisitUint64Div(Node* node) {
VisitRRR(this, kArm64Udiv, node);
}
void InstructionSelector::VisitInt32Mod(Node* node) {
VisitRRR(this, kArm64Imod32, node);
}
void InstructionSelector::VisitInt64Mod(Node* node) {
VisitRRR(this, kArm64Imod, node);
}
void InstructionSelector::VisitUint32Mod(Node* node) {
VisitRRR(this, kArm64Umod32, node);
}
void InstructionSelector::VisitUint64Mod(Node* node) {
VisitRRR(this, kArm64Umod, node);
}
void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) {
VisitRR(this, kArm64Float32ToFloat64, node);
}
void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) {
VisitRR(this, kArm64Int32ToFloat32, node);
}
void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) {
VisitRR(this, kArm64Uint32ToFloat32, node);
}
void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) {
VisitRR(this, kArm64Int32ToFloat64, node);
}
void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) {
VisitRR(this, kArm64Uint32ToFloat64, node);
}
void InstructionSelector::VisitTruncateFloat32ToInt32(Node* node) {
VisitRR(this, kArm64Float32ToInt32, node);
}
void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) {
VisitRR(this, kArm64Float64ToInt32, node);
}
void InstructionSelector::VisitTruncateFloat32ToUint32(Node* node) {
VisitRR(this, kArm64Float32ToUint32, node);
}
void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
VisitRR(this, kArm64Float64ToUint32, node);
}
void InstructionSelector::VisitTruncateFloat64ToUint32(Node* node) {
VisitRR(this, kArm64Float64ToUint32, node);
}
void InstructionSelector::VisitTryTruncateFloat32ToInt64(Node* node) {
Arm64OperandGenerator g(this);
......@@ -1741,20 +1708,6 @@ void InstructionSelector::VisitChangeUint32ToUint64(Node* node) {
Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(value));
}
void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
VisitRR(this, kArm64Float64ToFloat32, node);
}
void InstructionSelector::VisitTruncateFloat64ToWord32(Node* node) {
VisitRR(this, kArchTruncateDoubleToI, node);
}
void InstructionSelector::VisitRoundFloat64ToInt32(Node* node) {
VisitRR(this, kArm64Float64ToInt32, node);
}
void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) {
Arm64OperandGenerator g(this);
Node* value = node->InputAt(0);
......@@ -1763,85 +1716,6 @@ void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) {
Emit(kArchNop, g.DefineSameAsFirst(node), g.UseRegister(value));
}
void InstructionSelector::VisitRoundInt64ToFloat32(Node* node) {
VisitRR(this, kArm64Int64ToFloat32, node);
}
void InstructionSelector::VisitRoundInt64ToFloat64(Node* node) {
VisitRR(this, kArm64Int64ToFloat64, node);
}
void InstructionSelector::VisitRoundUint64ToFloat32(Node* node) {
VisitRR(this, kArm64Uint64ToFloat32, node);
}
void InstructionSelector::VisitRoundUint64ToFloat64(Node* node) {
VisitRR(this, kArm64Uint64ToFloat64, node);
}
void InstructionSelector::VisitBitcastFloat32ToInt32(Node* node) {
VisitRR(this, kArm64Float64ExtractLowWord32, node);
}
void InstructionSelector::VisitBitcastFloat64ToInt64(Node* node) {
VisitRR(this, kArm64U64MoveFloat64, node);
}
void InstructionSelector::VisitBitcastInt32ToFloat32(Node* node) {
VisitRR(this, kArm64Float64MoveU64, node);
}
void InstructionSelector::VisitBitcastInt64ToFloat64(Node* node) {
VisitRR(this, kArm64Float64MoveU64, node);
}
void InstructionSelector::VisitFloat32Add(Node* node) {
VisitRRR(this, kArm64Float32Add, node);
}
void InstructionSelector::VisitFloat64Add(Node* node) {
VisitRRR(this, kArm64Float64Add, node);
}
void InstructionSelector::VisitFloat32Sub(Node* node) {
VisitRRR(this, kArm64Float32Sub, node);
}
void InstructionSelector::VisitFloat64Sub(Node* node) {
VisitRRR(this, kArm64Float64Sub, node);
}
void InstructionSelector::VisitFloat32Mul(Node* node) {
VisitRRR(this, kArm64Float32Mul, node);
}
void InstructionSelector::VisitFloat64Mul(Node* node) {
VisitRRR(this, kArm64Float64Mul, node);
}
void InstructionSelector::VisitFloat32Div(Node* node) {
VisitRRR(this, kArm64Float32Div, node);
}
void InstructionSelector::VisitFloat64Div(Node* node) {
VisitRRR(this, kArm64Float64Div, node);
}
void InstructionSelector::VisitFloat64Mod(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Float64Mod, g.DefineAsFixed(node, d0),
......@@ -1849,94 +1723,6 @@ void InstructionSelector::VisitFloat64Mod(Node* node) {
g.UseFixed(node->InputAt(1), d1))->MarkAsCall();
}
void InstructionSelector::VisitFloat32Max(Node* node) {
VisitRRR(this, kArm64Float32Max, node);
}
void InstructionSelector::VisitFloat64Max(Node* node) {
VisitRRR(this, kArm64Float64Max, node);
}
void InstructionSelector::VisitFloat32Min(Node* node) {
VisitRRR(this, kArm64Float32Min, node);
}
void InstructionSelector::VisitFloat64Min(Node* node) {
VisitRRR(this, kArm64Float64Min, node);
}
void InstructionSelector::VisitFloat32Abs(Node* node) {
VisitRR(this, kArm64Float32Abs, node);
}
void InstructionSelector::VisitFloat64Abs(Node* node) {
VisitRR(this, kArm64Float64Abs, node);
}
void InstructionSelector::VisitFloat32Sqrt(Node* node) {
VisitRR(this, kArm64Float32Sqrt, node);
}
void InstructionSelector::VisitFloat64Sqrt(Node* node) {
VisitRR(this, kArm64Float64Sqrt, node);
}
void InstructionSelector::VisitFloat32RoundDown(Node* node) {
VisitRR(this, kArm64Float32RoundDown, node);
}
void InstructionSelector::VisitFloat64RoundDown(Node* node) {
VisitRR(this, kArm64Float64RoundDown, node);
}
void InstructionSelector::VisitFloat32RoundUp(Node* node) {
VisitRR(this, kArm64Float32RoundUp, node);
}
void InstructionSelector::VisitFloat64RoundUp(Node* node) {
VisitRR(this, kArm64Float64RoundUp, node);
}
void InstructionSelector::VisitFloat32RoundTruncate(Node* node) {
VisitRR(this, kArm64Float32RoundTruncate, node);
}
void InstructionSelector::VisitFloat64RoundTruncate(Node* node) {
VisitRR(this, kArm64Float64RoundTruncate, node);
}
void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
VisitRR(this, kArm64Float64RoundTiesAway, node);
}
void InstructionSelector::VisitFloat32RoundTiesEven(Node* node) {
VisitRR(this, kArm64Float32RoundTiesEven, node);
}
void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) {
VisitRR(this, kArm64Float64RoundTiesEven, node);
}
void InstructionSelector::VisitFloat32Neg(Node* node) {
VisitRR(this, kArm64Float32Neg, node);
}
void InstructionSelector::VisitFloat64Neg(Node* node) {
VisitRR(this, kArm64Float64Neg, node);
}
void InstructionSelector::VisitFloat64Ieee754Binop(Node* node,
InstructionCode opcode) {
Arm64OperandGenerator g(this);
......@@ -2806,21 +2592,6 @@ void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) {
VisitFloat64Compare(this, node, &cont);
}
void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Float64ExtractLowWord32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitFloat64ExtractHighWord32(Node* node) {
Arm64OperandGenerator g(this);
Emit(kArm64Float64ExtractHighWord32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
}
void InstructionSelector::VisitFloat64InsertLowWord32(Node* node) {
Arm64OperandGenerator g(this);
Node* left = node->InputAt(0);
......@@ -2855,10 +2626,6 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
g.UseRegister(left), g.UseRegister(right));
}
void InstructionSelector::VisitFloat64SilenceNaN(Node* node) {
VisitRR(this, kArm64Float64SilenceNaN, node);
}
void InstructionSelector::VisitAtomicLoad(Node* node) {
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
Arm64OperandGenerator 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