mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:09:17 +02:00
* use maytrap instead of strict FP exception behaviour in LLVM, so constant
propagation is still allowed git-svn-id: trunk@43832 -
This commit is contained in:
parent
76ab36b41d
commit
ec0d98156c
@ -146,7 +146,7 @@ implementation
|
|||||||
function llvm_constrainedexceptmodestring: ansistring;
|
function llvm_constrainedexceptmodestring: ansistring;
|
||||||
begin
|
begin
|
||||||
if not(cs_opt_fastmath in current_settings.optimizerswitches) then
|
if not(cs_opt_fastmath in current_settings.optimizerswitches) then
|
||||||
result:='fpexcept.strict'
|
result:='fpexcept.maytrap'
|
||||||
else
|
else
|
||||||
result:='fpexcept.ignore'
|
result:='fpexcept.ignore'
|
||||||
end;
|
end;
|
||||||
|
@ -1346,6 +1346,7 @@ implementation
|
|||||||
|
|
||||||
procedure thlcgllvm.gen_fpconstrained_intrinsic(list: TAsmList; const intrinsic: TIDString; fromsize, tosize: tdef; fromreg, toreg: tregister; roundingmode: boolean);
|
procedure thlcgllvm.gen_fpconstrained_intrinsic(list: TAsmList; const intrinsic: TIDString; fromsize, tosize: tdef; fromreg, toreg: tregister; roundingmode: boolean);
|
||||||
var
|
var
|
||||||
|
exceptmode: ansistring;
|
||||||
frompara, roundpara, exceptpara, respara: tcgpara;
|
frompara, roundpara, exceptpara, respara: tcgpara;
|
||||||
tmploc: tlocation;
|
tmploc: tlocation;
|
||||||
pd: tprocdef;
|
pd: tprocdef;
|
||||||
@ -1370,7 +1371,8 @@ implementation
|
|||||||
gen_load_loc_cgpara(list,fromsize,tmploc,frompara);
|
gen_load_loc_cgpara(list,fromsize,tmploc,frompara);
|
||||||
if roundingmode then
|
if roundingmode then
|
||||||
a_load_reg_cgpara(list,llvm_metadatatype,tllvmmetadata.getstringreg('round.dynamic'),roundpara);
|
a_load_reg_cgpara(list,llvm_metadatatype,tllvmmetadata.getstringreg('round.dynamic'),roundpara);
|
||||||
a_load_reg_cgpara(list,llvm_metadatatype,tllvmmetadata.getstringreg('fpexcept.strict'),exceptpara);
|
exceptmode:=llvm_constrainedexceptmodestring;
|
||||||
|
a_load_reg_cgpara(list,llvm_metadatatype,tllvmmetadata.getstringreg(exceptmode),exceptpara);
|
||||||
if roundingmode then
|
if roundingmode then
|
||||||
respara:=g_call_system_proc(list,pd,[@frompara,@roundpara,@exceptpara],nil)
|
respara:=g_call_system_proc(list,pd,[@frompara,@roundpara,@exceptpara],nil)
|
||||||
else
|
else
|
||||||
|
@ -50,7 +50,7 @@ implementation
|
|||||||
verbose,globtype,globals,cutils,
|
verbose,globtype,globals,cutils,
|
||||||
aasmdata,
|
aasmdata,
|
||||||
symconst,symtype,symdef,defutil,
|
symconst,symtype,symdef,defutil,
|
||||||
llvmbase,aasmllvm,
|
llvmbase,aasmllvm,aasmllvmmetadata,
|
||||||
cgbase,cgutils,pass_1,
|
cgbase,cgutils,pass_1,
|
||||||
hlcgobj,
|
hlcgobj,
|
||||||
nadd,ncal,ncnv,ncon
|
nadd,ncal,ncnv,ncon
|
||||||
@ -60,6 +60,7 @@ implementation
|
|||||||
|
|
||||||
function tllvmaddnode.pass_1: tnode;
|
function tllvmaddnode.pass_1: tnode;
|
||||||
var
|
var
|
||||||
|
exceptmode: ansistring;
|
||||||
intrname: string;
|
intrname: string;
|
||||||
iscompcurrency: boolean;
|
iscompcurrency: boolean;
|
||||||
begin
|
begin
|
||||||
@ -98,8 +99,9 @@ implementation
|
|||||||
inserttypeconv_internal(left,s80floattype);
|
inserttypeconv_internal(left,s80floattype);
|
||||||
inserttypeconv_internal(right,s80floattype);
|
inserttypeconv_internal(right,s80floattype);
|
||||||
end;
|
end;
|
||||||
|
exceptmode:=llvm_constrainedexceptmodestring;
|
||||||
result:=ccallnode.createintern(intrname,
|
result:=ccallnode.createintern(intrname,
|
||||||
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('fpexcept.strict'),length('fpexcept.strict'),llvm_metadatatype),
|
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar(exceptmode),length(exceptmode),llvm_metadatatype),
|
||||||
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('round.dynamic'),length('round.dynamic'),llvm_metadatatype),
|
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('round.dynamic'),length('round.dynamic'),llvm_metadatatype),
|
||||||
ccallparanode.create(right,
|
ccallparanode.create(right,
|
||||||
ccallparanode.create(left,nil)
|
ccallparanode.create(left,nil)
|
||||||
|
@ -61,7 +61,7 @@ implementation
|
|||||||
pass_2,
|
pass_2,
|
||||||
cgbase,cgutils,tgobj,hlcgobj,
|
cgbase,cgutils,tgobj,hlcgobj,
|
||||||
cpubase,
|
cpubase,
|
||||||
llvmbase,aasmllvm;
|
llvmbase,aasmllvm,aasmllvmmetadata;
|
||||||
|
|
||||||
procedure tllvminlinenode.maybe_remove_round_trunc_typeconv;
|
procedure tllvminlinenode.maybe_remove_round_trunc_typeconv;
|
||||||
var
|
var
|
||||||
@ -220,6 +220,7 @@ implementation
|
|||||||
|
|
||||||
function tllvminlinenode.first_fma: tnode;
|
function tllvminlinenode.first_fma: tnode;
|
||||||
var
|
var
|
||||||
|
exceptmode: ansistring;
|
||||||
procname: string[40];
|
procname: string[40];
|
||||||
begin
|
begin
|
||||||
if cs_opt_fastmath in current_settings.optimizerswitches then
|
if cs_opt_fastmath in current_settings.optimizerswitches then
|
||||||
@ -249,8 +250,9 @@ implementation
|
|||||||
else
|
else
|
||||||
internalerror(2019122811);
|
internalerror(2019122811);
|
||||||
end;
|
end;
|
||||||
|
exceptmode:=llvm_constrainedexceptmodestring;
|
||||||
result:=ccallnode.createintern(procname,
|
result:=ccallnode.createintern(procname,
|
||||||
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('fpexcept.strict'),length('fpexcept.strict'),llvm_metadatatype),
|
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar(exceptmode),length(exceptmode),llvm_metadatatype),
|
||||||
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('round.dynamic'),length('round.dynamic'),llvm_metadatatype),
|
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('round.dynamic'),length('round.dynamic'),llvm_metadatatype),
|
||||||
left
|
left
|
||||||
)
|
)
|
||||||
@ -273,6 +275,7 @@ implementation
|
|||||||
|
|
||||||
function tllvminlinenode.first_sqrt_real: tnode;
|
function tllvminlinenode.first_sqrt_real: tnode;
|
||||||
var
|
var
|
||||||
|
exceptmode: ansistring;
|
||||||
intrinsic: string[40];
|
intrinsic: string[40];
|
||||||
begin
|
begin
|
||||||
if left.resultdef.typ<>floatdef then
|
if left.resultdef.typ<>floatdef then
|
||||||
@ -304,8 +307,9 @@ implementation
|
|||||||
else
|
else
|
||||||
internalerror(2019122810);
|
internalerror(2019122810);
|
||||||
end;
|
end;
|
||||||
|
exceptmode:=llvm_constrainedexceptmodestring;
|
||||||
result:=ccallnode.createintern(intrinsic,
|
result:=ccallnode.createintern(intrinsic,
|
||||||
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('fpexcept.strict'),length('fpexcept.strict'),llvm_metadatatype),
|
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar(exceptmode),length(exceptmode),llvm_metadatatype),
|
||||||
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('round.dynamic'),length('round.dynamic'),llvm_metadatatype),
|
ccallparanode.create(cstringconstnode.createpchar(ansistring2pchar('round.dynamic'),length('round.dynamic'),llvm_metadatatype),
|
||||||
ccallparanode.create(left,nil)
|
ccallparanode.create(left,nil)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user