Переглянути джерело

* handle atan, sqrt, ln, sin and cos in the x86 RTL for llvm
o there are llvm intrinsics for all of these except for atan,
but these obey "the same rules as the equivalent libc functions"
and I first have to investigate whether these libc functions
behave the same as our FPC implementations

git-svn-id: trunk@31657 -

Jonas Maebe 10 роки тому
батько
коміт
6909523b70
1 змінених файлів з 37 додано та 0 видалено
  1. 37 0
      rtl/x86_64/math.inc

+ 37 - 0
rtl/x86_64/math.inc

@@ -122,10 +122,17 @@ const
     {$ifndef FPC_SYSTEM_HAS_SQRT}
     {$define FPC_SYSTEM_HAS_SQRT}
     function fpc_sqrt_real(d : ValReal) : ValReal;compilerproc;
+{$ifndef cpullvm}
     begin
       { Function is handled internal in the compiler }
       runerror(207);
       result:=0;
+{$else not cpullvm}
+    assembler;nostackframe;
+    asm
+      fldt d
+      fsqrt
+{$endif not cpullvm}
     end;
     {$endif FPC_SYSTEM_HAS_SQRT}
 
@@ -134,37 +141,67 @@ const
     {$ifndef FPC_SYSTEM_HAS_ARCTAN}
     {$define FPC_SYSTEM_HAS_ARCTAN}
     function fpc_arctan_real(d : ValReal) : ValReal;compilerproc;
+{$ifndef cpullvm}
     begin
       { Function is handled internal in the compiler }
       runerror(207);
       result:=0;
+{$else not cpullvm}
+    assembler;nostackframe;
+    asm
+      fldt d
+      fld1
+      fpatan
+{$endif not cpullvm}
     end;
     {$endif FPC_SYSTEM_HAS_ARCTAN}
     {$ifndef FPC_SYSTEM_HAS_LN}
     {$define FPC_SYSTEM_HAS_LN}
     function fpc_ln_real(d : ValReal) : ValReal;compilerproc;
+{$ifndef cpullvm}
     begin
       { Function is handled internal in the compiler }
       runerror(207);
       result:=0;
+{$else not cpullvm}
+    assembler;nostackframe;
+    asm
+      fldln2
+      fldt d
+      fyl2x
+{$endif not cpullvm}
     end;
     {$endif FPC_SYSTEM_HAS_LN}
     {$ifndef FPC_SYSTEM_HAS_SIN}
     {$define FPC_SYSTEM_HAS_SIN}
     function fpc_sin_real(d : ValReal) : ValReal;compilerproc;
+{$ifndef cpullvm}
     begin
       { Function is handled internal in the compiler }
       runerror(207);
       result:=0;
+{$else not cpullvm}
+    assembler;nostackframe;
+    asm
+      fldt d
+      fsin
+{$endif not cpullvm}
     end;
     {$endif FPC_SYSTEM_HAS_SIN}
     {$ifndef FPC_SYSTEM_HAS_COS}
     {$define FPC_SYSTEM_HAS_COS}
     function fpc_cos_real(d : ValReal) : ValReal;compilerproc;
+{$ifndef cpullvm}
     begin
       { Function is handled internal in the compiler }
       runerror(207);
       result:=0;
+{$else not cpullvm}
+    assembler;nostackframe;
+    asm
+      fldt d
+      fcos
+{$endif not cpullvm}
     end;
     {$endif FPC_SYSTEM_HAS_COS}