mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 14:49:10 +02:00
+ sqr uses sse on x86 if possible
* the result type of sqr is equal to the argument in case of usual floats git-svn-id: trunk@1265 -
This commit is contained in:
parent
c15e0911e5
commit
6371333361
@ -1206,6 +1206,20 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure setfloatresulttype;
|
||||||
|
begin
|
||||||
|
if (left.resulttype.def.deftype=floatdef) and
|
||||||
|
(tfloatdef(left.resulttype.def).typ in [s32real,s64real,s80real,s128real]) then
|
||||||
|
resulttype:=left.resulttype
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
inserttypeconv(left,pbestrealtype^);
|
||||||
|
resulttype:=pbestrealtype^;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
vl,vl2 : TConstExprInt;
|
vl,vl2 : TConstExprInt;
|
||||||
vr : bestreal;
|
vr : bestreal;
|
||||||
@ -1935,8 +1949,7 @@ implementation
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
set_varstate(left,vs_used,[vsf_must_be_valid]);
|
set_varstate(left,vs_used,[vsf_must_be_valid]);
|
||||||
inserttypeconv(left,pbestrealtype^);
|
setfloatresulttype;
|
||||||
resulttype:=pbestrealtype^;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -245,10 +245,20 @@ implementation
|
|||||||
|
|
||||||
procedure tx86inlinenode.second_sqr_real;
|
procedure tx86inlinenode.second_sqr_real;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if use_sse(resulttype.def) then
|
||||||
|
begin
|
||||||
|
secondpass(left);
|
||||||
|
location_force_mmregscalar(exprasmlist,left.location,false);
|
||||||
|
location:=left.location;
|
||||||
|
cg.a_opmm_loc_reg(exprasmlist,OP_MUL,left.location.size,left.location,left.location.register,mms_movescalar);
|
||||||
|
end
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
load_fpu_location;
|
load_fpu_location;
|
||||||
emit_reg_reg(A_FMUL,S_NO,NR_ST0,NR_ST0);
|
emit_reg_reg(A_FMUL,S_NO,NR_ST0,NR_ST0);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure tx86inlinenode.second_sqrt_real;
|
procedure tx86inlinenode.second_sqrt_real;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user