Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanner Gooding <tagoo@outlook.com>2021-01-12 23:50:43 +0300
committerGitHub <noreply@github.com>2021-01-12 23:50:43 +0300
commit891c6d36324540e1cb87586792d81cb22ff11c66 (patch)
tree93d9a2fdcf8a22aa2edee56f09b9b39bf3f61f0e /src/coreclr/classlibnative
parenteb03112e4e715dc0c33225670c60c6f97e382877 (diff)
Adding support for Math/MathF.SinCos (#46551)
* Adding support for Math/MathF.SinCos * Fix the handling of sincos on __APPLE__ * Adjusting the SinCos internal call to work on all platforms * Mark the public SinCos as intrinsic and ensure it is handled in gentree * Dropping the NI_System_Math_SinCos intrinsic as it requires more extensive changes * Removing unnecessary casts from the COMSingle and COMDouble SinCos calls
Diffstat (limited to 'src/coreclr/classlibnative')
-rw-r--r--src/coreclr/classlibnative/float/floatdouble.cpp15
-rw-r--r--src/coreclr/classlibnative/float/floatsingle.cpp15
-rw-r--r--src/coreclr/classlibnative/inc/floatdouble.h1
-rw-r--r--src/coreclr/classlibnative/inc/floatsingle.h1
4 files changed, 32 insertions, 0 deletions
diff --git a/src/coreclr/classlibnative/float/floatdouble.cpp b/src/coreclr/classlibnative/float/floatdouble.cpp
index a2a00b0628b..3419835cd97 100644
--- a/src/coreclr/classlibnative/float/floatdouble.cpp
+++ b/src/coreclr/classlibnative/float/floatdouble.cpp
@@ -280,6 +280,21 @@ FCIMPL1_V(double, COMDouble::Sin, double x)
return (double)sin(x);
FCIMPLEND
+/*====================================SinCos====================================
+**
+==============================================================================*/
+FCIMPL3_VII(void, COMDouble::SinCos, double x, double* pSin, double* pCos)
+ FCALL_CONTRACT;
+
+#ifdef _MSC_VER
+ *pSin = sin(x);
+ *pCos = cos(x);
+#else
+ sincos(x, pSin, pCos);
+#endif
+
+FCIMPLEND
+
/*=====================================Sinh=====================================
**
==============================================================================*/
diff --git a/src/coreclr/classlibnative/float/floatsingle.cpp b/src/coreclr/classlibnative/float/floatsingle.cpp
index 9972e17c690..b7adb859980 100644
--- a/src/coreclr/classlibnative/float/floatsingle.cpp
+++ b/src/coreclr/classlibnative/float/floatsingle.cpp
@@ -267,6 +267,21 @@ FCIMPL1_V(float, COMSingle::Sin, float x)
return (float)sinf(x);
FCIMPLEND
+/*====================================SinCos====================================
+**
+==============================================================================*/
+FCIMPL3_VII(void, COMSingle::SinCos, float x, float* pSin, float* pCos)
+ FCALL_CONTRACT;
+
+#ifdef _MSC_VER
+ *pSin = sinf(x);
+ *pCos = cosf(x);
+#else
+ sincosf(x, pSin, pCos);
+#endif
+
+FCIMPLEND
+
/*=====================================Sinh=====================================
**
==============================================================================*/
diff --git a/src/coreclr/classlibnative/inc/floatdouble.h b/src/coreclr/classlibnative/inc/floatdouble.h
index eb430409b6f..127ba179ed4 100644
--- a/src/coreclr/classlibnative/inc/floatdouble.h
+++ b/src/coreclr/classlibnative/inc/floatdouble.h
@@ -33,6 +33,7 @@ public:
FCDECL2_VV(static double, Pow, double x, double y);
FCDECL2_VI(static double, ScaleB, double x, int n);
FCDECL1_V(static double, Sin, double x);
+ FCDECL3_VII(static void, SinCos, double x, double* sin, double* cos);
FCDECL1_V(static double, Sinh, double x);
FCDECL1_V(static double, Sqrt, double x);
FCDECL1_V(static double, Tan, double x);
diff --git a/src/coreclr/classlibnative/inc/floatsingle.h b/src/coreclr/classlibnative/inc/floatsingle.h
index 2658cb08edd..786383eecd8 100644
--- a/src/coreclr/classlibnative/inc/floatsingle.h
+++ b/src/coreclr/classlibnative/inc/floatsingle.h
@@ -33,6 +33,7 @@ public:
FCDECL2_VV(static float, Pow, float x, float y);
FCDECL2_VI(static float, ScaleB, float x, int n);
FCDECL1_V(static float, Sin, float x);
+ FCDECL3_VII(static void, SinCos, float x, float* sin, float* cos);
FCDECL1_V(static float, Sinh, float x);
FCDECL1_V(static float, Sqrt, float x);
FCDECL1_V(static float, Tan, float x);