mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 21:29:28 +02:00
+ SETcc/Mov -> SETcc optimization
git-svn-id: trunk@48808 -
This commit is contained in:
parent
857cbddf04
commit
c6443809ba
@ -3991,9 +3991,9 @@ unit aoptx86;
|
||||
begin
|
||||
Result:=false;
|
||||
|
||||
if MatchOpType(taicpu(p),top_reg) and
|
||||
GetNextInstruction(p, hp1) and
|
||||
((MatchInstruction(hp1, A_TEST, [S_B]) and
|
||||
if MatchOpType(taicpu(p),top_reg) and GetNextInstruction(p, hp1) then
|
||||
begin
|
||||
if ((MatchInstruction(hp1, A_TEST, [S_B]) and
|
||||
MatchOpType(taicpu(hp1),top_reg,top_reg) and
|
||||
(taicpu(hp1).oper[0]^.reg = taicpu(hp1).oper[1]^.reg)) or
|
||||
(MatchInstruction(hp1, A_CMP, [S_B]) and
|
||||
@ -4061,6 +4061,22 @@ unit aoptx86;
|
||||
end;
|
||||
|
||||
DebugMsg(SPeepholeOptimization + 'SETcc/TESTCmp/Jcc -> Jcc',p);
|
||||
end
|
||||
else if MatchInstruction(hp1, A_MOV, [S_B]) and
|
||||
MatchOpType(taicpu(hp1),top_reg,top_reg) and
|
||||
MatchOperand(taicpu(p).oper[0]^,taicpu(hp1).oper[0]^) then
|
||||
begin
|
||||
TransferUsedRegs(TmpUsedRegs);
|
||||
UpdateUsedRegs(TmpUsedRegs, tai(p.Next));
|
||||
if not RegUsedAfterInstruction(taicpu(p).oper[0]^.reg, hp1, TmpUsedRegs) then
|
||||
begin
|
||||
AllocRegBetween(taicpu(p).oper[0]^.reg,p,hp1,UsedRegs);
|
||||
taicpu(p).oper[0]^.reg:=taicpu(hp1).oper[1]^.reg;
|
||||
RemoveInstruction(hp1);
|
||||
DebugMsg(SPeepholeOptimization + 'SETcc/Mov -> SETcc',p);
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user