mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 22:19:32 +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;
|
||||
begin
|
||||
if not(cs_opt_fastmath in current_settings.optimizerswitches) then
|
||||
result:='fpexcept.strict'
|
||||
result:='fpexcept.maytrap'
|
||||
else
|
||||
result:='fpexcept.ignore'
|
||||
end;
|
||||
|
@ -1346,6 +1346,7 @@ implementation
|
||||
|
||||
procedure thlcgllvm.gen_fpconstrained_intrinsic(list: TAsmList; const intrinsic: TIDString; fromsize, tosize: tdef; fromreg, toreg: tregister; roundingmode: boolean);
|
||||
var
|
||||
exceptmode: ansistring;
|
||||
frompara, roundpara, exceptpara, respara: tcgpara;
|
||||
tmploc: tlocation;
|
||||
pd: tprocdef;
|
||||
@ -1370,7 +1371,8 @@ implementation
|
||||
gen_load_loc_cgpara(list,fromsize,tmploc,frompara);
|
||||
if roundingmode then
|
||||
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
|
||||
respara:=g_call_system_proc(list,pd,[@frompara,@roundpara,@exceptpara],nil)
|
||||
else
|
||||
|
@ -50,7 +50,7 @@ implementation
|
||||
verbose,globtype,globals,cutils,
|
||||
aasmdata,
|
||||
symconst,symtype,symdef,defutil,
|
||||
llvmbase,aasmllvm,
|
||||
llvmbase,aasmllvm,aasmllvmmetadata,
|
||||
cgbase,cgutils,pass_1,
|
||||
hlcgobj,
|
||||
nadd,ncal,ncnv,ncon
|
||||
@ -60,6 +60,7 @@ implementation
|
||||
|
||||
function tllvmaddnode.pass_1: tnode;
|
||||
var
|
||||
exceptmode: ansistring;
|
||||
intrname: string;
|
||||
iscompcurrency: boolean;
|
||||
begin
|
||||
@ -98,8 +99,9 @@ implementation
|
||||
inserttypeconv_internal(left,s80floattype);
|
||||
inserttypeconv_internal(right,s80floattype);
|
||||
end;
|
||||
exceptmode:=llvm_constrainedexceptmodestring;
|
||||
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(right,
|
||||
ccallparanode.create(left,nil)
|
||||
|
@ -61,7 +61,7 @@ implementation
|
||||
pass_2,
|
||||
cgbase,cgutils,tgobj,hlcgobj,
|
||||
cpubase,
|
||||
llvmbase,aasmllvm;
|
||||
llvmbase,aasmllvm,aasmllvmmetadata;
|
||||
|
||||
procedure tllvminlinenode.maybe_remove_round_trunc_typeconv;
|
||||
var
|
||||
@ -220,6 +220,7 @@ implementation
|
||||
|
||||
function tllvminlinenode.first_fma: tnode;
|
||||
var
|
||||
exceptmode: ansistring;
|
||||
procname: string[40];
|
||||
begin
|
||||
if cs_opt_fastmath in current_settings.optimizerswitches then
|
||||
@ -249,8 +250,9 @@ implementation
|
||||
else
|
||||
internalerror(2019122811);
|
||||
end;
|
||||
exceptmode:=llvm_constrainedexceptmodestring;
|
||||
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),
|
||||
left
|
||||
)
|
||||
@ -273,6 +275,7 @@ implementation
|
||||
|
||||
function tllvminlinenode.first_sqrt_real: tnode;
|
||||
var
|
||||
exceptmode: ansistring;
|
||||
intrinsic: string[40];
|
||||
begin
|
||||
if left.resultdef.typ<>floatdef then
|
||||
@ -304,8 +307,9 @@ implementation
|
||||
else
|
||||
internalerror(2019122810);
|
||||
end;
|
||||
exceptmode:=llvm_constrainedexceptmodestring;
|
||||
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(left,nil)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user