diff options
author | RSDuck <rsduck@users.noreply.github.com> | 2020-07-25 22:08:43 +0200 |
---|---|---|
committer | RSDuck <rsduck@users.noreply.github.com> | 2020-07-25 22:08:43 +0200 |
commit | 887ad27ed88fa3cd12ab14a8fe1c0c5bc63f37fb (patch) | |
tree | a7b1cddbfb6cc2d9316893b678e559cd08315e95 /src/ARMJIT_x64 | |
parent | 8b83611d32e14cab123051dc347646d9ec7caa1b (diff) |
implement carry setting ALU op with imm
Diffstat (limited to 'src/ARMJIT_x64')
-rw-r--r-- | src/ARMJIT_x64/ARMJIT_ALU.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/ARMJIT_x64/ARMJIT_ALU.cpp b/src/ARMJIT_x64/ARMJIT_ALU.cpp index 43b94b6..57a38c4 100644 --- a/src/ARMJIT_x64/ARMJIT_ALU.cpp +++ b/src/ARMJIT_x64/ARMJIT_ALU.cpp @@ -103,16 +103,30 @@ void Compiler::Comp_CmpOp(int op, Gen::OpArg rn, Gen::OpArg op2, bool carryUsed) // also calculates cycles OpArg Compiler::A_Comp_GetALUOp2(bool S, bool& carryUsed) { + S = S && (CurInstr.SetFlags & 0x2); + if (CurInstr.Instr & (1 << 25)) { Comp_AddCycles_C(); + + u32 shift = (CurInstr.Instr >> 7) & 0x1E; + u32 imm = ROR(CurInstr.Instr & 0xFF, shift); + carryUsed = false; - return Imm32(ROR(CurInstr.Instr & 0xFF, (CurInstr.Instr >> 7) & 0x1E)); + if (S && shift) + { + CPSRDirty = true; + carryUsed = true; + if (imm & 0x80000000) + MOV(32, R(RSCRATCH2), Imm32(1)); + else + XOR(32, R(RSCRATCH2), R(RSCRATCH2)); + } + + return Imm32(imm); } else { - S = S && (CurInstr.SetFlags & 0x2); - int op = (CurInstr.Instr >> 5) & 0x3; if (CurInstr.Instr & (1 << 4)) { |