Skip to content

Commit

Permalink
Merge pull request #3563 from Sonicadvance1/fill_spill_pairs
Browse files Browse the repository at this point in the history
JIT: Adds support for spilling/Filling GPRPair
  • Loading branch information
lioncash authored Apr 9, 2024
2 parents 1616b4e + 574fdce commit eedb120
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion FEXCore/Source/Interface/Core/JIT/Arm64/MemoryOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,36 @@ DEF_OP(SpillRegister) {
LOGMAN_MSG_A_FMT("Unhandled SpillRegister size: {}", OpSize);
break;
}
} else {
} else if (Op->Class == FEXCore::IR::GPRPairClass) {
const auto Src = GetRegPair(Op->Value.ID());
switch (OpSize) {
case 8: {
if (SlotOffset <= 252 && (SlotOffset & 0b11) == 0) {
stp<ARMEmitter::IndexType::OFFSET>(Src.first.W(), Src.second.W(), ARMEmitter::Reg::rsp, SlotOffset);
}
else {
add(ARMEmitter::Size::i64Bit, TMP1, ARMEmitter::Reg::rsp, SlotOffset);
stp<ARMEmitter::IndexType::OFFSET>(Src.first.W(), Src.second.W(), TMP1, 0);
}
break;
}

case 16: {
if (SlotOffset <= 504 && (SlotOffset & 0b111) == 0) {
stp<ARMEmitter::IndexType::OFFSET>(Src.first.X(), Src.second.X(), ARMEmitter::Reg::rsp, SlotOffset);
}
else {
add(ARMEmitter::Size::i64Bit, TMP1, ARMEmitter::Reg::rsp, SlotOffset);
stp<ARMEmitter::IndexType::OFFSET>(Src.first.X(), Src.second.X(), TMP1, 0);
}
break;
}
default:
LOGMAN_MSG_A_FMT("Unhandled SpillRegister(GPRPair) size: {}", OpSize);
break;
}
}
else {
LOGMAN_MSG_A_FMT("Unhandled SpillRegister class: {}", Op->Class.Val);
}
}
Expand Down Expand Up @@ -871,6 +900,34 @@ DEF_OP(FillRegister) {
LOGMAN_MSG_A_FMT("Unhandled FillRegister size: {}", OpSize);
break;
}
} else if (Op->Class == FEXCore::IR::GPRPairClass) {
const auto Src = GetRegPair(Node);
switch (OpSize) {
case 8: {
if (SlotOffset <= 252 && (SlotOffset & 0b11) == 0) {
ldp<ARMEmitter::IndexType::OFFSET>(Src.first.W(), Src.second.W(), ARMEmitter::Reg::rsp, SlotOffset);
}
else {
add(ARMEmitter::Size::i64Bit, TMP1, ARMEmitter::Reg::rsp, SlotOffset);
ldp<ARMEmitter::IndexType::OFFSET>(Src.first.W(), Src.second.W(), TMP1, 0);
}
break;
}

case 16: {
if (SlotOffset <= 504 && (SlotOffset & 0b111) == 0) {
ldp<ARMEmitter::IndexType::OFFSET>(Src.first.X(), Src.second.X(), ARMEmitter::Reg::rsp, SlotOffset);
}
else {
add(ARMEmitter::Size::i64Bit, TMP1, ARMEmitter::Reg::rsp, SlotOffset);
ldp<ARMEmitter::IndexType::OFFSET>(Src.first.X(), Src.second.X(), TMP1, 0);
}
break;
}
default:
LOGMAN_MSG_A_FMT("Unhandled FillRegister(GPRPair) size: {}", OpSize);
break;
}
} else {
LOGMAN_MSG_A_FMT("Unhandled FillRegister class: {}", Op->Class.Val);
}
Expand Down

0 comments on commit eedb120

Please sign in to comment.