mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 02:06:10 +02:00
+ Addi2Nop optimization
This commit is contained in:
parent
91d3746adf
commit
c45d03851a
@ -265,6 +265,21 @@ implementation
|
|||||||
hp1: tai;
|
hp1: tai;
|
||||||
begin
|
begin
|
||||||
result:=false;
|
result:=false;
|
||||||
|
{
|
||||||
|
Get rid of
|
||||||
|
addi x, x, 0
|
||||||
|
}
|
||||||
|
if (taicpu(p).ops=3) and
|
||||||
|
(taicpu(p).oper[2]^.typ=top_const) and
|
||||||
|
(taicpu(p).oper[2]^.val=0) and
|
||||||
|
MatchOperand(taicpu(p).oper[0]^,taicpu(p).oper[1]^) then
|
||||||
|
begin
|
||||||
|
DebugMsg('Peephole Addi2Nop performed', p);
|
||||||
|
|
||||||
|
RemoveInstr(p);
|
||||||
|
|
||||||
|
result:=true;
|
||||||
|
end
|
||||||
{
|
{
|
||||||
Changes
|
Changes
|
||||||
addi x, y, #
|
addi x, y, #
|
||||||
@ -273,7 +288,7 @@ implementation
|
|||||||
To
|
To
|
||||||
addi z, y, #+#
|
addi z, y, #+#
|
||||||
}
|
}
|
||||||
if (taicpu(p).ops=3) and
|
else if (taicpu(p).ops=3) and
|
||||||
(taicpu(p).oper[2]^.typ=top_const) and
|
(taicpu(p).oper[2]^.typ=top_const) and
|
||||||
GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and
|
GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and
|
||||||
MatchInstruction(hp1,[A_ADDI{$ifdef riscv64},A_ADDIW{$endif}]) and
|
MatchInstruction(hp1,[A_ADDI{$ifdef riscv64},A_ADDIW{$endif}]) and
|
||||||
|
Loading…
Reference in New Issue
Block a user