From a90691435bbca123be9a9ce39c76bbccb7e70fcc Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 30 Mar 2024 20:29:48 +0100 Subject: [PATCH] + abs(long/int64): overflow checking for xtensa implemented --- compiler/xtensa/ncpuinl.pas | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/compiler/xtensa/ncpuinl.pas b/compiler/xtensa/ncpuinl.pas index de5364dd0d..9943be4496 100644 --- a/compiler/xtensa/ncpuinl.pas +++ b/compiler/xtensa/ncpuinl.pas @@ -58,13 +58,30 @@ unit ncpuinl; cpubase; procedure tcpuinlinenode.second_abs_long; + var + hl: TAsmLabel; begin + if is_64bitint(resultdef) then + begin + inherited second_abs_long; + exit; + end; + secondpass(left); hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false); location:=left.location; location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,left.resultdef); + if cs_check_overflow in current_settings.localswitches then + begin + current_asmdata.getjumplabel(hl); + + hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,resultdef,OC_NE,$80000000,left.location.register,hl); + hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_overflow',[],nil).resetiftemp; + hlcg.a_label(current_asmdata.CurrAsmList,hl); + end; + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_ABS,location.register,left.location.register)); end;