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,8 +713,16 @@ 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);
|
||||||
|
|
||||||
code.MOV(Rscratch0<bitsize>(), imm);
|
if (imm == 0) {
|
||||||
sub ? code.SBCS(Rresult, Ra, Rscratch0<bitsize>()) : code.ADCS(Rresult, Ra, Rscratch0<bitsize>());
|
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);
|
||||||
|
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