aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRSDuck <rsduck@users.noreply.github.com>2019-08-25 13:06:27 +0200
committerRSDuck <rsduck@users.noreply.github.com>2020-04-26 13:05:01 +0200
commitea562d2fec9f4ab73e9ff3f519ff5ecb65736cd7 (patch)
tree1ab1936437c79e531f7112caf7b7deb9ec47e681
parentb5dda7d6e2f73941435a8e9a6b71804fad068319 (diff)
fixes for flag optimisation
-rw-r--r--src/ARMJIT.cpp1
-rw-r--r--src/ARMJIT_x64/ARMJIT_ALU.cpp2
-rw-r--r--src/ARM_InstrInfo.cpp2
3 files changed, 3 insertions, 2 deletions
diff --git a/src/ARMJIT.cpp b/src/ARMJIT.cpp
index 3b6bc2e..5d92e47 100644
--- a/src/ARMJIT.cpp
+++ b/src/ARMJIT.cpp
@@ -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];
diff --git a/src/ARMJIT_x64/ARMJIT_ALU.cpp b/src/ARMJIT_x64/ARMJIT_ALU.cpp
index 6a7d711..f868ddf 100644
--- a/src/ARMJIT_x64/ARMJIT_ALU.cpp
+++ b/src/ARMJIT_x64/ARMJIT_ALU.cpp
@@ -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)));
diff --git a/src/ARM_InstrInfo.cpp b/src/ARM_InstrInfo.cpp
index ea6d827..3634c35 100644
--- a/src/ARM_InstrInfo.cpp
+++ b/src/ARM_InstrInfo.cpp
@@ -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];
}