* bug #580 fixed

This commit is contained in:
florian 1999-09-04 20:50:08 +00:00
parent d2c3613518
commit 96dd7c82fa
3 changed files with 100 additions and 57 deletions

View File

@ -57,63 +57,79 @@ implementation
hp1 : pai; hp1 : pai;
lastlabel : pasmlabel; lastlabel : pasmlabel;
realait : tait; realait : tait;
begin begin
lastlabel:=nil; if (p^.value_real=1.0) then
realait:=floattype2ait[pfloatdef(p^.resulttype)^.typ];
{ const already used ? }
if not assigned(p^.lab_real) then
begin begin
{ tries to found an old entry } emit_none(A_FLD1,S_NO);
hp1:=pai(consts^.first); p^.location.loc:=LOC_FPU;
while assigned(hp1) do inc(fpuvaroffset);
begin end
if hp1^.typ=ait_label then else if (p^.value_real=0.0) then
lastlabel:=pai_label(hp1)^.l begin
else emit_none(A_FLDZ,S_NO);
begin p^.location.loc:=LOC_FPU;
if (hp1^.typ=realait) and (lastlabel<>nil) then inc(fpuvaroffset);
begin end
if( else
((realait=ait_real_32bit) and (pai_real_32bit(hp1)^.value=p^.value_real)) or begin
((realait=ait_real_64bit) and (pai_real_64bit(hp1)^.value=p^.value_real)) or lastlabel:=nil;
((realait=ait_real_80bit) and (pai_real_80bit(hp1)^.value=p^.value_real)) or realait:=floattype2ait[pfloatdef(p^.resulttype)^.typ];
((realait=ait_comp_64bit) and (pai_comp_64bit(hp1)^.value=p^.value_real)) { const already used ? }
) then
begin
{ found! }
p^.lab_real:=lastlabel;
break;
end;
end;
lastlabel:=nil;
end;
hp1:=pai(hp1^.next);
end;
{ :-(, we must generate a new entry }
if not assigned(p^.lab_real) then if not assigned(p^.lab_real) then
begin begin
getdatalabel(lastlabel); { tries to found an old entry }
p^.lab_real:=lastlabel; hp1:=pai(consts^.first);
if (cs_smartlink in aktmoduleswitches) then while assigned(hp1) do
consts^.concat(new(pai_cut,init)); begin
consts^.concat(new(pai_label,init(lastlabel))); if hp1^.typ=ait_label then
case realait of lastlabel:=pai_label(hp1)^.l
ait_real_32bit : else
consts^.concat(new(pai_real_32bit,init(p^.value_real))); begin
ait_real_64bit : if (hp1^.typ=realait) and (lastlabel<>nil) then
consts^.concat(new(pai_real_64bit,init(p^.value_real))); begin
ait_real_80bit : if(
consts^.concat(new(pai_real_80bit,init(p^.value_real))); ((realait=ait_real_32bit) and (pai_real_32bit(hp1)^.value=p^.value_real)) or
ait_comp_64bit : ((realait=ait_real_64bit) and (pai_real_64bit(hp1)^.value=p^.value_real)) or
consts^.concat(new(pai_comp_64bit,init(p^.value_real))); ((realait=ait_real_80bit) and (pai_real_80bit(hp1)^.value=p^.value_real)) or
else ((realait=ait_comp_64bit) and (pai_comp_64bit(hp1)^.value=p^.value_real))
internalerror(10120); ) then
end; begin
{ found! }
p^.lab_real:=lastlabel;
break;
end;
end;
lastlabel:=nil;
end;
hp1:=pai(hp1^.next);
end;
{ :-(, we must generate a new entry }
if not assigned(p^.lab_real) then
begin
getdatalabel(lastlabel);
p^.lab_real:=lastlabel;
if (cs_smartlink in aktmoduleswitches) then
consts^.concat(new(pai_cut,init));
consts^.concat(new(pai_label,init(lastlabel)));
case realait of
ait_real_32bit :
consts^.concat(new(pai_real_32bit,init(p^.value_real)));
ait_real_64bit :
consts^.concat(new(pai_real_64bit,init(p^.value_real)));
ait_real_80bit :
consts^.concat(new(pai_real_80bit,init(p^.value_real)));
ait_comp_64bit :
consts^.concat(new(pai_comp_64bit,init(p^.value_real)));
else
internalerror(10120);
end;
end;
end; end;
reset_reference(p^.location.reference);
p^.location.reference.symbol:=p^.lab_real;
p^.location.loc:=LOC_MEM;
end; end;
reset_reference(p^.location.reference);
p^.location.reference.symbol:=p^.lab_real;
p^.location.loc:=LOC_MEM;
end; end;
@ -401,7 +417,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.39 1999-08-04 00:22:45 florian Revision 1.40 1999-09-04 20:53:06 florian
* bug 580 fixed
Revision 1.39 1999/08/04 00:22:45 florian
* renamed i386asm and i386base to cpuasm and cpubase * renamed i386asm and i386base to cpuasm and cpubase
Revision 1.38 1999/08/03 22:02:38 peter Revision 1.38 1999/08/03 22:02:38 peter

View File

@ -696,11 +696,23 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
reset_reference(p^.location.reference); reset_reference(p^.location.reference);
gettempofsizereference(10,p^.location.reference); gettempofsizereference(10,p^.location.reference);
floatstore(pfloatdef(p^.resulttype)^.typ,p^.location.reference); floatstore(pfloatdef(p^.resulttype)^.typ,p^.location.reference);
p^.location.loc:=LOC_REFERENCE; { This can't be never a l-value! (FK)
p^.location.loc:=LOC_REFERENCE; }
p^.location.loc:=LOC_MEM;
end; end;
LOC_MEM, LOC_MEM,
LOC_REFERENCE : ; LOC_REFERENCE : ;
else LOC_CFPUREGISTER : begin
emit_reg(A_FLD,S_NO,correct_fpuregister(p^.location.register,fpuvaroffset));
inc(fpuvaroffset);
reset_reference(p^.location.reference);
gettempofsizereference(10,p^.location.reference);
floatstore(pfloatdef(p^.resulttype)^.typ,p^.location.reference);
{ This can't be never a l-value! (FK)
p^.location.loc:=LOC_REFERENCE; }
p^.location.loc:=LOC_MEM;
end;
else
internalerror(333); internalerror(333);
end; end;
end; end;
@ -3294,7 +3306,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end. end.
{ {
$Log$ $Log$
Revision 1.37 1999-09-02 17:07:38 florian Revision 1.38 1999-09-04 20:50:08 florian
* bug 580 fixed
Revision 1.37 1999/09/02 17:07:38 florian
* problems with -Or fixed: tdef.isfpuregable was wrong! * problems with -Or fixed: tdef.isfpuregable was wrong!
Revision 1.36 1999/09/01 09:26:23 peter Revision 1.36 1999/09/01 09:26:23 peter

View File

@ -47,7 +47,13 @@ implementation
procedure firstrealconst(var p : ptree); procedure firstrealconst(var p : ptree);
begin begin
p^.location.loc:=LOC_MEM; if (p^.value_real=1.0) or (p^.value_real=0.0) then
begin
p^.location.loc:=LOC_FPU;
p^.registersfpu:=1;
end
else
p^.location.loc:=LOC_MEM;
end; end;
@ -119,7 +125,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.8 1999-08-04 00:23:38 florian Revision 1.9 1999-09-04 20:52:07 florian
* bug 580 fixed
Revision 1.8 1999/08/04 00:23:38 florian
* renamed i386asm and i386base to cpuasm and cpubase * renamed i386asm and i386base to cpuasm and cpubase
Revision 1.7 1999/08/03 22:03:29 peter Revision 1.7 1999/08/03 22:03:29 peter