* i386: Fixed issue where the peephole optimizer entered an infinite loop when building for CPUs older than Pentium II

This commit is contained in:
J. Gareth "Curious Kit" Moreton 2024-04-24 06:13:58 +01:00 committed by FPK
parent 0655b342d4
commit 17b7782929

View File

@ -14871,30 +14871,37 @@ unit aoptx86;
MatchOpType(taicpu(hp1),top_const,top_reg) and
(taicpu(hp1).oper[1]^.reg = taicpu(p).oper[1]^.reg) then
begin
//taicpu(p).opcode := A_MOV;
case taicpu(p).opsize Of
S_BL:
if (taicpu(hp1).opsize <> S_L) or
(taicpu(hp1).oper[0]^.val > $FF) then
begin
DebugMsg(SPeepholeOptimization + 'var13',p);
taicpu(hp1).changeopsize(S_L);
taicpu(hp1).loadConst(0,taicpu(hp1).oper[0]^.val and $ff);
Include(OptsToCheck, aoc_ForceNewIteration);
end;
S_WL:
if (taicpu(hp1).opsize <> S_L) or
(taicpu(hp1).oper[0]^.val > $FFFF) then
begin
DebugMsg(SPeepholeOptimization + 'var14',p);
taicpu(hp1).changeopsize(S_L);
taicpu(hp1).loadConst(0,taicpu(hp1).oper[0]^.val and $ffff);
Include(OptsToCheck, aoc_ForceNewIteration);
end;
S_BW:
if (taicpu(hp1).opsize <> S_W) or
(taicpu(hp1).oper[0]^.val > $FF) then
begin
DebugMsg(SPeepholeOptimization + 'var15',p);
taicpu(hp1).changeopsize(S_W);
taicpu(hp1).loadConst(0,taicpu(hp1).oper[0]^.val and $ff);
Include(OptsToCheck, aoc_ForceNewIteration);
end;
else
Internalerror(2017050704)
end;
Result := True;
end;
end;
end;