PPC/S390: refactor behaviour of SetPendingMove
This CL applies the following changes: - a number of redundant DCHECKs have been removed. - MoveToTempLocation on PPC specifically checks for Simd128 usage even though Simd and Double scratch register numbers are the same at the moment. - kScratchReg usage is removed from under AssembleMove in PPC. - SetPendingMove covers F32/F64 and Simd126 stack and scratch register usage by AssembleMove using `IsFPStackSlot` and `IsFPRegister`. Change-Id: I7e4257bb8cc1e66d59cdabe93c113b724cf91c52 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4072585 Commit-Queue: Milad Farazmand <mfarazma@redhat.com> Reviewed-by: Junliang Yan <junyan@redhat.com> Cr-Commit-Position: refs/heads/main@{#84657}
This commit is contained in:
parent
7545b49288
commit
fbdf503591
@ -3573,13 +3573,18 @@ void CodeGenerator::MoveToTempLocation(InstructionOperand* source) {
|
||||
((IsFloatingPoint(rep) &&
|
||||
!move_cycle_.pending_double_scratch_register_use))) {
|
||||
// The scratch register for this rep is available.
|
||||
int scratch_reg_code =
|
||||
!IsFloatingPoint(rep) ? kScratchReg.code() : kScratchDoubleReg.code();
|
||||
int scratch_reg_code;
|
||||
if (IsSimd128(rep)) {
|
||||
scratch_reg_code = kScratchSimd128Reg.code();
|
||||
} else if (IsFloatingPoint(rep)) {
|
||||
scratch_reg_code = kScratchDoubleReg.code();
|
||||
} else {
|
||||
scratch_reg_code = kScratchReg.code();
|
||||
}
|
||||
AllocatedOperand scratch(LocationOperand::REGISTER, rep, scratch_reg_code);
|
||||
DCHECK(!AreAliased(kScratchReg, r0, ip));
|
||||
AssembleMove(source, &scratch);
|
||||
} else {
|
||||
DCHECK(!source->IsRegister() && !source->IsStackSlot());
|
||||
// The scratch register is blocked by pending moves. Use the stack instead.
|
||||
Push(source);
|
||||
}
|
||||
@ -3596,18 +3601,14 @@ void CodeGenerator::MoveTempLocationTo(InstructionOperand* dest,
|
||||
DCHECK(!AreAliased(kScratchReg, r0, ip));
|
||||
AssembleMove(&scratch, dest);
|
||||
} else {
|
||||
DCHECK(!dest->IsRegister() && !dest->IsStackSlot());
|
||||
Pop(dest, rep);
|
||||
}
|
||||
move_cycle_ = MoveCycleState();
|
||||
}
|
||||
|
||||
void CodeGenerator::SetPendingMove(MoveOperands* move) {
|
||||
if (move->source().IsFPStackSlot() && !move->destination().IsFPRegister()) {
|
||||
move_cycle_.pending_double_scratch_register_use = true;
|
||||
} else if (move->source().IsConstant() &&
|
||||
(move->destination().IsDoubleStackSlot() ||
|
||||
move->destination().IsFloatStackSlot())) {
|
||||
if ((move->source().IsConstant() || move->source().IsFPStackSlot()) &&
|
||||
!move->destination().IsFPRegister()) {
|
||||
move_cycle_.pending_double_scratch_register_use = true;
|
||||
}
|
||||
}
|
||||
@ -3740,7 +3741,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
} else {
|
||||
DCHECK(destination->IsSimd128StackSlot());
|
||||
MemOperand dst = g.ToMemOperand(destination);
|
||||
__ StoreSimd128(g.ToSimd128Register(source), dst, kScratchReg);
|
||||
__ StoreSimd128(g.ToSimd128Register(source), dst, r0);
|
||||
}
|
||||
} else {
|
||||
DoubleRegister src = g.ToDoubleRegister(source);
|
||||
@ -3769,7 +3770,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
} else {
|
||||
DCHECK_EQ(MachineRepresentation::kSimd128, op->representation());
|
||||
MemOperand src = g.ToMemOperand(source);
|
||||
__ LoadSimd128(g.ToSimd128Register(destination), src, kScratchReg);
|
||||
__ LoadSimd128(g.ToSimd128Register(destination), src, r0);
|
||||
}
|
||||
} else {
|
||||
LocationOperand* op = LocationOperand::cast(source);
|
||||
@ -3784,8 +3785,8 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
DCHECK_EQ(MachineRepresentation::kSimd128, op->representation());
|
||||
MemOperand src = g.ToMemOperand(source);
|
||||
MemOperand dst = g.ToMemOperand(destination);
|
||||
__ LoadSimd128(kScratchSimd128Reg, src, kScratchReg);
|
||||
__ StoreSimd128(kScratchSimd128Reg, dst, kScratchReg);
|
||||
__ LoadSimd128(kScratchSimd128Reg, src, r0);
|
||||
__ StoreSimd128(kScratchSimd128Reg, dst, r0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -3661,7 +3661,6 @@ void CodeGenerator::MoveToTempLocation(InstructionOperand* source) {
|
||||
DCHECK(!AreAliased(kScratchReg, r0, r1));
|
||||
AssembleMove(source, &scratch);
|
||||
} else {
|
||||
DCHECK(!source->IsRegister() && !source->IsStackSlot());
|
||||
// The scratch register is blocked by pending moves. Use the stack instead.
|
||||
Push(source);
|
||||
}
|
||||
@ -3678,18 +3677,14 @@ void CodeGenerator::MoveTempLocationTo(InstructionOperand* dest,
|
||||
DCHECK(!AreAliased(kScratchReg, r0, r1));
|
||||
AssembleMove(&scratch, dest);
|
||||
} else {
|
||||
DCHECK(!dest->IsRegister() && !dest->IsStackSlot());
|
||||
Pop(dest, rep);
|
||||
}
|
||||
move_cycle_ = MoveCycleState();
|
||||
}
|
||||
|
||||
void CodeGenerator::SetPendingMove(MoveOperands* move) {
|
||||
if (move->source().IsFPStackSlot() && !move->destination().IsFPRegister()) {
|
||||
move_cycle_.pending_double_scratch_register_use = true;
|
||||
} else if (move->source().IsConstant() &&
|
||||
(move->destination().IsDoubleStackSlot() ||
|
||||
move->destination().IsFloatStackSlot())) {
|
||||
if ((move->source().IsConstant() || move->source().IsFPStackSlot()) &&
|
||||
!move->destination().IsFPRegister()) {
|
||||
move_cycle_.pending_double_scratch_register_use = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user