Explorar o código

+ add an SSE2 implementation of Frac() (the existing Trunc() and Round() implementations are also SSE2, so nothing special to keep in mind here)

git-svn-id: trunk@36253 -
svenbarth %!s(int64=8) %!d(string=hai) anos
pai
achega
5f08e47d84
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      rtl/x86_64/math.inc

+ 12 - 0
rtl/x86_64/math.inc

@@ -372,4 +372,16 @@ const
       end;
     {$endif FPC_SYSTEM_HAS_ROUND}
 
+    {$ifndef FPC_SYSTEM_HAS_FRAC}
+    {$define FPC_SYSTEM_HAS_FRAC}
+    function fpc_frac_real(d: ValReal) : ValReal;compilerproc; assembler; nostackframe;
+      asm
+        cvttsd2si   %xmm0,%rax
+        { Windows defines %xmm4 and %xmm5 as first non-parameter volatile registers;
+          on SYSV systems all are considered as such, so use %xmm4 }
+        cvtsi2sd    %rax,%xmm4
+        subsd       %xmm4,%xmm0
+      end;
+    {$endif FPC_SYSTEM_HAS_FRAC}
+
 {$endif FPC_HAS_TYPE_EXTENDED}