Page MenuHomeFreeBSD

D32801.id97925.diff
No OneTemporary

D32801.id97925.diff

Index: lib/msun/aarch64/Makefile.inc
===================================================================
--- lib/msun/aarch64/Makefile.inc
+++ lib/msun/aarch64/Makefile.inc
@@ -2,3 +2,15 @@
LDBL_PREC = 113
+# Use a builtin when it generates the needed instruction
+CFLAGS+=-DUSE_BUILTIN_FMAF
+CFLAGS+=-DUSE_BUILTIN_FMA
+
+CFLAGS+=-DUSE_BUILTIN_FMAXF
+CFLAGS+=-DUSE_BUILTIN_FMAX
+
+CFLAGS+=-DUSE_BUILTIN_FMINF
+CFLAGS+=-DUSE_BUILTIN_FMIN
+
+CFLAGS+=-DUSE_BUILTIN_SQRTF
+CFLAGS+=-DUSE_BUILTIN_SQRT
Index: lib/msun/src/e_sqrt.c
===================================================================
--- lib/msun/src/e_sqrt.c
+++ lib/msun/src/e_sqrt.c
@@ -14,6 +14,18 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <float.h>
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef USE_BUILTIN_SQRT
+double
+__ieee754_sqrt(double x)
+{
+ return (__builtin_sqrt(x));
+}
+#else
/* __ieee754_sqrt(x)
* Return correctly rounded sqrt.
* ------------------------------------------
@@ -84,11 +96,6 @@
*---------------
*/
-#include <float.h>
-
-#include "math.h"
-#include "math_private.h"
-
static const double one = 1.0, tiny=1.0e-300;
double
@@ -187,6 +194,7 @@
INSERT_WORDS(z,ix0,ix1);
return z;
}
+#endif
#if (LDBL_MANT_DIG == 53)
__weak_reference(sqrt, sqrtl);
Index: lib/msun/src/e_sqrtf.c
===================================================================
--- lib/msun/src/e_sqrtf.c
+++ lib/msun/src/e_sqrtf.c
@@ -20,6 +20,13 @@
#include "math.h"
#include "math_private.h"
+#ifdef USE_BUILTIN_SQRTF
+float
+__ieee754_sqrtf(float x)
+{
+ return (__builtin_sqrtf(x));
+}
+#else
static const float one = 1.0, tiny=1.0e-30;
float
@@ -87,3 +94,4 @@
SET_FLOAT_WORD(z,ix);
return z;
}
+#endif
Index: lib/msun/src/s_fma.c
===================================================================
--- lib/msun/src/s_fma.c
+++ lib/msun/src/s_fma.c
@@ -35,6 +35,13 @@
#include "math_private.h"
+#ifdef USE_BUILTIN_FMA
+double
+fma(double x, double y, double z)
+{
+ return (__builtin_fma(x, y, z));
+}
+#else
/*
* A struct dd represents a floating-point number with twice the precision
* of a double. We maintain the invariant that "hi" stores the 53 high-order
@@ -284,6 +291,7 @@
else
return (add_and_denormalize(r.hi, adj, spread));
}
+#endif /* !USE_BUILTIN_FMA */
#if (LDBL_MANT_DIG == 53)
__weak_reference(fma, fmal);
Index: lib/msun/src/s_fmaf.c
===================================================================
--- lib/msun/src/s_fmaf.c
+++ lib/msun/src/s_fmaf.c
@@ -34,6 +34,13 @@
#include "math.h"
#include "math_private.h"
+#ifdef USE_BUILTIN_FMAF
+float
+fmaf(float x, float y, float z)
+{
+ return (__builtin_fmaf(x, y, z));
+}
+#else
/*
* Fused multiply-add: Compute x * y + z with a single rounding error.
*
@@ -69,3 +76,4 @@
SET_LOW_WORD(adjusted_result, lr + 1);
return (adjusted_result);
}
+#endif /* !USE_BUILTIN_FMAF */
Index: lib/msun/src/s_fmax.c
===================================================================
--- lib/msun/src/s_fmax.c
+++ lib/msun/src/s_fmax.c
@@ -34,6 +34,13 @@
#include "fpmath.h"
+#ifdef USE_BUILTIN_FMAX
+double
+fmax(double x, double y)
+{
+ return (__builtin_fmax(x, y));
+}
+#else
double
fmax(double x, double y)
{
@@ -54,6 +61,7 @@
return (x > y ? x : y);
}
+#endif
#if (LDBL_MANT_DIG == 53)
__weak_reference(fmax, fmaxl);
Index: lib/msun/src/s_fmaxf.c
===================================================================
--- lib/msun/src/s_fmaxf.c
+++ lib/msun/src/s_fmaxf.c
@@ -33,6 +33,13 @@
#include "fpmath.h"
+#ifdef USE_BUILTIN_FMAX
+float
+fmaxf(float x, float y)
+{
+ return (__builtin_fmaxf(x, y));
+}
+#else
float
fmaxf(float x, float y)
{
@@ -53,3 +60,4 @@
return (x > y ? x : y);
}
+#endif
Index: lib/msun/src/s_fmin.c
===================================================================
--- lib/msun/src/s_fmin.c
+++ lib/msun/src/s_fmin.c
@@ -34,6 +34,13 @@
#include "fpmath.h"
+#ifdef USE_BUILTIN_FMIN
+double
+fmin(double x, double y)
+{
+ return (__builtin_fmin(x, y));
+}
+#else
double
fmin(double x, double y)
{
@@ -54,6 +61,7 @@
return (x < y ? x : y);
}
+#endif
#if (LDBL_MANT_DIG == 53)
__weak_reference(fmin, fminl);
Index: lib/msun/src/s_fminf.c
===================================================================
--- lib/msun/src/s_fminf.c
+++ lib/msun/src/s_fminf.c
@@ -33,6 +33,13 @@
#include "fpmath.h"
+#ifdef USE_BUILTIN_FMIN
+float
+fminf(float x, float y)
+{
+ return (__builtin_fminf(x, y));
+}
+#else
float
fminf(float x, float y)
{
@@ -53,3 +60,4 @@
return (x < y ? x : y);
}
+#endif

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 15, 1:12 AM (7 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28721569
Default Alt Text
D32801.id97925.diff (4 KB)

Event Timeline