fixes for flag optimisation

This commit is contained in:
RSDuck 2019-08-25 13:06:27 +02:00
parent f378458c10
commit d208f5909c
3 changed files with 3 additions and 2 deletions

View File

@ -163,6 +163,7 @@ CompiledBlock CompileBlock(ARM* cpu)
{
r15 += thumb ? 2 : 4;
instrs[i].SetFlags = 0;
instrs[i].Instr = nextInstr[0];
instrs[i].NextInstr[0] = nextInstr[0] = nextInstr[1];

View File

@ -387,7 +387,7 @@ void Compiler::Comp_RetriveFlags(bool sign, bool retriveCV, bool carryUsed)
AND(32, R(RCPSR), Imm32(0x3FFFFFFF & ~(carryUsed << 29) & ~((retriveCV ? 3 : 0) << 28)));
OR(32, R(RCPSR), R(RSCRATCH));
}
else
else if (carryUsed || retriveCV)
{
SHL(32, R(RSCRATCH2), Imm8(carryOnly ? 29 : 28));
AND(32, R(RCPSR), Imm32(0xFFFFFFFF & ~(carryUsed << 29) & ~((retriveCV ? 3 : 0) << 28)));

View File

@ -436,7 +436,7 @@ Info Decode(bool thumb, u32 num, u32 instr)
if ((instr >> 28) < 0xE)
{
// make non conditional flag sets conditional
res.WriteFlags = res.WriteFlags | (res.WriteFlags << 4);
res.WriteFlags = (res.WriteFlags | (res.WriteFlags << 4)) & 0xF0;
res.ReadFlags |= FlagsReadPerCond[instr >> 29];
}