mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 14:30:52 +02:00
+ RiscV: SltiuAndi2Sltiu optimization
This commit is contained in:
parent
a90e4358c0
commit
7a19bc012a
@ -729,8 +729,9 @@ implementation
|
||||
if (taicpu(p).ops=3) and
|
||||
(taicpu(p).oper[2]^.typ=top_const) and
|
||||
(taicpu(p).oper[2]^.val=1) and
|
||||
GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and
|
||||
MatchInstruction(hp1,A_Bxx,[C_NE,C_EQ]) and
|
||||
GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) then
|
||||
begin
|
||||
if MatchInstruction(hp1,A_Bxx,[C_NE,C_EQ]) and
|
||||
(taicpu(hp1).ops=3) and
|
||||
MatchOperand(taicpu(hp1).oper[0]^,taicpu(p).oper[0]^) and
|
||||
MatchOperand(taicpu(hp1).oper[1]^,NR_X0) and
|
||||
@ -745,6 +746,19 @@ implementation
|
||||
RemoveInstr(p);
|
||||
|
||||
result:=true;
|
||||
end
|
||||
else if MatchInstruction(hp1,A_ANDI) and
|
||||
(taicpu(hp1).ops=3) and
|
||||
(taicpu(p).oper[2]^.val>0) and
|
||||
MatchOperand(taicpu(hp1).oper[1]^,taicpu(p).oper[0]^) and
|
||||
MatchOperand(taicpu(hp1).oper[0]^,taicpu(hp1).oper[1]^) then
|
||||
begin
|
||||
DebugMsg('Peephole SltiuAndi2Sltiu performed', hp1);
|
||||
|
||||
RemoveInstr(hp1);
|
||||
|
||||
result:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user