From 77c86cafd08020fed213b65882ea4fd3ed411650 Mon Sep 17 00:00:00 2001 From: "J. Gareth \"Curious Kit\" Moreton" Date: Thu, 14 Mar 2024 03:00:34 +0000 Subject: [PATCH] * a64: Fixed bug where unsigned min/max inlines used a signed comparison --- compiler/aarch64/ncpuinl.pas | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/compiler/aarch64/ncpuinl.pas b/compiler/aarch64/ncpuinl.pas index 10de2d3b46..59ec33dc7b 100644 --- a/compiler/aarch64/ncpuinl.pas +++ b/compiler/aarch64/ncpuinl.pas @@ -400,6 +400,7 @@ implementation i: Integer; ai: taicpu; op: TAsmOp; + cond: TAsmCond; begin paraarray[1]:=tcallparanode(tcallparanode(parameters).nextpara).paravalue; paraarray[2]:=tcallparanode(parameters).paravalue; @@ -455,21 +456,23 @@ implementation paraarray[1].location.register,paraarray[2].location.register)); case inlinenumber of - in_min_dword, in_min_longint, - in_min_qword, in_min_int64: - current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg_cond(A_CSEL, - location.register,paraarray[1].location.register,paraarray[2].location.register,C_LT)); - in_max_dword, + cond := C_LT; + in_min_dword, + in_min_qword: + cond := C_LO; in_max_longint, - in_max_qword, in_max_int64: - current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg_cond(A_CSEL, - location.register,paraarray[1].location.register,paraarray[2].location.register,C_GT)); + cond := C_GT; + in_max_dword, + in_max_qword: + cond := C_HI; else Internalerror(2021121901); end; + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg_cond(A_CSEL, + location.register,paraarray[1].location.register,paraarray[2].location.register,cond)); end else internalerror(2021121801);