mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 02:45:58 +02:00
* x86: Updated Mov0LblCmp0Jne optimisation to work when alignment hints appear before the label
This commit is contained in:
parent
a1064ad8fd
commit
9fc2b9062d
@ -8565,6 +8565,7 @@ unit aoptx86;
|
|||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
case hp1.typ of
|
case hp1.typ of
|
||||||
|
ait_align,
|
||||||
ait_label:
|
ait_label:
|
||||||
begin
|
begin
|
||||||
{ Change:
|
{ Change:
|
||||||
@ -8584,11 +8585,10 @@ unit aoptx86;
|
|||||||
|
|
||||||
(Not if it's optimised for size)
|
(Not if it's optimised for size)
|
||||||
}
|
}
|
||||||
if not GetNextInstruction(hp1, hp2) then
|
if not SkipAligns(hp1, hp1) or not GetNextInstruction(hp1, hp2) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if not (cs_opt_size in current_settings.optimizerswitches) and
|
if (hp2.typ = ait_instruction) and
|
||||||
(hp2.typ = ait_instruction) and
|
|
||||||
(
|
(
|
||||||
{ Register sizes must exactly match }
|
{ Register sizes must exactly match }
|
||||||
(
|
(
|
||||||
@ -8663,10 +8663,21 @@ unit aoptx86;
|
|||||||
increases the reference count) }
|
increases the reference count) }
|
||||||
NewInstr.loadsymbol(0, DestLabel, 0);
|
NewInstr.loadsymbol(0, DestLabel, 0);
|
||||||
|
|
||||||
{ Get instruction before original label (may not be p under -O3) }
|
if (cs_opt_level3 in current_settings.optimizerswitches) then
|
||||||
if not GetLastInstruction(hp1, hp2) then
|
begin
|
||||||
{ Shouldn't fail here }
|
{ Get instruction before original label (may not be p under -O3) }
|
||||||
InternalError(2021040701);
|
if not GetLastInstruction(hp1, hp2) then
|
||||||
|
{ Shouldn't fail here }
|
||||||
|
InternalError(2021040701);
|
||||||
|
|
||||||
|
{ Before the aligns too }
|
||||||
|
while (hp2.typ = ait_align) do
|
||||||
|
if not GetLastInstruction(hp2, hp2) then
|
||||||
|
{ Shouldn't fail here }
|
||||||
|
InternalError(2021040702);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
hp2 := p;
|
||||||
|
|
||||||
taicpu(NewInstr).fileinfo := taicpu(hp2).fileinfo;
|
taicpu(NewInstr).fileinfo := taicpu(hp2).fileinfo;
|
||||||
AsmL.InsertAfter(NewInstr, hp2);
|
AsmL.InsertAfter(NewInstr, hp2);
|
||||||
|
Loading…
Reference in New Issue
Block a user