From 7201bd8526d3d32c10ad567cdf03c5dca087d67f Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 19 Aug 2012 22:36:59 +0000 Subject: [PATCH] + sincos implemenation for x86-64 git-svn-id: trunk@22142 - --- rtl/x86_64/mathu.inc | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/rtl/x86_64/mathu.inc b/rtl/x86_64/mathu.inc index c5c8f88995..4aff373de8 100644 --- a/rtl/x86_64/mathu.inc +++ b/rtl/x86_64/mathu.inc @@ -25,6 +25,61 @@ function arctan2(y,x : float) : float;assembler; end; {$endif FPC_HAS_TYPE_EXTENDED} + +{$define FPC_MATH_HAS_SINCOS} +{$ifdef FPC_HAS_TYPE_EXTENDED} +procedure sincos(theta : extended;out sinus,cosinus : extended);assembler; +asm + fldt theta + fsincos +{$ifdef WIN64} + fstpt (%r8) + fstpt (%rdx) +{$else WIN64} + fstpt (%rsi) + fstpt (%rdi) +{$endif WIN64} + fwait + end; +{$endif FPC_HAS_TYPE_EXTENDED} + + +procedure sincos(theta : double;out sinus,cosinus : double);assembler; + var + t : double; + asm + movd %xmm0,t + fldl t + fsincos +{$ifdef WIN64} + fstpl (%r8) + fstpl (%rdx) +{$else WIN64} + fstpl (%rsi) + fstpl (%rdi) +{$endif WIN64} + fwait + end; + + +procedure sincos(theta : single;out sinus,cosinus : single);assembler; + var + t : single; + asm + movss %xmm0,t + flds t + fsincos +{$ifdef WIN64} + fstps (%r8) + fstps (%rdx) +{$else WIN64} + fstps (%rsi) + fstps (%rdi) +{$endif WIN64} + fwait + end; + + function GetRoundMode: TFPURoundingMode; begin {$ifndef FPC_HAS_TYPE_EXTENDED}