* x86: avoid to put variables into registers if they are handled by the x87-FPU

git-svn-id: trunk@43856 -
This commit is contained in:
florian 2020-01-03 22:23:49 +00:00
parent 7da6bac960
commit 3c16324f80

View File

@ -47,6 +47,7 @@ unit nx86add;
procedure second_addfloatsse;
procedure second_addfloatavx;
public
function pass_1 : tnode;override;
function use_fma : boolean;override;
procedure second_addfloat;override;
{$ifndef i8086}
@ -77,7 +78,8 @@ unit nx86add;
cgobj,hlcgobj,cgx86,cga,cgutils,
tgobj,ncgutil,
ncon,nset,ninl,
defutil;
defutil,
htypechk;
{ Range check must be disabled explicitly as the code serves
on three different architecture sizes }
@ -1146,6 +1148,21 @@ unit nx86add;
end;
function tx86addnode.pass_1: tnode;
begin
{ on x86, we do not support fpu registers, so in case of operations using the x87, it
is normally useful, not to put the operands into registers which would be mm register }
if ((left.resultdef.typ=floatdef) or (right.resultdef.typ=floatdef)) and
(not(use_vectorfpu(left.resultdef)) and not(use_vectorfpu(right.resultdef)) and
not(use_vectorfpu(resultdef))) then
begin
make_not_regable(left,[ra_addr_regable]);
make_not_regable(right,[ra_addr_regable]);
end;
Result:=inherited pass_1;
end;
function tx86addnode.use_fma : boolean;
begin
{$ifndef i8086}