From 7a0c79de6052b1677fe3b1a465e6c39d5e9d917b Mon Sep 17 00:00:00 2001 From: masta Date: Thu, 31 Jul 2014 23:09:33 +0000 Subject: [PATCH] Fix for AndLsl2Lsl in ARM Peephole optimizer AndLsl2Lsl assigned the wrong register to the remaining instruction, and also did not check for the register. git-svn-id: trunk@28285 - --- compiler/arm/aoptcpu.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/arm/aoptcpu.pas b/compiler/arm/aoptcpu.pas index 039b6f6634..1ef7a1657a 100644 --- a/compiler/arm/aoptcpu.pas +++ b/compiler/arm/aoptcpu.pas @@ -1583,13 +1583,14 @@ Implementation and reg1,reg0,2^n-1 mov reg2,reg1, lsl imm1 => - mov reg2,reg1, lsl imm1 + mov reg2,reg0, lsl imm1 if imm1>i } - else if i>32-taicpu(hp1).oper[2]^.shifterop^.shiftimm then + else if (i>32-taicpu(hp1).oper[2]^.shifterop^.shiftimm) and + not(RegModifiedBetween(taicpu(p).oper[1]^.reg, p, hp1)) then begin DebugMsg('Peephole AndLsl2Lsl done', p); - taicpu(hp1).oper[1]^.reg:=taicpu(p).oper[0]^.reg; + taicpu(hp1).oper[1]^.reg:=taicpu(p).oper[1]^.reg; GetNextInstruction(p, hp1); asml.Remove(p); p.free;