diff --git a/compiler/x86/nx86add.pas b/compiler/x86/nx86add.pas index 73992573de..ae258cbe69 100644 --- a/compiler/x86/nx86add.pas +++ b/compiler/x86/nx86add.pas @@ -77,7 +77,7 @@ unit nx86add; symconst,symdef, cgobj,hlcgobj,cgx86,cga,cgutils, tgobj,ncgutil, - ncon,nset,ninl, + ncon,nset,ninl,ncnv, defutil, htypechk; @@ -1292,7 +1292,7 @@ unit nx86add; ops_rdiv: array[boolean] of TAsmOp = (A_FDIVRP,A_FDIVR); var op : TAsmOp; - refnode : tnode; + refnode, hp: tnode; hasref : boolean; begin if use_vectorfpu(resultdef) then @@ -1304,6 +1304,22 @@ unit nx86add; exit; 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; prepare_x87_locations(refnode); hasref:=assigned(refnode);