|
@@ -720,6 +720,7 @@ Implementation
|
|
|
var
|
|
|
hp1: tai;
|
|
|
GetNextInstructionUsingReg_hp1: Boolean;
|
|
|
+ so: tshifterop;
|
|
|
begin
|
|
|
Result:=false;
|
|
|
if GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) then
|
|
@@ -777,6 +778,26 @@ Implementation
|
|
|
p:=hp1;
|
|
|
result:=true;
|
|
|
end
|
|
|
+ else if MatchInstruction(hp1, [A_ADD,A_SUB], [C_None], [PF_None,PF_S]) and
|
|
|
+ (taicpu(p).ops=2) and
|
|
|
+ (taicpu(hp1).ops=3) and
|
|
|
+ MatchOperand(taicpu(hp1).oper[2]^, taicpu(p).oper[0]^.reg) and
|
|
|
+ not(MatchOperand(taicpu(hp1).oper[1]^, taicpu(p).oper[0]^.reg)) and
|
|
|
+ RegEndofLife(taicpu(p).oper[0]^.reg,taicpu(hp1)) and
|
|
|
+ { reg1 might not be modified inbetween }
|
|
|
+ not(RegModifiedBetween(taicpu(p).oper[1]^.reg,p,hp1)) then
|
|
|
+ begin
|
|
|
+ DebugMsg('Peephole SxtwOp2Op done', p);
|
|
|
+ AllocRegBetween(taicpu(p).oper[1]^.reg,p,hp1,UsedRegs);
|
|
|
+ taicpu(hp1).loadReg(2,taicpu(p).oper[1]^.reg);
|
|
|
+ taicpu(hp1).ops:=4;
|
|
|
+ shifterop_reset(so);
|
|
|
+ so.shiftmode:=SM_SXTW;
|
|
|
+ so.shiftimm:=0;
|
|
|
+ taicpu(hp1).loadshifterop(3,so);
|
|
|
+ RemoveCurrentP(p);
|
|
|
+ result:=true;
|
|
|
+ end
|
|
|
else if RemoveSuperfluousMove(p, hp1, 'SxtwMov2Data') then
|
|
|
Result:=true;
|
|
|
end;
|