mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-12 15:50:39 +02:00
* SubLea2Lea has to check both times for equal super registers, resolves the second part of #41126
This commit is contained in:
parent
83f9a94503
commit
125da5f10a
@ -7174,9 +7174,9 @@ unit aoptx86;
|
||||
begin
|
||||
OldOffset := taicpu(hp1).oper[0]^.ref^.offset;
|
||||
|
||||
if ActiveReg=taicpu(hp1).oper[0]^.ref^.base then
|
||||
if SuperRegistersEqual(ActiveReg,taicpu(hp1).oper[0]^.ref^.base) then
|
||||
Dec(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.val);
|
||||
if ActiveReg=taicpu(hp1).oper[0]^.ref^.index then
|
||||
if SuperRegistersEqual(ActiveReg,taicpu(hp1).oper[0]^.ref^.index) then
|
||||
Dec(taicpu(hp1).oper[0]^.ref^.offset,taicpu(p).oper[0]^.val*max(taicpu(hp1).oper[0]^.ref^.scalefactor,1));
|
||||
|
||||
{$ifdef x86_64}
|
||||
|
39
tests/webtbs/tw41126.pp
Normal file
39
tests/webtbs/tw41126.pp
Normal file
@ -0,0 +1,39 @@
|
||||
{ %opt=-O3 }
|
||||
program project2;
|
||||
|
||||
{$mode delphi}
|
||||
|
||||
{$OPTIMIZATION DFA}
|
||||
{$OPTIMIZATION FORLOOP}
|
||||
|
||||
type
|
||||
TRec = record
|
||||
EntryCount : sizeuint; { see TInterfaceTable.EntryCount }
|
||||
end;
|
||||
PRec = ^TRec;
|
||||
|
||||
const
|
||||
ANYCONST = 2;
|
||||
|
||||
function TestLoopUnsigned(Rec: PRec): Integer;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
for i := 0 to Rec^.EntryCount - ANYCONST do
|
||||
Inc(Result);
|
||||
end;
|
||||
|
||||
var
|
||||
Rec: TRec;
|
||||
N: SizeInt;
|
||||
begin
|
||||
Rec.EntryCount := ANYCONST;
|
||||
N := TestLoopUnsigned(@Rec);
|
||||
if N <> 1 then
|
||||
begin
|
||||
WriteLn('ERROR! N=', N);
|
||||
Halt(1);
|
||||
end;
|
||||
WriteLn('OK');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user