mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 16:39:36 +01:00
+ internal sqrt support for LLVM (faster on all platforms, necessary on
platforms that don't have RTL support for it, as the the generic
fpc_sqrt_real just calls runerror)
git-svn-id: trunk@40575 -
This commit is contained in:
parent
8845f4d1ce
commit
2330164ee2
@ -37,6 +37,7 @@ interface
|
||||
function first_get_frame: tnode; override;
|
||||
function first_abs_real: tnode; override;
|
||||
function first_sqr_real: tnode; override;
|
||||
function first_sqrt_real: tnode; override;
|
||||
function first_trunc_real: tnode; override;
|
||||
public
|
||||
procedure second_length; override;
|
||||
@ -156,6 +157,29 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function tllvminlinenode.first_sqrt_real: tnode;
|
||||
var
|
||||
intrinsic: string[20];
|
||||
begin
|
||||
if left.resultdef.typ<>floatdef then
|
||||
internalerror(2018121601);
|
||||
case tfloatdef(left.resultdef).floattype of
|
||||
s32real:
|
||||
intrinsic:='llvm_sqrt_f32';
|
||||
s64real:
|
||||
intrinsic:='llvm_sqrt_f64';
|
||||
s80real,sc80real:
|
||||
intrinsic:='llvm_sqrt_f80';
|
||||
s128real:
|
||||
intrinsic:='llvm_sqrt_f128';
|
||||
else
|
||||
internalerror(2018121602);
|
||||
end;
|
||||
result:=ccallnode.createinternfromunit('SYSTEM',intrinsic, ccallparanode.create(left,nil));
|
||||
left:=nil;
|
||||
end;
|
||||
|
||||
|
||||
function tllvminlinenode.first_trunc_real: tnode;
|
||||
begin
|
||||
{ fptosi is undefined if the value is out of range -> only generate
|
||||
|
||||
@ -20,3 +20,12 @@ function llvm_frameaddress(level: longint): pointer; compilerproc; external name
|
||||
|
||||
procedure llvm_lifetime_start(size: int64; ptr: pointer); compilerproc; external name 'llvm.lifetime.start';
|
||||
procedure llvm_lifetime_end(size: int64; ptr: pointer); compilerproc; external name 'llvm.lifetime.end';
|
||||
|
||||
function llvm_sqrt_f32(val: single): single; compilerproc; external name 'llvm.sqrt.f32';
|
||||
function llvm_sqrt_f64(val: double): double; compilerproc; external name 'llvm.sqrt.f64';
|
||||
{$ifdef SUPPORT_EXTENDED}
|
||||
function llvm_sqrt_f80(val: extended): extended; compilerproc; external name 'llvm.sqrt.f80';
|
||||
{$endif}
|
||||
{$ifdef SUPPORT_FLOAT128}
|
||||
function llvm_sqrt_f128(val: float128): float128; compilerproc; external name 'llvm.sqrt.f128';
|
||||
{$endif}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user