Commit 57a1d86c authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[turbofan][x64] Remove the kX64PeekFloat32 and kX64PeekFloat64 instructions

Instead of these two instructions I generalize the kX64Peek instruction.

R=bmeurer@chromium.org

Change-Id: Ie5f8c7d428b65df3ca8b75594f6a06a75cc8e978
Reviewed-on: https://chromium-review.googlesource.com/839863
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50294}
parent 94d53d87
...@@ -2117,25 +2117,21 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -2117,25 +2117,21 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
} }
break; break;
} }
case kX64PeekFloat32: {
int reverse_slot = MiscField::decode(instr->opcode());
int offset =
FrameSlotToFPOffset(frame()->GetTotalFrameSlotCount() - reverse_slot);
__ Movss(i.OutputFloatRegister(), Operand(rbp, offset));
break;
}
case kX64PeekFloat64: {
int reverse_slot = MiscField::decode(instr->opcode());
int offset =
FrameSlotToFPOffset(frame()->GetTotalFrameSlotCount() - reverse_slot);
__ Movsd(i.OutputDoubleRegister(), Operand(rbp, offset));
break;
}
case kX64Peek: { case kX64Peek: {
int reverse_slot = MiscField::decode(instr->opcode()); int reverse_slot = MiscField::decode(instr->opcode());
int offset = int offset =
FrameSlotToFPOffset(frame()->GetTotalFrameSlotCount() - reverse_slot); FrameSlotToFPOffset(frame()->GetTotalFrameSlotCount() - reverse_slot);
__ movq(i.OutputRegister(), Operand(rbp, offset)); if (instr->OutputAt(0)->IsFPRegister()) {
LocationOperand* op = LocationOperand::cast(instr->OutputAt(0));
if (op->representation() == MachineRepresentation::kFloat64) {
__ Movsd(i.OutputDoubleRegister(), Operand(rbp, offset));
} else {
DCHECK_EQ(MachineRepresentation::kFloat32, op->representation());
__ Movss(i.OutputFloatRegister(), Operand(rbp, offset));
}
} else {
__ movq(i.OutputRegister(), Operand(rbp, offset));
}
break; break;
} }
// TODO(gdeepti): Get rid of redundant moves for F32x4Splat/Extract below // TODO(gdeepti): Get rid of redundant moves for F32x4Splat/Extract below
......
...@@ -144,8 +144,6 @@ namespace compiler { ...@@ -144,8 +144,6 @@ namespace compiler {
V(X64Push) \ V(X64Push) \
V(X64Poke) \ V(X64Poke) \
V(X64Peek) \ V(X64Peek) \
V(X64PeekFloat32) \
V(X64PeekFloat64) \
V(X64StackCheck) \ V(X64StackCheck) \
V(X64F32x4Splat) \ V(X64F32x4Splat) \
V(X64F32x4ExtractLane) \ V(X64F32x4ExtractLane) \
......
...@@ -255,8 +255,6 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -255,8 +255,6 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kX64StackCheck: case kX64StackCheck:
case kX64Peek: case kX64Peek:
case kX64PeekFloat32:
case kX64PeekFloat64:
return kIsLoadOperation; return kIsLoadOperation;
case kX64Push: case kX64Push:
......
...@@ -1533,16 +1533,11 @@ void InstructionSelector::EmitPrepareResults(ZoneVector<PushParameter>* results, ...@@ -1533,16 +1533,11 @@ void InstructionSelector::EmitPrepareResults(ZoneVector<PushParameter>* results,
DCHECK(!descriptor->IsCFunctionCall()); DCHECK(!descriptor->IsCFunctionCall());
if (output.location.GetType() == MachineType::Float32()) { if (output.location.GetType() == MachineType::Float32()) {
MarkAsFloat32(output.node); MarkAsFloat32(output.node);
InstructionOperand result = g.DefineAsRegister(output.node);
Emit(kX64PeekFloat32 | MiscField::encode(reverse_slot), result);
} else if (output.location.GetType() == MachineType::Float64()) { } else if (output.location.GetType() == MachineType::Float64()) {
MarkAsFloat64(output.node); MarkAsFloat64(output.node);
InstructionOperand result = g.DefineAsRegister(output.node);
Emit(kX64PeekFloat64 | MiscField::encode(reverse_slot), result);
} else {
InstructionOperand result = g.DefineAsRegister(output.node);
Emit(kX64Peek | MiscField::encode(reverse_slot), result);
} }
InstructionOperand result = g.DefineAsRegister(output.node);
Emit(kX64Peek | MiscField::encode(reverse_slot), result);
} }
} }
......
...@@ -517,6 +517,9 @@ void ReturnLastValue(MachineType type) { ...@@ -517,6 +517,9 @@ void ReturnLastValue(MachineType type) {
} }
TEST(ReturnLastValueInt32) { ReturnLastValue(MachineType::Int32()); } TEST(ReturnLastValueInt32) { ReturnLastValue(MachineType::Int32()); }
#if (!V8_TARGET_ARCH_32_BIT)
TEST(ReturnLastValueInt64) { ReturnLastValue(MachineType::Int64()); }
#endif
TEST(ReturnLastValueFloat32) { ReturnLastValue(MachineType::Float32()); } TEST(ReturnLastValueFloat32) { ReturnLastValue(MachineType::Float32()); }
TEST(ReturnLastValueFloat64) { ReturnLastValue(MachineType::Float64()); } TEST(ReturnLastValueFloat64) { ReturnLastValue(MachineType::Float64()); }
......
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