mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:09:17 +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
|
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
|
(tai(hp1).typ = ait_instruction) then
|
||||||
begin
|
begin
|
||||||
{
|
{
|
||||||
@ -1249,7 +1249,7 @@ Implementation
|
|||||||
...
|
...
|
||||||
mul ...,rX,...
|
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
|
(taicpu(p).oper[1]^.val=0) and
|
||||||
MatchInstruction(hp1, [A_MUL,A_MLA], [taicpu(p).condition], [taicpu(p).oppostfix]) 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
|
(((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);
|
TransferUsedRegs(TmpUsedRegs);
|
||||||
UpdateUsedRegs(TmpUsedRegs, tai(p.next));
|
UpdateUsedRegs(TmpUsedRegs, tai(p.next));
|
||||||
UpdateUsedRegs(TmpUsedRegs, tai(hp1.next));
|
UpdateUsedRegs(TmpUsedRegs, tai(hp1.next));
|
||||||
DebugMsg('Peephole Mul0 done', p);
|
DebugMsg('Peephole MovMUL/MLA2Mov0 done', p);
|
||||||
if taicpu(hp1).opcode=A_MUL then
|
if taicpu(hp1).opcode=A_MUL then
|
||||||
taicpu(hp1).loadconst(1,0)
|
taicpu(hp1).loadconst(1,0)
|
||||||
else
|
else
|
||||||
taicpu(hp1).loadreg(1,taicpu(hp1).oper[3]^.reg);
|
taicpu(hp1).loadreg(1,taicpu(hp1).oper[3]^.reg);
|
||||||
taicpu(hp1).ops:=2;
|
taicpu(hp1).ops:=2;
|
||||||
taicpu(hp1).opcode:=A_MOV;
|
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);
|
RemoveCurrentP(p);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
exit;
|
exit;
|
||||||
@ -1273,7 +1273,7 @@ Implementation
|
|||||||
else if (taicpu(p).oper[1]^.typ = top_const) and
|
else if (taicpu(p).oper[1]^.typ = top_const) and
|
||||||
(taicpu(p).oper[1]^.val=0) and
|
(taicpu(p).oper[1]^.val=0) and
|
||||||
MatchInstruction(hp1, A_MLA, [taicpu(p).condition], [taicpu(p).oppostfix]) 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
|
begin
|
||||||
TransferUsedRegs(TmpUsedRegs);
|
TransferUsedRegs(TmpUsedRegs);
|
||||||
UpdateUsedRegs(TmpUsedRegs, tai(p.next));
|
UpdateUsedRegs(TmpUsedRegs, tai(p.next));
|
||||||
@ -1281,7 +1281,7 @@ Implementation
|
|||||||
DebugMsg('Peephole MovMLA2MUL 1 done', p);
|
DebugMsg('Peephole MovMLA2MUL 1 done', p);
|
||||||
taicpu(hp1).ops:=3;
|
taicpu(hp1).ops:=3;
|
||||||
taicpu(hp1).opcode:=A_MUL;
|
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);
|
RemoveCurrentP(p);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
exit;
|
exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user