mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 02:49:28 +02:00
* avr: apply LdiOp2Opi optimization also to and and sub
git-svn-id: trunk@43352 -
This commit is contained in:
parent
828e961f3d
commit
ae04e5d7f0
@ -377,14 +377,14 @@ Implementation
|
|||||||
begin
|
begin
|
||||||
{ turn
|
{ turn
|
||||||
ldi reg0, imm
|
ldi reg0, imm
|
||||||
cp/mov reg1, reg0
|
<op> reg1, reg0
|
||||||
dealloc reg0
|
dealloc reg0
|
||||||
into
|
into
|
||||||
cpi/ldi reg1, imm
|
<op>i reg1, imm
|
||||||
}
|
}
|
||||||
if MatchOpType(taicpu(p),top_reg,top_const) and
|
if MatchOpType(taicpu(p),top_reg,top_const) and
|
||||||
GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and
|
GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and
|
||||||
MatchInstruction(hp1,[A_CP,A_MOV],2) and
|
MatchInstruction(hp1,[A_CP,A_MOV,A_AND,A_SUB],2) and
|
||||||
(not RegModifiedBetween(taicpu(p).oper[0]^.reg, p, hp1)) and
|
(not RegModifiedBetween(taicpu(p).oper[0]^.reg, p, hp1)) and
|
||||||
MatchOpType(taicpu(hp1),top_reg,top_reg) and
|
MatchOpType(taicpu(hp1),top_reg,top_reg) and
|
||||||
(getsupreg(taicpu(hp1).oper[0]^.reg) in [16..31]) and
|
(getsupreg(taicpu(hp1).oper[0]^.reg) in [16..31]) and
|
||||||
@ -392,6 +392,8 @@ Implementation
|
|||||||
not(MatchOperand(taicpu(hp1).oper[0]^,taicpu(hp1).oper[1]^)) then
|
not(MatchOperand(taicpu(hp1).oper[0]^,taicpu(hp1).oper[1]^)) then
|
||||||
begin
|
begin
|
||||||
TransferUsedRegs(TmpUsedRegs);
|
TransferUsedRegs(TmpUsedRegs);
|
||||||
|
UpdateUsedRegs(TmpUsedRegs,tai(p.next));
|
||||||
|
UpdateUsedRegs(TmpUsedRegs,tai(hp1.next));
|
||||||
if not(RegUsedAfterInstruction(taicpu(hp1).oper[1]^.reg, hp1, TmpUsedRegs)) then
|
if not(RegUsedAfterInstruction(taicpu(hp1).oper[1]^.reg, hp1, TmpUsedRegs)) then
|
||||||
begin
|
begin
|
||||||
case taicpu(hp1).opcode of
|
case taicpu(hp1).opcode of
|
||||||
@ -399,6 +401,10 @@ Implementation
|
|||||||
taicpu(hp1).opcode:=A_CPI;
|
taicpu(hp1).opcode:=A_CPI;
|
||||||
A_MOV:
|
A_MOV:
|
||||||
taicpu(hp1).opcode:=A_LDI;
|
taicpu(hp1).opcode:=A_LDI;
|
||||||
|
A_AND:
|
||||||
|
taicpu(hp1).opcode:=A_ANDI;
|
||||||
|
A_SUB:
|
||||||
|
taicpu(hp1).opcode:=A_SUBI;
|
||||||
else
|
else
|
||||||
internalerror(2016111901);
|
internalerror(2016111901);
|
||||||
end;
|
end;
|
||||||
@ -415,7 +421,7 @@ Implementation
|
|||||||
dealloc.Free;
|
dealloc.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DebugMsg('Peephole LdiMov/Cp2Ldi/Cpi performed', p);
|
DebugMsg('Peephole LdiOp2Opi performed', p);
|
||||||
|
|
||||||
RemoveCurrentP(p);
|
RemoveCurrentP(p);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user