* handle flag to reg./ref. conversion correctly for boolean64

git-svn-id: trunk@19914 -
This commit is contained in:
florian 2011-12-29 17:28:35 +00:00
parent 7070fef055
commit c4a5499d2a
5 changed files with 48 additions and 15 deletions

3
.gitattributes vendored
View File

@ -11975,7 +11975,8 @@ tests/webtbs/tw20836.pp svneol=native#text/pascal
tests/webtbs/tw20872a.pp svneol=native#text/pascal
tests/webtbs/tw20872b.pp svneol=native#text/pascal
tests/webtbs/tw20872c.pp svneol=native#text/pascal
tests/webtbs/tw20874.pp svneol=native#text/pascal
tests/webtbs/tw20874a.pp svneol=native#text/pascal
tests/webtbs/tw20874b.pp svneol=native#text/pascal
tests/webtbs/tw20889.pp svneol=native#text/pascal
tests/webtbs/tw2109.pp svneol=native#text/plain
tests/webtbs/tw2110.pp svneol=native#text/plain

View File

@ -944,7 +944,15 @@ implementation
begin
case left.location.loc of
LOC_REGISTER,LOC_CREGISTER:
cg.g_flags2reg(current_asmdata.CurrAsmList,left.location.size,right.location.resflags,left.location.register);
{$ifdef cpu32bitalu}
if left.location.size in [OS_S64,OS_64] then
begin
cg.g_flags2reg(current_asmdata.CurrAsmList,OS_32,right.location.resflags,left.location.register64.reglo);
cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,left.location.register64.reghi);
end
else
{$endif cpu32bitalu}
cg.g_flags2reg(current_asmdata.CurrAsmList,left.location.size,right.location.resflags,left.location.register);
LOC_REFERENCE:
cg.g_flags2ref(current_asmdata.CurrAsmList,left.location.size,right.location.resflags,left.location.reference);
LOC_SUBSETREG,LOC_SUBSETREF:

View File

@ -1775,19 +1775,26 @@ unit cgx86;
end;
procedure tcgx86.g_flags2ref(list: TAsmList; size: TCgSize; const f: tresflags; const ref: TReference);
var
ai : taicpu;
tmpref : treference;
begin
tmpref:=ref;
make_simple_ref(list,tmpref);
if not(size in [OS_8,OS_S8]) then
a_load_const_ref(list,size,0,tmpref);
ai:=Taicpu.op_ref(A_SETcc,S_B,tmpref);
ai.setcondition(flags_to_cond(f));
list.concat(ai);
end;
procedure tcgx86.g_flags2ref(list: TAsmList; size: TCgSize; const f: tresflags; const ref: TReference);
var
ai : taicpu;
tmpref : treference;
begin
tmpref:=ref;
make_simple_ref(list,tmpref);
if not(size in [OS_8,OS_S8]) then
a_load_const_ref(list,size,0,tmpref);
ai:=Taicpu.op_ref(A_SETcc,S_B,tmpref);
ai.setcondition(flags_to_cond(f));
list.concat(ai);
{$ifndef cpu64bitalu}
if size in [OS_S64,OS_64] then
begin
inc(tmpref.offset,4);
a_load_const_ref(list,OS_32,0,tmpref);
end;
{$endif cpu64bitalu}
end;
{ ************* concatcopy ************ }

17
tests/webtbs/tw20874b.pp Normal file
View File

@ -0,0 +1,17 @@
program qwordbooltest;
{$mode objfpc}{$H+}
var
A, B : Boolean64;
begin
A := True;
// here it fails: qwordbooltest.pas(12,3) Fatal: Internal error 200109227
B := not A;
if B then
halt(1);
writeln('ok');
end.