summaryrefslogtreecommitdiffstats
path: root/modules/fdlibm/patches/21_rem_pio_fixups.patch
diff options
context:
space:
mode:
Diffstat (limited to 'modules/fdlibm/patches/21_rem_pio_fixups.patch')
-rw-r--r--modules/fdlibm/patches/21_rem_pio_fixups.patch226
1 files changed, 226 insertions, 0 deletions
diff --git a/modules/fdlibm/patches/21_rem_pio_fixups.patch b/modules/fdlibm/patches/21_rem_pio_fixups.patch
new file mode 100644
index 0000000000..8961db62c3
--- /dev/null
+++ b/modules/fdlibm/patches/21_rem_pio_fixups.patch
@@ -0,0 +1,226 @@
+diff --git a/e_rem_pio2.cpp b/e_rem_pio2.cpp
+--- a/e_rem_pio2.cpp
++++ b/e_rem_pio2.cpp
+@@ -43,17 +43,17 @@ invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
+ pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */
+ pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */
+ pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */
+ pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */
+ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
+ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
+
+ #ifdef INLINE_REM_PIO2
+-static __inline __always_inline
++static inline
+ #endif
+ int
+ __ieee754_rem_pio2(double x, double *y)
+ {
+ double z,w,t,r,fn;
+ double tx[3],ty[2];
+ int32_t e0,i,j,nx,n,ix,hx;
+ u_int32_t low;
+diff --git a/k_rem_pio2.cpp b/k_rem_pio2.cpp
+--- a/k_rem_pio2.cpp
++++ b/k_rem_pio2.cpp
+@@ -305,17 +305,18 @@ __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec)
+ q0 = e0-24*(jv+1);
+
+ /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */
+ j = jv-jx; m = jx+jk;
+ for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j];
+
+ /* compute q[0],q[1],...q[jk] */
+ for (i=0;i<=jk;i++) {
+- for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
++ for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j];
++ q[i] = fw;
+ }
+
+ jz = jk;
+ recompute:
+ /* distill q[] into iq[] reversingly */
+ for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
+ fw = (double)((int32_t)(twon24* z));
+ iq[i] = (int32_t)(z-two24*fw);
+diff --git a/s_cos.cpp b/s_cos.cpp
+--- a/s_cos.cpp
++++ b/s_cos.cpp
+@@ -43,17 +43,17 @@
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+ #include <float.h>
+
+ #define INLINE_REM_PIO2
+ #include "math_private.h"
+-#include "e_rem_pio2.c"
++#include "e_rem_pio2.cpp"
+
+ double
+ cos(double x)
+ {
+ double y[2],z=0.0;
+ int32_t n, ix;
+
+ /* High word of x. */
+diff --git a/s_sin.cpp b/s_sin.cpp
+--- a/s_sin.cpp
++++ b/s_sin.cpp
+@@ -43,17 +43,17 @@
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+ #include <float.h>
+
+ #define INLINE_REM_PIO2
+ #include "math_private.h"
+-#include "e_rem_pio2.c"
++#include "e_rem_pio2.cpp"
+
+ double
+ sin(double x)
+ {
+ double y[2],z=0.0;
+ int32_t n, ix;
+
+ /* High word of x. */
+diff --git a/s_tan.cpp b/s_tan.cpp
+--- a/s_tan.cpp
++++ b/s_tan.cpp
+@@ -42,17 +42,17 @@
+ * Accuracy:
+ * TRIG(x) returns trig(x) nearly rounded
+ */
+
+ #include <float.h>
+
+ #define INLINE_REM_PIO2
+ #include "math_private.h"
+-#include "e_rem_pio2.c"
++#include "e_rem_pio2.cpp"
+
+ double
+ tan(double x)
+ {
+ double y[2],z=0.0;
+ int32_t n, ix;
+
+ /* High word of x. */
+--- a/s_cosf.cpp 2022-12-11 21:26:36.041643110 -0500
++++ b/s_cosf.cpp 2022-12-11 21:34:08.197486828 -0500
+@@ -18,19 +18,19 @@
+ //__FBSDID("$FreeBSD$");
+
+ #include <float.h>
+
+ #define INLINE_KERNEL_COSDF
+ #define INLINE_KERNEL_SINDF
+ #define INLINE_REM_PIO2F
+ #include "math_private.h"
+-#include "e_rem_pio2f.c"
+-#include "k_cosf.c"
+-#include "k_sinf.c"
++#include "e_rem_pio2f.cpp"
++#include "k_cosf.cpp"
++#include "k_sinf.cpp"
+
+ /* Small multiples of pi/2 rounded to double precision. */
+ static const double
+ c1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */
+ c2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */
+ c3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */
+ c4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */
+
+--- a/s_sinf.cpp 2022-12-11 21:26:36.045643147 -0500
++++ b/s_sinf.cpp 2022-12-11 21:33:52.741362926 -0500
+@@ -18,19 +18,19 @@
+ //__FBSDID("$FreeBSD$");
+
+ #include <float.h>
+
+ #define INLINE_KERNEL_COSDF
+ #define INLINE_KERNEL_SINDF
+ #define INLINE_REM_PIO2F
+ #include "math_private.h"
+-#include "e_rem_pio2f.c"
+-#include "k_cosf.c"
+-#include "k_sinf.c"
++#include "e_rem_pio2f.cpp"
++#include "k_cosf.cpp"
++#include "k_sinf.cpp"
+
+ /* Small multiples of pi/2 rounded to double precision. */
+ static const double
+ s1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */
+ s2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */
+ s3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */
+ s4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */
+
+--- a/s_tanf.cpp 2022-12-11 21:26:36.045643147 -0500
++++ b/s_tanf.cpp 2022-12-11 21:33:45.269302886 -0500
+@@ -17,18 +17,18 @@
+ //#include <sys/cdefs.h>
+ //__FBSDID("$FreeBSD$");
+
+ #include <float.h>
+
+ #define INLINE_KERNEL_TANDF
+ #define INLINE_REM_PIO2F
+ #include "math_private.h"
+-#include "e_rem_pio2f.c"
+-#include "k_tanf.c"
++#include "e_rem_pio2f.cpp"
++#include "k_tanf.cpp"
+
+ /* Small multiples of pi/2 rounded to double precision. */
+ static const double
+ t1pio2 = 1*M_PI_2, /* 0x3FF921FB, 0x54442D18 */
+ t2pio2 = 2*M_PI_2, /* 0x400921FB, 0x54442D18 */
+ t3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */
+ t4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */
+
+--- a/e_rem_pio2f.cpp 2022-12-13 14:50:12.582776365 -0500
++++ b/e_rem_pio2f.cpp 2022-12-13 14:51:05.003200166 -0500
+@@ -35,17 +35,17 @@
+ */
+
+ static const double
+ invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */
+ pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */
+ pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */
+
+ #ifdef INLINE_REM_PIO2F
+-static __inline __always_inline
++static inline
+ #endif
+ int
+ __ieee754_rem_pio2f(float x, double *y)
+ {
+ double w,r,fn;
+ double tx[1],ty[1];
+ float z;
+ int32_t e0,n,ix,hx;
+--- a/e_powf.cpp
++++ b/e_powf.cpp
+@@ -11,16 +11,18 @@
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+ //#include <sys/cdefs.h>
+ //__FBSDID("$FreeBSD$");
+
++#include "s_scalbnf.cpp"
++
+ #include "math_private.h"
+
+ static const float
+ bp[] = {1.0, 1.5,},
+ dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */
+ dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */
+ zero = 0.0,
+ half = 0.5,