Skip to content

Commit

Permalink
Bug 1583958 - Update our fdlibm import to upstream rev cf4707bb2f78ec…
Browse files Browse the repository at this point in the history
…f56ba350bdc24e3135b4339622, adjusting local patchwork as necessary for changes upstream's made since last import. r=arai

Differential Revision: https://phabricator.services.mozilla.com/D47186

--HG--
extra : moz-landing-system : lando
  • Loading branch information
jswalden committed Sep 25, 2019
1 parent 66f6fbc commit 25fcb24
Show file tree
Hide file tree
Showing 21 changed files with 299 additions and 87 deletions.
2 changes: 1 addition & 1 deletion modules/fdlibm/README.mozilla
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ or
sh update.sh <sha-commit>
from within the modules/fdlibm directory.

Current version: [commit b21ccf63f28a3a4692d8a31419e0a725a1b1a800 (2018-02-14T07:59:30Z)].
Current version: [commit cf4707bb2f78ecf56ba350bdc24e3135b4339622 (2019-09-25T18:50:57Z)].

patches 01-18 fixes files to be usable within mozilla-central tree.
See https://bugzilla.mozilla.org/show_bug.cgi?id=933257
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ diff --git a/modules/fdlibm/src/fdlibm.h b/modules/fdlibm/src/fdlibm.h

double cosh(double);
double sinh(double);
@@ -53,9 +53,9 @@ double scalbn(double, int);
@@ -52,9 +52,9 @@ double scalbn(double, int);

float ceilf(float);
float floorf(float);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ diff --git a/modules/fdlibm/src/fdlibm.h b/modules/fdlibm/src/fdlibm.h
double cosh(double);
double sinh(double);
double tanh(double);
@@ -53,9 +55,11 @@ double scalbn(double, int);
@@ -52,9 +54,11 @@ double scalbn(double, int);

float ceilf(float);
float floorf(float);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@ diff --git a/modules/fdlibm/src/e_log2.cpp b/modules/fdlibm/src/e_log2.cpp
diff --git a/modules/fdlibm/src/e_pow.cpp b/modules/fdlibm/src/e_pow.cpp
--- a/modules/fdlibm/src/e_pow.cpp
+++ b/modules/fdlibm/src/e_pow.cpp
@@ -52,17 +52,16 @@
*
@@ -53,17 +53,16 @@
* Constants :
* The hexadecimal values are the intended ones for the following
* constants. The decimal values may be used, provided that the
* compiler will convert from decimal to binary accurately enough
* to produce the hexadecimal values shown.
*/

#include <float.h>
-#include "math.h"
#include "math_private.h"

Expand All @@ -249,7 +249,7 @@ diff --git a/modules/fdlibm/src/e_pow.cpp b/modules/fdlibm/src/e_pow.cpp
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
zero = 0.0,
one = 1.0,
half = 0.5,
diff --git a/modules/fdlibm/src/e_sinh.cpp b/modules/fdlibm/src/e_sinh.cpp
--- a/modules/fdlibm/src/e_sinh.cpp
+++ b/modules/fdlibm/src/e_sinh.cpp
Expand Down Expand Up @@ -359,15 +359,15 @@ diff --git a/modules/fdlibm/src/s_atan.cpp b/modules/fdlibm/src/s_atan.cpp
diff --git a/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
--- a/modules/fdlibm/src/s_cbrt.cpp
+++ b/modules/fdlibm/src/s_cbrt.cpp
@@ -10,17 +10,16 @@
* ====================================================
@@ -11,17 +11,16 @@
*
* Optimized by Bruce D. Evans.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <float.h>
-#include "math.h"
#include "math_private.h"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -14,20 +14,21 @@
@@ -14,52 +14,38 @@
* $FreeBSD$
*/

Expand All @@ -24,15 +24,16 @@ diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private
* to dig two 32 bit words out of the 64 bit IEEE floating point
* value. That is non-ANSI, and, moreover, the gcc instruction
* scheduler gets it wrong. We instead use the following macros.
@@ -36,27 +37,17 @@
* Unlike the original code, we determine the endianness at compile
* time, not at run time; I don't see much benefit to selecting
* endianness at run time.
*/

/*
* A union which permits us to convert between a double and two 32 bit
* ints.
*/
-/*
- * A union which permits us to convert between a double and two 32 bit
- * ints.
- */
-
-#ifdef __arm__
-#if defined(__VFP_FP__) || defined(__ARM_EABI__)
-#define IEEE_WORD_ORDER BYTE_ORDER
Expand All @@ -43,7 +44,53 @@ diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private
-#define IEEE_WORD_ORDER BYTE_ORDER
-#endif
-
/* A union which permits us to convert between a long double and
four 32 bit ints. */

-#if IEEE_WORD_ORDER == BIG_ENDIAN
+#if MOZ_BIG_ENDIAN

