mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 11:29:27 +02:00
* try to registers more cleverly during fma code generation
git-svn-id: trunk@27671 -
This commit is contained in:
parent
704f018183
commit
33602db802
@ -830,10 +830,29 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
hlcg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,paraarray[3].resultdef,resultdef,
|
||||
paraarray[3].location.register,location.register,mms_movescalar);
|
||||
emit_reg_reg_reg(op[tfloatdef(resultdef).floattype,0],S_NO,
|
||||
paraarray[1].location.register,paraarray[2].location.register,location.register);
|
||||
{ try to use the location which is already in a temp. mm register as destination,
|
||||
so the compiler might be able to re-use the register }
|
||||
if paraarray[1].location.loc=LOC_MMREGISTER then
|
||||
begin
|
||||
hlcg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,paraarray[1].resultdef,resultdef,
|
||||
paraarray[1].location.register,location.register,mms_movescalar);
|
||||
emit_reg_reg_reg(op[tfloatdef(resultdef).floattype,3],S_NO,
|
||||
paraarray[3].location.register,paraarray[2].location.register,location.register);
|
||||
end
|
||||
else if paraarray[2].location.loc=LOC_MMREGISTER then
|
||||
begin
|
||||
hlcg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,paraarray[2].resultdef,resultdef,
|
||||
paraarray[2].location.register,location.register,mms_movescalar);
|
||||
emit_reg_reg_reg(op[tfloatdef(resultdef).floattype,3],S_NO,
|
||||
paraarray[3].location.register,paraarray[1].location.register,location.register);
|
||||
end
|
||||
else
|
||||
begin
|
||||
hlcg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,paraarray[3].resultdef,resultdef,
|
||||
paraarray[3].location.register,location.register,mms_movescalar);
|
||||
emit_reg_reg_reg(op[tfloatdef(resultdef).floattype,0],S_NO,
|
||||
paraarray[1].location.register,paraarray[2].location.register,location.register);
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
|
@ -19,6 +19,16 @@ procedure testsingle;
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1+1.0,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>13.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1,l1+1.0,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(s1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
@ -63,6 +73,17 @@ procedure testdouble;
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(l1+1.0,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>13.0 then
|
||||
halt(1);
|
||||
|
||||
|
||||
l0:=fma(l1,l1+1.0,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
halt(1);
|
||||
|
||||
l0:=fma(d1,l2,l3);
|
||||
writeln(l0);
|
||||
if l0<>10.0 then
|
||||
|
Loading…
Reference in New Issue
Block a user