Skip to content

Commit

Permalink
Merge pull request #3562 from Sonicadvance1/fix_rsp_store_tso
Browse files Browse the repository at this point in the history
OpcodeDispatcher: Fixes disabling TSO access on RSP SIB stores
  • Loading branch information
Sonicadvance1 authored Apr 11, 2024
2 parents a0f2cae + 0e93fd0 commit 1ba678f
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 @@ -4457,9 +4457,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 @@ -4471,10 +4468,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 @@ -4495,6 +4488,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 @@ -4744,6 +4743,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 1ba678f

Please sign in to comment.