|
|
a2cf7d |
From 73f98d03d2cde34255c0a39ef18902bffdce0185 Mon Sep 17 00:00:00 2001
|
|
|
a2cf7d |
From: Stefan Liebler <stli@linux.ibm.com>
|
|
|
a2cf7d |
Date: Wed, 11 Dec 2019 15:09:14 +0100
|
|
|
a2cf7d |
Subject: [PATCH 02/28] Always use wordsize-64 version of s_rint.c.
|
|
|
a2cf7d |
|
|
|
a2cf7d |
This patch replaces s_rint.c in sysdeps/dbl-64 with the one in
|
|
|
a2cf7d |
sysdeps/dbl-64/wordsize-64 and removes the latter one.
|
|
|
a2cf7d |
The code is not changed except changes in code style.
|
|
|
a2cf7d |
|
|
|
a2cf7d |
Also adjusted the include path in x86_64 file.
|
|
|
a2cf7d |
|
|
|
a2cf7d |
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
a2cf7d |
(cherry picked from commit ab48bdd098a675dddb360faafc497a61c4bd4334)
|
|
|
a2cf7d |
---
|
|
|
a2cf7d |
sysdeps/ieee754/dbl-64/s_rint.c | 32 ++++++------
|
|
|
a2cf7d |
sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c | 57 ---------------------
|
|
|
a2cf7d |
sysdeps/x86_64/fpu/multiarch/s_rint-c.c | 2 +-
|
|
|
a2cf7d |
3 files changed, 17 insertions(+), 74 deletions(-)
|
|
|
a2cf7d |
delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c
|
|
|
a2cf7d |
|
|
|
a2cf7d |
diff --git a/sysdeps/ieee754/dbl-64/s_rint.c b/sysdeps/ieee754/dbl-64/s_rint.c
|
|
|
a2cf7d |
index cb0f5ca298..7f3dc87b96 100644
|
|
|
a2cf7d |
--- a/sysdeps/ieee754/dbl-64/s_rint.c
|
|
|
a2cf7d |
+++ b/sysdeps/ieee754/dbl-64/s_rint.c
|
|
|
a2cf7d |
@@ -1,4 +1,3 @@
|
|
|
a2cf7d |
-/* @(#)s_rint.c 5.1 93/09/24 */
|
|
|
a2cf7d |
/*
|
|
|
a2cf7d |
* ====================================================
|
|
|
a2cf7d |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
|
a2cf7d |
@@ -25,38 +24,39 @@
|
|
|
a2cf7d |
#include <libm-alias-double.h>
|
|
|
a2cf7d |
|
|
|
a2cf7d |
static const double
|
|
|
a2cf7d |
- TWO52[2] = {
|
|
|
a2cf7d |
- 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
|
|
|
a2cf7d |
- -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
|
|
|
a2cf7d |
+TWO52[2] = {
|
|
|
a2cf7d |
+ 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
|
|
|
a2cf7d |
+ -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
|
|
|
a2cf7d |
};
|
|
|
a2cf7d |
|
|
|
a2cf7d |
double
|
|
|
a2cf7d |
__rint (double x)
|
|
|
a2cf7d |
{
|
|
|
a2cf7d |
- int32_t i0, j0, sx;
|
|
|
a2cf7d |
- double w, t;
|
|
|
a2cf7d |
- GET_HIGH_WORD (i0, x);
|
|
|
a2cf7d |
- sx = (i0 >> 31) & 1;
|
|
|
a2cf7d |
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
|
|
|
a2cf7d |
+ int64_t i0, sx;
|
|
|
a2cf7d |
+ int32_t j0;
|
|
|
a2cf7d |
+ EXTRACT_WORDS64 (i0, x);
|
|
|
a2cf7d |
+ sx = (i0 >> 63) & 1;
|
|
|
a2cf7d |
+ j0 = ((i0 >> 52) & 0x7ff) - 0x3ff;
|
|
|
a2cf7d |
if (j0 < 52)
|
|
|
a2cf7d |
{
|
|
|
a2cf7d |
if (j0 < 0)
|
|
|
a2cf7d |
{
|
|
|
a2cf7d |
- w = TWO52[sx] + x;
|
|
|
a2cf7d |
- t = w - TWO52[sx];
|
|
|
a2cf7d |
- GET_HIGH_WORD (i0, t);
|
|
|
a2cf7d |
- SET_HIGH_WORD (t, (i0 & 0x7fffffff) | (sx << 31));
|
|
|
a2cf7d |
+ double w = TWO52[sx] + x;
|
|
|
a2cf7d |
+ double t = w - TWO52[sx];
|
|
|
a2cf7d |
+ EXTRACT_WORDS64 (i0, t);
|
|
|
a2cf7d |
+ INSERT_WORDS64 (t, (i0 & UINT64_C (0x7fffffffffffffff))
|
|
|
a2cf7d |
+ | (sx << 63));
|
|
|
a2cf7d |
return t;
|
|
|
a2cf7d |
}
|
|
|
a2cf7d |
}
|
|
|
a2cf7d |
else
|
|
|
a2cf7d |
{
|
|
|
a2cf7d |
if (j0 == 0x400)
|
|
|
a2cf7d |
- return x + x; /* inf or NaN */
|
|
|
a2cf7d |
+ return x + x; /* inf or NaN */
|
|
|
a2cf7d |
else
|
|
|
a2cf7d |
- return x; /* x is integral */
|
|
|
a2cf7d |
+ return x; /* x is integral */
|
|
|
a2cf7d |
}
|
|
|
a2cf7d |
- w = TWO52[sx] + x;
|
|
|
a2cf7d |
+ double w = TWO52[sx] + x;
|
|
|
a2cf7d |
return w - TWO52[sx];
|
|
|
a2cf7d |
}
|
|
|
a2cf7d |
#ifndef __rint
|
|
|
a2cf7d |
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c
|
|
|
a2cf7d |
deleted file mode 100644
|
|
|
a2cf7d |
index 622e479c5f..0000000000
|
|
|
a2cf7d |
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c
|
|
|
a2cf7d |
+++ /dev/null
|
|
|
a2cf7d |
@@ -1,57 +0,0 @@
|
|
|
a2cf7d |
-/*
|
|
|
a2cf7d |
- * ====================================================
|
|
|
a2cf7d |
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
|
a2cf7d |
- *
|
|
|
a2cf7d |
- * Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
|
a2cf7d |
- * Permission to use, copy, modify, and distribute this
|
|
|
a2cf7d |
- * software is freely granted, provided that this notice
|
|
|
a2cf7d |
- * is preserved.
|
|
|
a2cf7d |
- * ====================================================
|
|
|
a2cf7d |
- */
|
|
|
a2cf7d |
-
|
|
|
a2cf7d |
-/*
|
|
|
a2cf7d |
- * rint(x)
|
|
|
a2cf7d |
- * Return x rounded to integral value according to the prevailing
|
|
|
a2cf7d |
- * rounding mode.
|
|
|
a2cf7d |
- * Method:
|
|
|
a2cf7d |
- * Using floating addition.
|
|
|
a2cf7d |
- * Exception:
|
|
|
a2cf7d |
- * Inexact flag raised if x not equal to rint(x).
|
|
|
a2cf7d |
- */
|
|
|
a2cf7d |
-
|
|
|
a2cf7d |
-#include <math.h>
|
|
|
a2cf7d |
-#include <math_private.h>
|
|
|
a2cf7d |
-#include <libm-alias-double.h>
|
|
|
a2cf7d |
-
|
|
|
a2cf7d |
-static const double
|
|
|
a2cf7d |
-TWO52[2]={
|
|
|
a2cf7d |
- 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
|
|
|
a2cf7d |
- -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
|
|
|
a2cf7d |
-};
|
|
|
a2cf7d |
-
|
|
|
a2cf7d |
-double
|
|
|
a2cf7d |
-__rint(double x)
|
|
|
a2cf7d |
-{
|
|
|
a2cf7d |
- int64_t i0,sx;
|
|
|
a2cf7d |
- int32_t j0;
|
|
|
a2cf7d |
- EXTRACT_WORDS64(i0,x);
|
|
|
a2cf7d |
- sx = (i0>>63)&1;
|
|
|
a2cf7d |
- j0 = ((i0>>52)&0x7ff)-0x3ff;
|
|
|
a2cf7d |
- if(j0<52) {
|
|
|
a2cf7d |
- if(j0<0) {
|
|
|
a2cf7d |
- double w = TWO52[sx]+x;
|
|
|
a2cf7d |
- double t = w-TWO52[sx];
|
|
|
a2cf7d |
- EXTRACT_WORDS64(i0,t);
|
|
|
a2cf7d |
- INSERT_WORDS64(t,(i0&UINT64_C(0x7fffffffffffffff))|(sx<<63));
|
|
|
a2cf7d |
- return t;
|
|
|
a2cf7d |
- }
|
|
|
a2cf7d |
- } else {
|
|
|
a2cf7d |
- if(j0==0x400) return x+x; /* inf or NaN */
|
|
|
a2cf7d |
- else return x; /* x is integral */
|
|
|
a2cf7d |
- }
|
|
|
a2cf7d |
- double w = TWO52[sx]+x;
|
|
|
a2cf7d |
- return w-TWO52[sx];
|
|
|
a2cf7d |
-}
|
|
|
a2cf7d |
-#ifndef __rint
|
|
|
a2cf7d |
-libm_alias_double (__rint, rint)
|
|
|
a2cf7d |
-#endif
|
|
|
a2cf7d |
diff --git a/sysdeps/x86_64/fpu/multiarch/s_rint-c.c b/sysdeps/x86_64/fpu/multiarch/s_rint-c.c
|
|
|
a2cf7d |
index 162a630ff9..b010150f52 100644
|
|
|
a2cf7d |
--- a/sysdeps/x86_64/fpu/multiarch/s_rint-c.c
|
|
|
a2cf7d |
+++ b/sysdeps/x86_64/fpu/multiarch/s_rint-c.c
|
|
|
a2cf7d |
@@ -1,3 +1,3 @@
|
|
|
a2cf7d |
#undef __rint
|
|
|
a2cf7d |
#define __rint __rint_c
|
|
|
a2cf7d |
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c>
|
|
|
a2cf7d |
+#include <sysdeps/ieee754/dbl-64/s_rint.c>
|
|
|
a2cf7d |
--
|
|
|
a2cf7d |
2.18.2
|
|
|
a2cf7d |
|