mirror of
https://github.com/azahar-emu/dynarmic
synced 2025-11-07 07:29:59 +01:00
emit_arm64_a32: A32SetCpsrNZC: Handle immediate
This commit is contained in:
parent
65a7d9be8d
commit
db5db43fd4
@ -323,28 +323,49 @@ void EmitIR<IR::Opcode::A32SetCpsrNZC>(oaknut::CodeGenerator& code, EmitContext&
|
|||||||
|
|
||||||
// TODO: Track latent value
|
// TODO: Track latent value
|
||||||
|
|
||||||
if (args[1].IsImmediate()) {
|
if (args[0].IsImmediate()) {
|
||||||
const u32 carry = args[1].GetImmediateU1() ? 0x2000'0000 : 0;
|
if (args[1].IsImmediate()) {
|
||||||
auto Wnz = ctx.reg_alloc.ReadW(args[0]);
|
const u32 carry = args[1].GetImmediateU1() ? 0x2000'0000 : 0;
|
||||||
RegAlloc::Realize(Wnz);
|
|
||||||
|
|
||||||
code.LDR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
code.LDR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
||||||
code.AND(Wscratch0, Wscratch0, 0x10000000);
|
code.AND(Wscratch0, Wscratch0, 0x10000000);
|
||||||
code.ORR(Wscratch0, Wscratch0, Wnz);
|
if (carry) {
|
||||||
if (carry) {
|
code.ORR(Wscratch0, Wscratch0, carry);
|
||||||
code.ORR(Wscratch0, Wscratch0, carry);
|
}
|
||||||
|
code.STR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
||||||
|
} else {
|
||||||
|
auto Wc = ctx.reg_alloc.ReadW(args[1]);
|
||||||
|
RegAlloc::Realize(Wc);
|
||||||
|
|
||||||
|
code.LDR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
||||||
|
code.AND(Wscratch0, Wscratch0, 0x10000000);
|
||||||
|
code.ORR(Wscratch0, Wscratch0, Wc);
|
||||||
|
code.STR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
||||||
}
|
}
|
||||||
code.STR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
|
||||||
} else {
|
} else {
|
||||||
auto Wnz = ctx.reg_alloc.ReadW(args[0]);
|
if (args[1].IsImmediate()) {
|
||||||
auto Wc = ctx.reg_alloc.ReadW(args[1]);
|
const u32 carry = args[1].GetImmediateU1() ? 0x2000'0000 : 0;
|
||||||
RegAlloc::Realize(Wnz, Wc);
|
auto Wnz = ctx.reg_alloc.ReadW(args[0]);
|
||||||
|
RegAlloc::Realize(Wnz);
|
||||||
|
|
||||||
code.LDR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
code.LDR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
||||||
code.AND(Wscratch0, Wscratch0, 0x10000000);
|
code.AND(Wscratch0, Wscratch0, 0x10000000);
|
||||||
code.ORR(Wscratch0, Wscratch0, Wnz);
|
code.ORR(Wscratch0, Wscratch0, Wnz);
|
||||||
code.ORR(Wscratch0, Wscratch0, Wc);
|
if (carry) {
|
||||||
code.STR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
code.ORR(Wscratch0, Wscratch0, carry);
|
||||||
|
}
|
||||||
|
code.STR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
||||||
|
} else {
|
||||||
|
auto Wnz = ctx.reg_alloc.ReadW(args[0]);
|
||||||
|
auto Wc = ctx.reg_alloc.ReadW(args[1]);
|
||||||
|
RegAlloc::Realize(Wnz, Wc);
|
||||||
|
|
||||||
|
code.LDR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
||||||
|
code.AND(Wscratch0, Wscratch0, 0x10000000);
|
||||||
|
code.ORR(Wscratch0, Wscratch0, Wnz);
|
||||||
|
code.ORR(Wscratch0, Wscratch0, Wc);
|
||||||
|
code.STR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user