DSP: Fix integer promotion spill

This commit is contained in:
EmptyChaos 2016-04-08 02:08:17 +00:00
parent 94098a50c2
commit 80ff82b81a
3 changed files with 7 additions and 7 deletions

View File

@ -67,7 +67,7 @@ static void Reset()
code_flags.fill(0); code_flags.fill(0);
} }
static void AnalyzeRange(int start_addr, int end_addr) static void AnalyzeRange(u16 start_addr, u16 end_addr)
{ {
// First we run an extremely simplified version of a disassembler to find // First we run an extremely simplified version of a disassembler to find
// where all instructions start. // where all instructions start.
@ -75,7 +75,7 @@ static void AnalyzeRange(int start_addr, int end_addr)
// This may not be 100% accurate in case of jump tables! // This may not be 100% accurate in case of jump tables!
// It could get desynced, which would be bad. We'll see if that's an issue. // It could get desynced, which would be bad. We'll see if that's an issue.
u16 last_arithmetic = 0; u16 last_arithmetic = 0;
for (int addr = start_addr; addr < end_addr;) for (u16 addr = start_addr; addr < end_addr;)
{ {
UDSPInstruction inst = dsp_imem_read(addr); UDSPInstruction inst = dsp_imem_read(addr);
const DSPOPCTemplate *opcode = GetOpTemplate(inst); const DSPOPCTemplate *opcode = GetOpTemplate(inst);
@ -97,7 +97,7 @@ static void AnalyzeRange(int start_addr, int end_addr)
{ {
// LOOP, LOOPI // LOOP, LOOPI
code_flags[addr] |= CODE_LOOP_START; code_flags[addr] |= CODE_LOOP_START;
code_flags[addr + 1] |= CODE_LOOP_END; code_flags[static_cast<u16>(addr + 1u)] |= CODE_LOOP_END;
} }
// Mark the last arithmetic/multiplier instruction before a branch. // Mark the last arithmetic/multiplier instruction before a branch.
@ -122,7 +122,7 @@ static void AnalyzeRange(int start_addr, int end_addr)
opcode->opcode == 0x2000 || opcode->opcode == 0x2000 ||
opcode->extended opcode->extended
) )
code_flags[addr + opcode->size] |= CODE_CHECK_INT; code_flags[static_cast<u16>(addr + opcode->size)] |= CODE_CHECK_INT;
addr += opcode->size; addr += opcode->size;
} }
@ -130,7 +130,7 @@ static void AnalyzeRange(int start_addr, int end_addr)
// Next, we'll scan for potential idle skips. // Next, we'll scan for potential idle skips.
for (int s = 0; s < NUM_IDLE_SIGS; s++) for (int s = 0; s < NUM_IDLE_SIGS; s++)
{ {
for (int addr = start_addr; addr < end_addr; addr++) for (u16 addr = start_addr; addr < end_addr; addr++)
{ {
bool found = false; bool found = false;
for (int i = 0; i < MAX_IDLE_SIG_SIZE + 1; i++) for (int i = 0; i < MAX_IDLE_SIG_SIZE + 1; i++)

View File

@ -243,7 +243,7 @@ void DSPEmitter::Compile(u16 start_addr)
// Handle loop condition, only if current instruction was flagged as a loop destination // Handle loop condition, only if current instruction was flagged as a loop destination
// by the analyzer. // by the analyzer.
if (DSPAnalyzer::code_flags[compilePC-1] & DSPAnalyzer::CODE_LOOP_END) if (DSPAnalyzer::code_flags[static_cast<u16>(compilePC - 1u)] & DSPAnalyzer::CODE_LOOP_END)
{ {
MOVZX(32, 16, EAX, M(&(g_dsp.r.st[2]))); MOVZX(32, 16, EAX, M(&(g_dsp.r.st[2])));
TEST(32, R(EAX), R(EAX)); TEST(32, R(EAX), R(EAX));

View File

@ -76,7 +76,7 @@ void Step()
u16 opc = dsp_fetch_code(); u16 opc = dsp_fetch_code();
ExecuteInstruction(UDSPInstruction(opc)); ExecuteInstruction(UDSPInstruction(opc));
if (DSPAnalyzer::code_flags[g_dsp.pc - 1] & DSPAnalyzer::CODE_LOOP_END) if (DSPAnalyzer::code_flags[static_cast<u16>(g_dsp.pc - 1u)] & DSPAnalyzer::CODE_LOOP_END)
HandleLoop(); HandleLoop();
} }