Browse Source

+ ARM: MovMLA2MUL optimization

git-svn-id: trunk@44243 -
florian 5 years ago
parent
commit
9132b54b3b
1 changed files with 16 additions and 0 deletions
  1. 16 0
      compiler/arm/aoptcpu.pas

+ 16 - 0
compiler/arm/aoptcpu.pas

@@ -1270,6 +1270,22 @@ Implementation
                               Result:=true;
                               Result:=true;
                               exit;
                               exit;
                             end
                             end
+                        else if (taicpu(p).oper[1]^.typ = top_const) and
+                          (taicpu(p).oper[1]^.val=0) and
+                          MatchInstruction(hp1, A_MLA, [taicpu(p).condition], [taicpu(p).oppostfix]) and
+                          MatchOperand(taicpu(p).oper[3]^, taicpu(hp1).oper[1]^) then
+                            begin
+                              TransferUsedRegs(TmpUsedRegs);
+                              UpdateUsedRegs(TmpUsedRegs, tai(p.next));
+                              UpdateUsedRegs(TmpUsedRegs, tai(hp1.next));
+                              DebugMsg('Peephole MovMLA2MUL 1 done', p);
+                              taicpu(hp1).ops:=3;
+                              taicpu(hp1).opcode:=A_MUL;
+                              if not(RegUsedAfterInstruction(taicpu(hp1).oper[0]^.reg,hp1,TmpUsedRegs)) then
+                                RemoveCurrentP(p);
+                              Result:=true;
+                              exit;
+                            end
                         {
                         {
                           This changes the very common
                           This changes the very common
                           mov r0, #0
                           mov r0, #0