* don't modify the flags while simplifying PIC memory references

(mantis #15694)

git-svn-id: trunk@14871 -
This commit is contained in:
Jonas Maebe 2010-02-06 20:18:36 +00:00
parent b1d2ab5450
commit 89110baab8
3 changed files with 50 additions and 4 deletions

1
.gitattributes vendored
View File

@ -10278,6 +10278,7 @@ tests/webtbs/tw15619.pp svneol=native#text/plain
tests/webtbs/tw1567.pp svneol=native#text/plain
tests/webtbs/tw15690.pp svneol=native#text/plain
tests/webtbs/tw15693.pp svneol=native#text/plain
tests/webtbs/tw15694.pp svneol=native#text/plain
tests/webtbs/tw1573.pp svneol=native#text/plain
tests/webtbs/tw1592.pp svneol=native#text/plain
tests/webtbs/tw1617.pp svneol=native#text/plain

View File

@ -373,13 +373,20 @@ unit cgx86;
ref.index:=hreg
else
begin
{ don't use add, as the flags may contain a value }
reference_reset_base(href,ref.base,0,8);
href.index:=hreg;
if ref.scalefactor<>0 then
begin
list.concat(taicpu.op_reg_reg(A_ADD,S_Q,ref.base,hreg));
reference_reset_base(href,ref.base,0,8);
href.index:=hreg;
list.concat(taicpu.op_ref_reg(A_LEA,S_Q,href,hreg));
ref.base:=hreg;
end
else
begin
reference_reset_base(href,ref.index,0,8);
href.index:=hreg;
list.concat(taicpu.op_reg_reg(A_ADD,S_Q,ref.index,hreg));
ref.index:=hreg;
end;
@ -435,7 +442,10 @@ unit cgx86;
end
else
begin
list.concat(taicpu.op_reg_reg(A_ADD,S_Q,ref.base,hreg));
{ don't use add, as the flags may contain a value }
reference_reset_base(href,ref.base,0,8);
href.index:=hreg;
list.concat(taicpu.op_ref_reg(A_LEA,S_Q,href,hreg));
ref.base:=hreg;
end;
end
@ -467,7 +477,10 @@ unit cgx86;
end
else
begin
list.concat(taicpu.op_reg_reg(A_ADD,S_Q,ref.base,hreg));
{ don't use add, as the flags may contain a value }
reference_reset_base(href,ref.base,0,8);
href.index:=hreg;
list.concat(taicpu.op_ref_reg(A_LEA,S_Q,href,hreg));
ref.base:=hreg;
end;
end;
@ -525,7 +538,10 @@ unit cgx86;
end
else
begin
list.concat(taicpu.op_reg_reg(A_ADD,S_L,ref.base,hreg));
{ don't use add, as the flags may contain a value }
reference_reset_base(href,ref.base,0,8);
href.index:=hreg;
list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,hreg));
ref.base:=hreg;
end;
end;

29
tests/webtbs/tw15694.pp Normal file
View File

@ -0,0 +1,29 @@
type
TEn=array [0..63] of boolean;
var
WlEnb:array [0..511] of TEn;
procedure ReadMask;
var
I,ICd,J:ptrint;
b: boolean;
begin
for ICd:=0 to 10 do
begin
J:=icd;
{$R-}
for I:=0 to 3 do
begin
WlEnb[ICd,I]:=J and $01<>0;
b:=J and $01<>0;
if WlEnb[ICd,I]<>b then
halt(1);
J:=J shr 1;
end;
{$R+}
end;
end;
begin
readmask
end.