+ PXorPXor2PXor optimization

git-svn-id: trunk@45430 -
This commit is contained in:
florian 2020-05-18 21:28:45 +00:00
parent c3e10be898
commit 9b54588d75
3 changed files with 35 additions and 0 deletions

View File

@ -141,6 +141,9 @@ unit aoptcpu;
Result:=OptPass1And(p);
A_CMP:
Result:=OptPass1Cmp(p);
A_VPXOR,
A_PXOR:
Result:=OptPass1PXor(p);
A_FLD:
Result:=OptPass1FLD(p);
A_FSTP,A_FISTP:

View File

@ -130,6 +130,7 @@ unit aoptx86;
function OptPass1FSTP(var p : tai) : boolean;
function OptPass1FLD(var p : tai) : boolean;
function OptPass1Cmp(var p : tai) : boolean;
function OptPass1PXor(var p : tai) : boolean;
function OptPass2MOV(var p : tai) : boolean;
function OptPass2Imul(var p : tai) : boolean;
@ -3949,6 +3950,34 @@ unit aoptx86;
end;
function TX86AsmOptimizer.OptPass1PXor(var p: tai): boolean;
var
hp1: tai;
begin
{
remove the second (v)pxor from
(v)pxor reg,reg
...
(v)pxor reg,reg
}
Result:=false;
if MatchOperand(taicpu(p).oper[0]^,taicpu(p).oper[1]^) and
MatchOpType(taicpu(p),top_reg,top_reg) and
GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
MatchInstruction(taicpu(hp1),taicpu(p).opcode,[taicpu(p).opsize]) and
MatchOperand(taicpu(p).oper[0]^,taicpu(hp1).oper[0]^) and
MatchOperand(taicpu(hp1).oper[0]^,taicpu(hp1).oper[1]^) then
begin
DebugMsg(SPeepholeOptimization + 'PXorPXor2PXor done',hp1);
asml.Remove(hp1);
hp1.Free;
Result:=true;
Exit;
end;
end;
function TX86AsmOptimizer.OptPass2MOV(var p : tai) : boolean;
function IsXCHGAcceptable: Boolean; inline;

View File

@ -127,6 +127,9 @@ uses
result:=OptPass1FLD(p);
A_CMP:
result:=OptPass1Cmp(p);
A_VPXOR,
A_PXOR:
Result:=OptPass1PXor(p);
else
;
end;