mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 23:21:57 +02:00
* ARM: look further ahead when optimizing mov rX, yyyy
* ARM: fix Mov0 and MovMLA2MUL optimizations git-svn-id: trunk@44244 -
This commit is contained in:
parent
9132b54b3b
commit
62129db44c
@ -1240,7 +1240,7 @@ Implementation
|
||||
....
|
||||
}
|
||||
if (taicpu(p).ops = 2) and
|
||||
GetNextInstruction(p,hp1) and
|
||||
GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
|
||||
(tai(hp1).typ = ait_instruction) then
|
||||
begin
|
||||
{
|
||||
@ -1249,7 +1249,7 @@ Implementation
|
||||
...
|
||||
mul ...,rX,...
|
||||
}
|
||||
if (taicpu(p).oper[1]^.typ = top_const) and
|
||||
if false and (taicpu(p).oper[1]^.typ = top_const) and
|
||||
(taicpu(p).oper[1]^.val=0) and
|
||||
MatchInstruction(hp1, [A_MUL,A_MLA], [taicpu(p).condition], [taicpu(p).oppostfix]) and
|
||||
(((taicpu(hp1).oper[1]^.typ=top_reg) and MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[1]^)) or
|
||||
@ -1258,14 +1258,14 @@ Implementation
|
||||
TransferUsedRegs(TmpUsedRegs);
|
||||
UpdateUsedRegs(TmpUsedRegs, tai(p.next));
|
||||
UpdateUsedRegs(TmpUsedRegs, tai(hp1.next));
|
||||
DebugMsg('Peephole Mul0 done', p);
|
||||
DebugMsg('Peephole MovMUL/MLA2Mov0 done', p);
|
||||
if taicpu(hp1).opcode=A_MUL then
|
||||
taicpu(hp1).loadconst(1,0)
|
||||
else
|
||||
taicpu(hp1).loadreg(1,taicpu(hp1).oper[3]^.reg);
|
||||
taicpu(hp1).ops:=2;
|
||||
taicpu(hp1).opcode:=A_MOV;
|
||||
if not(RegUsedAfterInstruction(taicpu(hp1).oper[0]^.reg,hp1,TmpUsedRegs)) then
|
||||
if not(RegUsedAfterInstruction(taicpu(p).oper[0]^.reg,hp1,TmpUsedRegs)) then
|
||||
RemoveCurrentP(p);
|
||||
Result:=true;
|
||||
exit;
|
||||
@ -1273,7 +1273,7 @@ Implementation
|
||||
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
|
||||
MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[3]^) then
|
||||
begin
|
||||
TransferUsedRegs(TmpUsedRegs);
|
||||
UpdateUsedRegs(TmpUsedRegs, tai(p.next));
|
||||
@ -1281,7 +1281,7 @@ Implementation
|
||||
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
|
||||
if not(RegUsedAfterInstruction(taicpu(p).oper[0]^.reg,hp1,TmpUsedRegs)) then
|
||||
RemoveCurrentP(p);
|
||||
Result:=true;
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user