MMU: remove goto in MMU fast past check

Split into a separate patch to avoid rebasing conflicts and to split from
functional changes.
This commit is contained in:
Fiora 2015-01-01 17:56:14 -08:00
parent 6f028257d7
commit 8e1c92f2e7
1 changed files with 147 additions and 150 deletions

View File

@ -98,8 +98,8 @@ __forceinline void ReadFromHardware(U &_var, const u32 em_address)
int segment = em_address >> 28; int segment = em_address >> 28;
// Quick check for an address that can't meet any of the following conditions, // Quick check for an address that can't meet any of the following conditions,
// to speed up the MMU path. // to speed up the MMU path.
if (BitSet32(0xCFC)[segment]) if (!BitSet32(0xCFC)[segment])
goto translateaddress; {
// TODO: Figure out the fastest order of tests for both read and write (they are probably different). // TODO: Figure out the fastest order of tests for both read and write (they are probably different).
if ((em_address & 0xC8000000) == 0xC8000000) if ((em_address & 0xC8000000) == 0xC8000000)
{ {
@ -107,22 +107,25 @@ __forceinline void ReadFromHardware(U &_var, const u32 em_address)
_var = EFB_Read(em_address); _var = EFB_Read(em_address);
else else
_var = (T)mmio_mapping->Read<typename std::make_unsigned<T>::type>(em_address); _var = (T)mmio_mapping->Read<typename std::make_unsigned<T>::type>(em_address);
return;
} }
else if (segment == 0x8 || segment == 0xC || segment == 0x0) else if (segment == 0x8 || segment == 0xC || segment == 0x0)
{ {
_var = bswap((*(const T*)&m_pRAM[em_address & RAM_MASK])); _var = bswap((*(const T*)&m_pRAM[em_address & RAM_MASK]));
return;
} }
else if (m_pEXRAM && (segment == 0x9 || segment == 0xD || segment == 0x1)) else if (m_pEXRAM && (segment == 0x9 || segment == 0xD || segment == 0x1))
{ {
_var = bswap((*(const T*)&m_pEXRAM[em_address & EXRAM_MASK])); _var = bswap((*(const T*)&m_pEXRAM[em_address & EXRAM_MASK]));
return;
} }
else if (segment == 0xE && (em_address < (0xE0000000 + L1_CACHE_SIZE))) else if (segment == 0xE && (em_address < (0xE0000000 + L1_CACHE_SIZE)))
{ {
_var = bswap((*(const T*)&m_pL1Cache[em_address & L1_CACHE_MASK])); _var = bswap((*(const T*)&m_pL1Cache[em_address & L1_CACHE_MASK]));
return;
} }
else }
{
translateaddress:
if (bFakeVMEM && (segment == 0x7 || segment == 0x4)) if (bFakeVMEM && (segment == 0x7 || segment == 0x4))
{ {
// fake VMEM // fake VMEM
@ -165,13 +168,10 @@ translateaddress:
} }
return; return;
} }
else
{
// The easy case! // The easy case!
_var = bswap(*(const T*)&Memory::base[tlb_addr]); _var = bswap(*(const T*)&Memory::base[tlb_addr]);
} }
}
}
template <XCheckTLBFlag flag, typename T> template <XCheckTLBFlag flag, typename T>
@ -180,8 +180,8 @@ __forceinline void WriteToHardware(u32 em_address, const T data)
int segment = em_address >> 28; int segment = em_address >> 28;
// Quick check for an address that can't meet any of the following conditions, // Quick check for an address that can't meet any of the following conditions,
// to speed up the MMU path. // to speed up the MMU path.
if (BitSet32(0xCFC)[segment]) if (!BitSet32(0xCFC)[segment])
goto translateaddress; {
// First, let's check for FIFO writes, since they are probably the most common // First, let's check for FIFO writes, since they are probably the most common
// reason we end up in this function: // reason we end up in this function:
if ((em_address & 0xFFFFF000) == 0xCC008000) if ((em_address & 0xFFFFF000) == 0xCC008000)
@ -235,9 +235,8 @@ __forceinline void WriteToHardware(u32 em_address, const T data)
*(T*)&m_pL1Cache[em_address & L1_CACHE_MASK] = bswap(data); *(T*)&m_pL1Cache[em_address & L1_CACHE_MASK] = bswap(data);
return; return;
} }
else }
{
translateaddress:
if (bFakeVMEM && (segment == 0x7 || segment == 0x4)) if (bFakeVMEM && (segment == 0x7 || segment == 0x4))
{ {
// fake VMEM // fake VMEM
@ -274,14 +273,12 @@ translateaddress:
tlb_addr = tlb_addr_next_page; tlb_addr = tlb_addr_next_page;
Memory::base[tlb_addr] = (u8)val; Memory::base[tlb_addr] = (u8)val;
} }
return;
} }
else
{
// The easy case! // The easy case!
*(T*)&Memory::base[tlb_addr] = bswap(data); *(T*)&Memory::base[tlb_addr] = bswap(data);
} }
}
}
// ===================== // =====================