emit_arm64_data_processing: EmitAddSub: Handle zero immediate w/ flag output
This commit is contained in:
parent
cd537dc711
commit
0692f1d40e
1 changed files with 10 additions and 2 deletions
|
@ -713,9 +713,17 @@ static void EmitAddSub(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst*
|
||||||
RegAlloc::Realize(Rresult, Ra);
|
RegAlloc::Realize(Rresult, Ra);
|
||||||
ctx.reg_alloc.ReadWriteFlags(args[2], nzcv_inst);
|
ctx.reg_alloc.ReadWriteFlags(args[2], nzcv_inst);
|
||||||
|
|
||||||
|
if (imm == 0) {
|
||||||
|
if constexpr (bitsize == 32) {
|
||||||
|
sub ? code.SBCS(Rresult, Ra, WZR) : code.ADCS(Rresult, Ra, WZR);
|
||||||
|
} else {
|
||||||
|
sub ? code.SBCS(Rresult, Ra, XZR) : code.ADCS(Rresult, Ra, XZR);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
code.MOV(Rscratch0<bitsize>(), imm);
|
code.MOV(Rscratch0<bitsize>(), imm);
|
||||||
sub ? code.SBCS(Rresult, Ra, Rscratch0<bitsize>()) : code.ADCS(Rresult, Ra, Rscratch0<bitsize>());
|
sub ? code.SBCS(Rresult, Ra, Rscratch0<bitsize>()) : code.ADCS(Rresult, Ra, Rscratch0<bitsize>());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
auto Rb = ctx.reg_alloc.ReadReg<bitsize>(args[1]);
|
auto Rb = ctx.reg_alloc.ReadReg<bitsize>(args[1]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue