From bbcc3966445438e2d97e07d21491a83e9b0bbb99 Mon Sep 17 00:00:00 2001 From: florian Date: Mon, 21 Jun 2021 21:36:32 +0000 Subject: [PATCH] * ARM: fix for Merge Add/Sub optimization git-svn-id: trunk@49520 - --- compiler/arm/aoptcpu.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/arm/aoptcpu.pas b/compiler/arm/aoptcpu.pas index 233dbe5fd1..4a3ef1e596 100644 --- a/compiler/arm/aoptcpu.pas +++ b/compiler/arm/aoptcpu.pas @@ -640,6 +640,10 @@ Implementation into add/sub rx,ry,const1+/-const + or + mov rx,ry if const1+/-const=0 + or + remove it, if rx=ry and const1+/-const=0 check if the first operation has no postfix and condition } @@ -664,7 +668,13 @@ Implementation Result:=true; if newvalue=0 then begin - RemoveCurrentP(p); + if MatchOperand(taicpu(p).oper[0]^,taicpu(p).oper[1]^) then + RemoveCurrentP(p) + else + begin + taicpu(p).opcode:=A_MOV; + taicpu(p).ops:=2; + end; Exit; end; end;