[dynarmic] fix sporadic crashes on high reg pressure

This commit is contained in:
lizzie 2025-07-28 07:00:00 +01:00 committed by crueter
parent 06966f4255
commit a7b99470fa
2 changed files with 6 additions and 3 deletions

View file

@ -131,9 +131,12 @@ const HostLocList any_gpr = {
};
// XMM0 is reserved for use by instructions that implicitly use it as an argument
// XMM1 is used by 128 mem accessors
// XMM2 is also used by that (and other stuff)
// Basically dont use either XMM0, XMM1 or XMM2 ever; they're left for the regsel
const HostLocList any_xmm = {
HostLoc::XMM1,
HostLoc::XMM2,
//HostLoc::XMM1,
//HostLoc::XMM2,
HostLoc::XMM3,
HostLoc::XMM4,
HostLoc::XMM5,

View file

@ -571,7 +571,7 @@ HostLoc RegAlloc::FindFreeSpill(bool is_xmm) const noexcept {
if (!is_xmm) {
// TODO(lizzie): Using lower (xmm0 and such) registers results in issues/crashes - INVESTIGATE WHY
// Intel recommends to spill GPR onto XMM registers IF POSSIBLE
for (size_t i = size_t(HostLoc::XMM15); i >= size_t(HostLoc::XMM0); --i)
for (auto const i : any_xmm)
if (const auto loc = HostLoc(i); LocInfo(loc).IsEmpty())
return loc;
}