typedef union
{
long double value;
struct {
u_int32_t mswhi;
u_int32_t mswlo;
u_int32_t lswhi;
@@ -68,17 +54,17 @@ typedef union
struct {
u_int64_t msw;
u_int64_t lsw;
} parts64;
} ieee_quad_shape_type;

#endif

-#if IEEE_WORD_ORDER == LITTLE_ENDIAN
+#if MOZ_LITTLE_ENDIAN

typedef union
{
long double value;
struct {
u_int32_t lswlo;
u_int32_t lswhi;
u_int32_t mswlo;
@@ -87,17 +73,22 @@ typedef union
struct {
u_int64_t lsw;
u_int64_t msw;
} parts64;
} ieee_quad_shape_type;

#endif

-#if IEEE_WORD_ORDER == BIG_ENDIAN
+/*
+ * A union which permits us to convert between a double and two 32 bit
+ * ints.
+ */
+
+#if MOZ_BIG_ENDIAN

typedef union
Expand All @@ -53,7 +100,7 @@ diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private
{
u_int32_t msw;
u_int32_t lsw;
@@ -64,17 +55,17 @@ typedef union
@@ -105,17 +96,17 @@ typedef union
struct
{
u_int64_t w;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -742,16 +742,50 @@ irintl(long double x)
@@ -872,16 +872,50 @@ irintl(long double x)
#define __ieee754_j1f j1f
#define __ieee754_y0f y0f
#define __ieee754_y1f y1f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ diff --git a/modules/fdlibm/src/s_atan.cpp b/modules/fdlibm/src/s_atan.cpp
diff --git a/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
--- a/modules/fdlibm/src/s_cbrt.cpp
+++ b/modules/fdlibm/src/s_cbrt.cpp
@@ -105,12 +105,8 @@ cbrt(double x)
@@ -106,12 +106,8 @@ cbrt(double x)
s=t*t; /* t*t is exact */
r=x/s; /* error <= 0.5 ulps; |r| < |t| */
w=t+t; /* t+t is exact */
Expand Down
2 changes: 1 addition & 1 deletion modules/fdlibm/patches/09_comment_out_rcsid_variable.patch
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,13 @@ diff --git a/modules/fdlibm/src/s_cbrt.cpp b/modules/fdlibm/src/s_cbrt.cpp
+//#include <sys/cdefs.h>
+//__FBSDID("$FreeBSD$");

#include <float.h>
#include "math_private.h"

/* cbrt(x)
* Return cube root of x
*/
static const u_int32_t
B1 = 715094163, /* B1 = (1023-1023/3-0.03306235651)*2**20 */
diff --git a/modules/fdlibm/src/s_ceil.cpp b/modules/fdlibm/src/s_ceil.cpp
--- a/modules/fdlibm/src/s_ceil.cpp
+++ b/modules/fdlibm/src/s_ceil.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private
+#define u_int64_t uint64_t
+#endif
+
/*
* A union which permits us to convert between a double and two 32 bit
* ints.
*/
/* A union which permits us to convert between a long double and
four 32 bit ints. */

#if MOZ_BIG_ENDIAN

typedef union
{
long double value;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -287,16 +287,27 @@ do { \
@@ -328,16 +328,27 @@ do { \
if (sizeof(type) >= sizeof(long double)) \
(lval) = (rval); \
else { \
Expand All @@ -25,7 +25,7 @@ diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private

/* Support switching the mode to FP_PE if necessary. */
#if defined(__i386__) && !defined(NO_FPSETPREC)
#define ENTERI() \
long double __retval; \
#define ENTERI() ENTERIT(long double)
#define ENTERIT(returntype) \
returntype __retval; \
fp_prec_t __oprec; \
\
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ diff --git a/modules/fdlibm/src/e_exp.cpp b/modules/fdlibm/src/e_exp.cpp
+++ b/modules/fdlibm/src/e_exp.cpp
@@ -146,14 +146,17 @@ double
if(k >= -1021)
INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0);
INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0);
else
INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0);
INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0);
c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
if(k==0) return one-((x*c)/(c-2.0)-x);
else y = one-((lo-(x*c)/(2.0-c))-hi);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -273,17 +273,17 @@ do { \
@@ -314,17 +314,17 @@ do { \
/* The above works on non-i386 too, but we use this to check v. */
#define LD80C(m, ex, v) { .e = (v), }
#endif
Expand Down
4 changes: 2 additions & 2 deletions modules/fdlibm/patches/18_use_stdlib_sqrt.patch
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ diff --git a/modules/fdlibm/src/e_pow.cpp b/modules/fdlibm/src/e_pow.cpp

+#include <cmath>
+
#include <float.h>
#include "math_private.h"

static const double
bp[] = {1.0, 1.5,},
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
zero = 0.0,
one = 1.0,
@@ -147,17 +149,17 @@ double
@@ -151,17 +153,17 @@ double
return (hy<0)?-y: zero;
}
if(iy==0x3ff00000) { /* y is +-1 */
Expand Down
Loading

0 comments on commit 25fcb24

Please sign in to comment.