aboutsummaryrefslogtreecommitdiff
path: root/src
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-06-16 11:55:53 +0200
commitd208f5909c97c3caeaa4c1c95a37e618824ec199 (patch)
tree3d4b305d056315f32090611075fc62f5da11dc1a /src
parentf378458c104f1879f30610dfe4010e4772218787 (diff)
fixes for flag optimisation
Diffstat (limited to 'src')
-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];
}