Skip to content

Commit

Permalink
OpcodeDispatcher: Fixes disabling TSO access on RSP SIB stores
Browse files Browse the repository at this point in the history
GPR Direct/Indirect already had this and SIB version also already
supported on the load side. Fixes this missed behaviour.
  • Loading branch information
Sonicadvance1 committed Apr 8, 2024
1 parent bb24e14 commit 0e93fd0
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4475,9 +4475,6 @@ OrderedNode *OpDispatchBuilder::LoadSource_WithOpSize(RegisterClassType Class, X
auto Constant = _Constant(GPRSize * 8, Operand.Data.SIB.Scale);
Tmp = _Mul(IR::SizeToOpSize(GPRSize), Tmp, Constant);
}
if (Operand.Data.SIB.Index == FEXCore::X86State::REG_RSP && AccessType == MemoryAccessType::DEFAULT) {
AccessType = MemoryAccessType::NONTSO;
}
}

if (Operand.Data.SIB.Base != FEXCore::X86State::REG_INVALID) {
Expand All @@ -4489,10 +4486,6 @@ OrderedNode *OpDispatchBuilder::LoadSource_WithOpSize(RegisterClassType Class, X
else {
Tmp = GPR;
}

if (Operand.Data.SIB.Base == FEXCore::X86State::REG_RSP && AccessType == MemoryAccessType::DEFAULT) {
AccessType = MemoryAccessType::NONTSO;
}
}
}

Expand All @@ -4513,6 +4506,12 @@ OrderedNode *OpDispatchBuilder::LoadSource_WithOpSize(RegisterClassType Class, X
}
}

if ((Operand.Data.SIB.Base == FEXCore::X86State::REG_RSP ||
Operand.Data.SIB.Index == FEXCore::X86State::REG_RSP)
&& AccessType == MemoryAccessType::DEFAULT) {
AccessType = MemoryAccessType::NONTSO;
}

LoadableType = true;
}
else {
Expand Down Expand Up @@ -4762,6 +4761,12 @@ void OpDispatchBuilder::StoreResult_WithOpSize(FEXCore::IR::RegisterClassType Cl
MemStoreDst = _Bfe(IR::SizeToOpSize(std::max<uint8_t>(4u, AddrSize)), AddrSize * 8, 0, MemStoreDst);
}

if ((Operand.Data.SIB.Base == FEXCore::X86State::REG_RSP ||
Operand.Data.SIB.Index == FEXCore::X86State::REG_RSP)
&& AccessType == MemoryAccessType::DEFAULT) {
AccessType = MemoryAccessType::NONTSO;
}

MemStore = true;
}

Expand Down

0 comments on commit 0e93fd0

Please sign in to comment.