mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
SPU LLVM: simplify jump table computation
Remove one add operation and adjust constants instead.
This commit is contained in:
parent
b138d25b97
commit
f95ec8a37c
1 changed files with 3 additions and 3 deletions
|
@ -7817,7 +7817,7 @@ public:
|
||||||
if (!op.d && !op.e && tfound != m_targets.end() && tfound->second.size() > 1)
|
if (!op.d && !op.e && tfound != m_targets.end() && tfound->second.size() > 1)
|
||||||
{
|
{
|
||||||
// Shift aligned address for switch
|
// Shift aligned address for switch
|
||||||
const auto addrfx = m_ir->CreateAdd(m_ir->CreateSub(addr.value, m_base_pc), m_ir->getInt32(m_base));
|
const auto addrfx = m_ir->CreateSub(addr.value, m_base_pc);
|
||||||
const auto sw_arg = m_ir->CreateLShr(addrfx, 2, "", true);
|
const auto sw_arg = m_ir->CreateLShr(addrfx, 2, "", true);
|
||||||
|
|
||||||
// Initialize jump table targets
|
// Initialize jump table targets
|
||||||
|
@ -7860,12 +7860,12 @@ public:
|
||||||
|
|
||||||
if (found != targets.end())
|
if (found != targets.end())
|
||||||
{
|
{
|
||||||
sw->addCase(m_ir->getInt32(pos / 4), found->second);
|
sw->addCase(m_ir->getInt32(pos / 4 - m_base / 4), found->second);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sw->addCase(m_ir->getInt32(pos / 4), sw->getDefaultDest());
|
sw->addCase(m_ir->getInt32(pos / 4 - m_base / 4), sw->getDefaultDest());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit function on unexpected target
|
// Exit function on unexpected target
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue