|
@@ -721,6 +721,7 @@ Implementation
|
|
hp1: tai;
|
|
hp1: tai;
|
|
GetNextInstructionUsingReg_hp1: Boolean;
|
|
GetNextInstructionUsingReg_hp1: Boolean;
|
|
so: tshifterop;
|
|
so: tshifterop;
|
|
|
|
+ opoffset: Integer;
|
|
begin
|
|
begin
|
|
Result:=false;
|
|
Result:=false;
|
|
if GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) then
|
|
if GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) then
|
|
@@ -770,23 +771,31 @@ Implementation
|
|
taicpu(hp1).loadReg(1,taicpu(p).oper[1]^.reg);
|
|
taicpu(hp1).loadReg(1,taicpu(p).oper[1]^.reg);
|
|
result:=RemoveCurrentP(p);
|
|
result:=RemoveCurrentP(p);
|
|
end
|
|
end
|
|
- else if MatchInstruction(hp1, [A_ADD,A_SUB], [C_None], [PF_None,PF_S]) and
|
|
|
|
- (taicpu(p).ops=2) and
|
|
|
|
|
|
+ else if (taicpu(p).ops=2) and
|
|
|
|
+ ((MatchInstruction(hp1, [A_ADD,A_SUB], [C_None], [PF_None,PF_S]) and
|
|
(taicpu(hp1).ops=3) 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
|
|
|
|
|
|
+ MatchOperand(taicpu(hp1).oper[2]^, taicpu(p).oper[0]^.reg) and
|
|
|
|
+ not(MatchOperand(taicpu(hp1).oper[1]^, taicpu(p).oper[0]^.reg))) or
|
|
|
|
+ (MatchInstruction(hp1, [A_CMP,A_CMN], [C_None], [PF_None]) and
|
|
|
|
+ (taicpu(hp1).ops=2) and
|
|
|
|
+ MatchOperand(taicpu(hp1).oper[1]^, taicpu(p).oper[0]^.reg))
|
|
|
|
+ ) and
|
|
RegEndofLife(taicpu(p).oper[0]^.reg,taicpu(hp1)) and
|
|
RegEndofLife(taicpu(p).oper[0]^.reg,taicpu(hp1)) and
|
|
{ reg1 might not be modified inbetween }
|
|
{ reg1 might not be modified inbetween }
|
|
not(RegModifiedBetween(taicpu(p).oper[1]^.reg,p,hp1)) then
|
|
not(RegModifiedBetween(taicpu(p).oper[1]^.reg,p,hp1)) then
|
|
begin
|
|
begin
|
|
DebugMsg('Peephole SxtwOp2Op done', p);
|
|
DebugMsg('Peephole SxtwOp2Op done', p);
|
|
AllocRegBetween(taicpu(p).oper[1]^.reg,p,hp1,UsedRegs);
|
|
AllocRegBetween(taicpu(p).oper[1]^.reg,p,hp1,UsedRegs);
|
|
- taicpu(hp1).loadReg(2,taicpu(p).oper[1]^.reg);
|
|
|
|
- taicpu(hp1).ops:=4;
|
|
|
|
|
|
+ if MatchInstruction(hp1, [A_CMP,A_CMN], [C_None], [PF_None]) then
|
|
|
|
+ opoffset:=0
|
|
|
|
+ else
|
|
|
|
+ opoffset:=1;
|
|
|
|
+ taicpu(hp1).loadReg(opoffset+1,taicpu(p).oper[1]^.reg);
|
|
|
|
+ taicpu(hp1).ops:=opoffset+3;
|
|
shifterop_reset(so);
|
|
shifterop_reset(so);
|
|
so.shiftmode:=SM_SXTW;
|
|
so.shiftmode:=SM_SXTW;
|
|
so.shiftimm:=0;
|
|
so.shiftimm:=0;
|
|
- taicpu(hp1).loadshifterop(3,so);
|
|
|
|
|
|
+ taicpu(hp1).loadshifterop(opoffset+2,so);
|
|
result:=RemoveCurrentP(p);
|
|
result:=RemoveCurrentP(p);
|
|
end
|
|
end
|
|
else if RemoveSuperfluousMove(p, hp1, 'SxtwMov2Data') then
|
|
else if RemoveSuperfluousMove(p, hp1, 'SxtwMov2Data') then
|