* let the operation do the type conversion for x87 floating point operations

git-svn-id: trunk@43867 -
This commit is contained in:
florian 2020-01-05 17:47:23 +00:00
parent 89a961f960
commit fca4d3315b

View File

@ -77,7 +77,7 @@ unit nx86add;
symconst,symdef, symconst,symdef,
cgobj,hlcgobj,cgx86,cga,cgutils, cgobj,hlcgobj,cgx86,cga,cgutils,
tgobj,ncgutil, tgobj,ncgutil,
ncon,nset,ninl, ncon,nset,ninl,ncnv,
defutil, defutil,
htypechk; htypechk;
@ -1292,7 +1292,7 @@ unit nx86add;
ops_rdiv: array[boolean] of TAsmOp = (A_FDIVRP,A_FDIVR); ops_rdiv: array[boolean] of TAsmOp = (A_FDIVRP,A_FDIVR);
var var
op : TAsmOp; op : TAsmOp;
refnode : tnode; refnode, hp: tnode;
hasref : boolean; hasref : boolean;
begin begin
if use_vectorfpu(resultdef) then if use_vectorfpu(resultdef) then
@ -1304,6 +1304,22 @@ unit nx86add;
exit; exit;
end; end;
{ can the operation do the conversion? }
if (left.nodetype=typeconvn) and (is_double(ttypeconvnode(left).left.resultdef) or is_single(ttypeconvnode(left).left.resultdef)) then
begin
hp:=left;
left:=ttypeconvnode(left).left;
ttypeconvnode(hp).left:=nil;
hp.Free;
end;
if (right.nodetype=typeconvn) and (is_double(ttypeconvnode(right).left.resultdef) or is_single(ttypeconvnode(right).left.resultdef)) then
begin
hp:=right;
right:=ttypeconvnode(right).left;
ttypeconvnode(hp).left:=nil;
hp.Free;
end;
pass_left_right; pass_left_right;
prepare_x87_locations(refnode); prepare_x87_locations(refnode);
hasref:=assigned(refnode); hasref:=assigned(refnode);