emit_arm64_saturation: Fix UnsignedSaturation for < 0
This commit is contained in:
parent
b059384bc0
commit
6d6cbe2e66
1 changed files with 3 additions and 1 deletions
|
@ -114,8 +114,10 @@ void EmitIR<IR::Opcode::UnsignedSaturation>(oaknut::CodeGenerator& code, EmitCon
|
|||
const u32 saturated_value = (1u << N) - 1;
|
||||
|
||||
code.MOV(Wscratch0, saturated_value);
|
||||
code.CMP(*Woperand, 0);
|
||||
code.CSEL(Wresult, Woperand, WZR, GT);
|
||||
code.CMP(*Woperand, Wscratch0);
|
||||
code.CSEL(Wresult, Woperand, Wscratch0, LS);
|
||||
code.CSEL(Wresult, Wresult, Wscratch0, LT);
|
||||
|
||||
if (overflow_inst) {
|
||||
auto Woverflow = ctx.reg_alloc.WriteW(overflow_inst);
|
||||
|
|
Loading…
Reference in a new issue