|
@@ -3360,67 +3360,168 @@ unit aoptx86;
|
|
|
if (taicpu(p).oper[1]^.reg <> NR_STACK_POINTER_REG) and
|
|
|
GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[1]^.reg) then
|
|
|
begin
|
|
|
- { changes
|
|
|
- lea offset1(regX), reg1
|
|
|
- lea offset2(reg1), reg1
|
|
|
- to
|
|
|
- lea offset1+offset2(regX), reg1 }
|
|
|
-
|
|
|
+ { Check common LEA/LEA conditions }
|
|
|
if MatchInstruction(hp1,A_LEA,[taicpu(p).opsize]) and
|
|
|
- MatchOperand(taicpu(p).oper[1]^,taicpu(hp1).oper[1]^) and
|
|
|
- (taicpu(p).oper[0]^.ref^.relsymbol=nil) and
|
|
|
- (taicpu(p).oper[0]^.ref^.segment=NR_NO) and
|
|
|
- (taicpu(p).oper[0]^.ref^.symbol=nil) and
|
|
|
- (((taicpu(hp1).oper[0]^.ref^.base=taicpu(p).oper[1]^.reg) and
|
|
|
- (taicpu(p).oper[0]^.ref^.scalefactor <= 1) and
|
|
|
- (taicpu(p).oper[0]^.ref^.index=NR_NO) and
|
|
|
- (taicpu(p).oper[0]^.ref^.index=taicpu(hp1).oper[0]^.ref^.index) and
|
|
|
- (taicpu(p).oper[0]^.ref^.scalefactor=taicpu(hp1).oper[0]^.ref^.scalefactor)
|
|
|
- ) or
|
|
|
- ((taicpu(hp1).oper[0]^.ref^.index=taicpu(p).oper[1]^.reg) and
|
|
|
- (taicpu(p).oper[0]^.ref^.index=NR_NO)
|
|
|
- ) or
|
|
|
- ((taicpu(hp1).oper[0]^.ref^.base=taicpu(p).oper[1]^.reg) and
|
|
|
- (taicpu(hp1).oper[0]^.ref^.scalefactor <= 1) and
|
|
|
- ((taicpu(p).oper[0]^.ref^.base=NR_NO) or
|
|
|
- ((taicpu(p).oper[0]^.ref^.base=taicpu(p).oper[0]^.ref^.base) and
|
|
|
- (taicpu(p).oper[0]^.ref^.index=NR_NO)
|
|
|
- )
|
|
|
- ) and
|
|
|
- not(RegUsedBetween(taicpu(p).oper[0]^.ref^.index,p,hp1)))
|
|
|
- ) and
|
|
|
- not(RegUsedBetween(taicpu(p).oper[0]^.ref^.base,p,hp1)) and
|
|
|
- (taicpu(p).oper[0]^.ref^.relsymbol=taicpu(hp1).oper[0]^.ref^.relsymbol) and
|
|
|
- (taicpu(p).oper[0]^.ref^.segment=taicpu(hp1).oper[0]^.ref^.segment) and
|
|
|
- (taicpu(p).oper[0]^.ref^.symbol=taicpu(hp1).oper[0]^.ref^.symbol) then
|
|
|
+ (taicpu(p).oper[1]^.reg = taicpu(hp1).oper[1]^.reg) and
|
|
|
+ (taicpu(p).oper[0]^.ref^.relsymbol = nil) and
|
|
|
+ (taicpu(p).oper[0]^.ref^.segment = NR_NO) and
|
|
|
+ (taicpu(p).oper[0]^.ref^.symbol = nil) and
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.relsymbol = nil) and
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.segment = NR_NO) and
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.symbol = nil) and
|
|
|
+ (
|
|
|
+ (taicpu(p).oper[0]^.ref^.base = NR_NO) or { Don't call RegModifiedBetween unnecessarily }
|
|
|
+ not(RegModifiedBetween(taicpu(p).oper[0]^.ref^.base,p,hp1))
|
|
|
+ ) and (
|
|
|
+ (taicpu(p).oper[0]^.ref^.index = taicpu(p).oper[0]^.ref^.base) or { Don't call RegModifiedBetween unnecessarily }
|
|
|
+ (taicpu(p).oper[0]^.ref^.index = NR_NO) or
|
|
|
+ not(RegModifiedBetween(taicpu(p).oper[0]^.ref^.index,p,hp1))
|
|
|
+ ) then
|
|
|
begin
|
|
|
- DebugMsg(SPeepholeOptimization + 'LeaLea2Lea done',p);
|
|
|
- if taicpu(hp1).oper[0]^.ref^.index=taicpu(p).oper[1]^.reg then
|
|
|
+ { changes
|
|
|
+ lea (regX,scale), reg1
|
|
|
+ lea offset(reg1,reg1), reg1
|
|
|
+ to
|
|
|
+ lea offset(regX,scale*2), reg1
|
|
|
+
|
|
|
+ and
|
|
|
+ lea (regX,scale1), reg1
|
|
|
+ lea offset(reg1,scale2), reg1
|
|
|
+ to
|
|
|
+ lea offset(regX,scale1*scale2), reg1
|
|
|
+
|
|
|
+ ... so long as the final scale does not exceed 8
|
|
|
+
|
|
|
+ (Similarly, allow the first instruction to be "lea (regX,regX),reg1")
|
|
|
+ }
|
|
|
+ if (taicpu(p).oper[0]^.ref^.offset = 0) and
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.index = taicpu(p).oper[1]^.reg) and
|
|
|
+ (
|
|
|
+ (
|
|
|
+ (taicpu(p).oper[0]^.ref^.base = NR_NO)
|
|
|
+ ) or (
|
|
|
+ (taicpu(p).oper[0]^.ref^.scalefactor <= 1) and
|
|
|
+ (
|
|
|
+ (taicpu(p).oper[0]^.ref^.base = taicpu(p).oper[0]^.ref^.index) and
|
|
|
+ not(RegUsedBetween(taicpu(p).oper[0]^.ref^.index, p, hp1))
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ) and (
|
|
|
+ (
|
|
|
+ { lea (reg1,scale2), reg1 variant }
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.base = NR_NO) and
|
|
|
+ (
|
|
|
+ (
|
|
|
+ (taicpu(p).oper[0]^.ref^.base = NR_NO) and
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.scalefactor * taicpu(p).oper[0]^.ref^.scalefactor <= 8)
|
|
|
+ ) or (
|
|
|
+ { lea (regX,regX), reg1 variant }
|
|
|
+ (taicpu(p).oper[0]^.ref^.base <> NR_NO) and
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.scalefactor <= 4)
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ) or (
|
|
|
+ { lea (reg1,reg1), reg1 variant }
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.base = taicpu(p).oper[1]^.reg) and
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.scalefactor <= 1)
|
|
|
+ )
|
|
|
+ ) then
|
|
|
begin
|
|
|
- taicpu(hp1).oper[0]^.ref^.index:=taicpu(p).oper[0]^.ref^.base;
|
|
|
- inc(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.ref^.offset*max(taicpu(hp1).oper[0]^.ref^.scalefactor,1));
|
|
|
- { if the register is used as index and base, we have to increase for base as well
|
|
|
- and adapt base }
|
|
|
- if taicpu(hp1).oper[0]^.ref^.base=taicpu(p).oper[1]^.reg then
|
|
|
+ DebugMsg(SPeepholeOptimization + 'LeaLea2Lea 2 done',p);
|
|
|
+
|
|
|
+ { Make everything homogeneous to make calculations easier }
|
|
|
+ if (taicpu(p).oper[0]^.ref^.base <> NR_NO) then
|
|
|
begin
|
|
|
- taicpu(hp1).oper[0]^.ref^.base:=taicpu(p).oper[0]^.ref^.base;
|
|
|
- inc(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.ref^.offset);
|
|
|
+ if taicpu(p).oper[0]^.ref^.index <> NR_NO then
|
|
|
+ { Convert lea (regX,regX),reg1 to lea (regX,2),reg1 }
|
|
|
+ taicpu(p).oper[0]^.ref^.scalefactor := 2
|
|
|
+ else
|
|
|
+ taicpu(p).oper[0]^.ref^.index := taicpu(p).oper[0]^.ref^.base;
|
|
|
+
|
|
|
+ taicpu(p).oper[0]^.ref^.base := NR_NO;
|
|
|
end;
|
|
|
+
|
|
|
+ if (taicpu(hp1).oper[0]^.ref^.base = NR_NO) then
|
|
|
+ begin
|
|
|
+ { Just to prevent miscalculations }
|
|
|
+ if (taicpu(hp1).oper[0]^.ref^.scalefactor = 0) then
|
|
|
+ taicpu(hp1).oper[0]^.ref^.scalefactor := taicpu(p).oper[0]^.ref^.scalefactor
|
|
|
+ else
|
|
|
+ taicpu(hp1).oper[0]^.ref^.scalefactor := taicpu(hp1).oper[0]^.ref^.scalefactor * taicpu(p).oper[0]^.ref^.scalefactor;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ taicpu(hp1).oper[0]^.ref^.base := NR_NO;
|
|
|
+ taicpu(hp1).oper[0]^.ref^.scalefactor := taicpu(p).oper[0]^.ref^.scalefactor * 2;
|
|
|
+ end;
|
|
|
+
|
|
|
+ taicpu(hp1).oper[0]^.ref^.index := taicpu(p).oper[0]^.ref^.index;
|
|
|
+ RemoveCurrentP(p);
|
|
|
+ result:=true;
|
|
|
+ exit;
|
|
|
end
|
|
|
- else
|
|
|
- begin
|
|
|
- inc(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.ref^.offset);
|
|
|
- taicpu(hp1).oper[0]^.ref^.base:=taicpu(p).oper[0]^.ref^.base;
|
|
|
- end;
|
|
|
- if taicpu(p).oper[0]^.ref^.index<>NR_NO then
|
|
|
+
|
|
|
+ { changes
|
|
|
+ lea offset1(regX), reg1
|
|
|
+ lea offset2(reg1), reg1
|
|
|
+ to
|
|
|
+ lea offset1+offset2(regX), reg1 }
|
|
|
+ else if
|
|
|
+ (
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.index = taicpu(p).oper[1]^.reg) and
|
|
|
+ (taicpu(p).oper[0]^.ref^.index = NR_NO)
|
|
|
+ ) or (
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.base = taicpu(p).oper[1]^.reg) and
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.scalefactor <= 1) and
|
|
|
+ (
|
|
|
+ (
|
|
|
+ (taicpu(p).oper[0]^.ref^.index = NR_NO) or
|
|
|
+ (taicpu(p).oper[0]^.ref^.base = NR_NO)
|
|
|
+ ) or (
|
|
|
+ (taicpu(p).oper[0]^.ref^.scalefactor <= 1) and
|
|
|
+ (
|
|
|
+ (taicpu(p).oper[0]^.ref^.index = NR_NO) or
|
|
|
+ (
|
|
|
+ (taicpu(p).oper[0]^.ref^.index = taicpu(p).oper[0]^.ref^.base) and
|
|
|
+ (
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.index = NR_NO) or
|
|
|
+ (taicpu(hp1).oper[0]^.ref^.base = NR_NO)
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ) then
|
|
|
begin
|
|
|
- taicpu(hp1).oper[0]^.ref^.base:=taicpu(hp1).oper[0]^.ref^.index;
|
|
|
- taicpu(hp1).oper[0]^.ref^.index:=taicpu(p).oper[0]^.ref^.index;
|
|
|
- taicpu(hp1).oper[0]^.ref^.scalefactor:=taicpu(p).oper[0]^.ref^.scalefactor;
|
|
|
+ DebugMsg(SPeepholeOptimization + 'LeaLea2Lea 1 done',p);
|
|
|
+
|
|
|
+ if taicpu(hp1).oper[0]^.ref^.index=taicpu(p).oper[1]^.reg then
|
|
|
+ begin
|
|
|
+ taicpu(hp1).oper[0]^.ref^.index:=taicpu(p).oper[0]^.ref^.base;
|
|
|
+ inc(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.ref^.offset*max(taicpu(hp1).oper[0]^.ref^.scalefactor,1));
|
|
|
+ { if the register is used as index and base, we have to increase for base as well
|
|
|
+ and adapt base }
|
|
|
+ if taicpu(hp1).oper[0]^.ref^.base=taicpu(p).oper[1]^.reg then
|
|
|
+ begin
|
|
|
+ taicpu(hp1).oper[0]^.ref^.base:=taicpu(p).oper[0]^.ref^.base;
|
|
|
+ inc(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.ref^.offset);
|
|
|
+ end;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ inc(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.ref^.offset);
|
|
|
+ taicpu(hp1).oper[0]^.ref^.base:=taicpu(p).oper[0]^.ref^.base;
|
|
|
+ end;
|
|
|
+ if taicpu(p).oper[0]^.ref^.index<>NR_NO then
|
|
|
+ begin
|
|
|
+ taicpu(hp1).oper[0]^.ref^.base:=taicpu(hp1).oper[0]^.ref^.index;
|
|
|
+ taicpu(hp1).oper[0]^.ref^.index:=taicpu(p).oper[0]^.ref^.index;
|
|
|
+ taicpu(hp1).oper[0]^.ref^.scalefactor:=taicpu(p).oper[0]^.ref^.scalefactor;
|
|
|
+ end;
|
|
|
+ RemoveCurrentP(p);
|
|
|
+ result:=true;
|
|
|
+ exit;
|
|
|
end;
|
|
|
- RemoveCurrentP(p);
|
|
|
- result:=true;
|
|
|
- exit;
|
|
|
end;
|
|
|
|
|
|
{ Change:
|
|
@@ -3890,76 +3991,92 @@ unit aoptx86;
|
|
|
begin
|
|
|
Result:=false;
|
|
|
|
|
|
- if MatchOpType(taicpu(p),top_reg) and
|
|
|
- GetNextInstruction(p, hp1) and
|
|
|
- ((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
|
|
|
- MatchOpType(taicpu(hp1),top_const,top_reg) and
|
|
|
- (taicpu(hp1).oper[0]^.val=0))
|
|
|
- ) and
|
|
|
- (taicpu(p).oper[0]^.reg = taicpu(hp1).oper[1]^.reg) and
|
|
|
- GetNextInstruction(hp1, hp2) and
|
|
|
- MatchInstruction(hp2, A_Jcc, []) then
|
|
|
- { Change from: To:
|
|
|
-
|
|
|
- set(C) %reg j(~C) label
|
|
|
- test %reg,%reg/cmp $0,%reg
|
|
|
- je label
|
|
|
-
|
|
|
-
|
|
|
- set(C) %reg j(C) label
|
|
|
- test %reg,%reg/cmp $0,%reg
|
|
|
- jne label
|
|
|
- }
|
|
|
+ if MatchOpType(taicpu(p),top_reg) and GetNextInstruction(p, hp1) then
|
|
|
begin
|
|
|
- next := tai(p.Next);
|
|
|
+ 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
|
|
|
+ MatchOpType(taicpu(hp1),top_const,top_reg) and
|
|
|
+ (taicpu(hp1).oper[0]^.val=0))
|
|
|
+ ) and
|
|
|
+ (taicpu(p).oper[0]^.reg = taicpu(hp1).oper[1]^.reg) and
|
|
|
+ GetNextInstruction(hp1, hp2) and
|
|
|
+ MatchInstruction(hp2, A_Jcc, []) then
|
|
|
+ { Change from: To:
|
|
|
|
|
|
- TransferUsedRegs(TmpUsedRegs);
|
|
|
- UpdateUsedRegs(TmpUsedRegs, next);
|
|
|
- UpdateUsedRegs(TmpUsedRegs, tai(hp1.next));
|
|
|
+ set(C) %reg j(~C) label
|
|
|
+ test %reg,%reg/cmp $0,%reg
|
|
|
+ je label
|
|
|
|
|
|
- JumpC := taicpu(hp2).condition;
|
|
|
- Unconditional := False;
|
|
|
|
|
|
- if conditions_equal(JumpC, C_E) then
|
|
|
- SetC := inverse_cond(taicpu(p).condition)
|
|
|
- else if conditions_equal(JumpC, C_NE) then
|
|
|
- SetC := taicpu(p).condition
|
|
|
- else
|
|
|
- { We've got something weird here (and inefficent) }
|
|
|
+ set(C) %reg j(C) label
|
|
|
+ test %reg,%reg/cmp $0,%reg
|
|
|
+ jne label
|
|
|
+ }
|
|
|
begin
|
|
|
- DebugMsg('DEBUG: Inefficient jump - check code generation', p);
|
|
|
- SetC := C_NONE;
|
|
|
+ next := tai(p.Next);
|
|
|
+
|
|
|
+ TransferUsedRegs(TmpUsedRegs);
|
|
|
+ UpdateUsedRegs(TmpUsedRegs, next);
|
|
|
+ UpdateUsedRegs(TmpUsedRegs, tai(hp1.next));
|
|
|
|
|
|
- { JAE/JNB will always branch (use 'condition_in', since C_AE <> C_NB normally) }
|
|
|
- if condition_in(C_AE, JumpC) then
|
|
|
- Unconditional := True
|
|
|
+ JumpC := taicpu(hp2).condition;
|
|
|
+ Unconditional := False;
|
|
|
+
|
|
|
+ if conditions_equal(JumpC, C_E) then
|
|
|
+ SetC := inverse_cond(taicpu(p).condition)
|
|
|
+ else if conditions_equal(JumpC, C_NE) then
|
|
|
+ SetC := taicpu(p).condition
|
|
|
else
|
|
|
- { Not sure what to do with this jump - drop out }
|
|
|
- Exit;
|
|
|
- end;
|
|
|
+ { We've got something weird here (and inefficent) }
|
|
|
+ begin
|
|
|
+ DebugMsg('DEBUG: Inefficient jump - check code generation', p);
|
|
|
+ SetC := C_NONE;
|
|
|
|
|
|
- RemoveInstruction(hp1);
|
|
|
+ { JAE/JNB will always branch (use 'condition_in', since C_AE <> C_NB normally) }
|
|
|
+ if condition_in(C_AE, JumpC) then
|
|
|
+ Unconditional := True
|
|
|
+ else
|
|
|
+ { Not sure what to do with this jump - drop out }
|
|
|
+ Exit;
|
|
|
+ end;
|
|
|
|
|
|
- if Unconditional then
|
|
|
- MakeUnconditional(taicpu(hp2))
|
|
|
- else
|
|
|
- begin
|
|
|
- if SetC = C_NONE then
|
|
|
- InternalError(2018061402);
|
|
|
+ RemoveInstruction(hp1);
|
|
|
|
|
|
- taicpu(hp2).SetCondition(SetC);
|
|
|
- end;
|
|
|
+ if Unconditional then
|
|
|
+ MakeUnconditional(taicpu(hp2))
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ if SetC = C_NONE then
|
|
|
+ InternalError(2018061402);
|
|
|
+
|
|
|
+ taicpu(hp2).SetCondition(SetC);
|
|
|
+ end;
|
|
|
+
|
|
|
+ if not RegUsedAfterInstruction(taicpu(p).oper[0]^.reg, hp2, TmpUsedRegs) then
|
|
|
+ begin
|
|
|
+ RemoveCurrentp(p, hp2);
|
|
|
+ Result := True;
|
|
|
+ end;
|
|
|
|
|
|
- if not RegUsedAfterInstruction(taicpu(p).oper[0]^.reg, hp2, TmpUsedRegs) then
|
|
|
+ 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
|
|
|
- RemoveCurrentp(p, hp2);
|
|
|
- Result := True;
|
|
|
+ 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;
|
|
|
-
|
|
|
- DebugMsg(SPeepholeOptimization + 'SETcc/TESTCmp/Jcc -> Jcc',p);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
@@ -5251,6 +5368,25 @@ unit aoptx86;
|
|
|
if not MatchOpType(taicpu(hp1), top_reg, top_reg) then
|
|
|
Break;
|
|
|
|
|
|
+ if not SuperRegistersEqual(taicpu(hp1).oper[0]^.reg, ThisReg) then
|
|
|
+ begin
|
|
|
+ { Because hp1 was obtained via GetNextInstructionUsingReg
|
|
|
+ and ThisReg doesn't appear in the first operand, it
|
|
|
+ must appear in the second operand and hence gets
|
|
|
+ overwritten }
|
|
|
+ if (InstrMax = -1) and
|
|
|
+ Reg1WriteOverwritesReg2Entirely(taicpu(hp1).oper[1]^.reg, ThisReg) then
|
|
|
+ begin
|
|
|
+ { The two MOVZX instructions are adjacent, so remove the first one }
|
|
|
+ DebugMsg(SPeepholeOptimization + 'Movzx2Nop 5', p);
|
|
|
+ RemoveCurrentP(p);
|
|
|
+ Result := True;
|
|
|
+ Exit;
|
|
|
+ end;
|
|
|
+
|
|
|
+ Break;
|
|
|
+ end;
|
|
|
+
|
|
|
{ The objective here is to try to find a combination that
|
|
|
removes one of the MOV/Z instructions. }
|
|
|
case taicpu(hp1).opsize of
|
|
@@ -5363,8 +5499,7 @@ unit aoptx86;
|
|
|
((TargetSize = S_W) and (taicpu(hp1).opsize in [S_W, S_BW])) then
|
|
|
begin
|
|
|
{ Convert the output MOVZX to a MOV }
|
|
|
- if (taicpu(hp1).oper[0]^.typ = top_reg) and
|
|
|
- SuperRegistersEqual(taicpu(hp1).oper[1]^.reg, ThisReg) then
|
|
|
+ if SuperRegistersEqual(taicpu(hp1).oper[1]^.reg, ThisReg) then
|
|
|
begin
|
|
|
{ Or remove it completely! }
|
|
|
DebugMsg(SPeepholeOptimization + 'Movzx2Nop 2', hp1);
|