|
|
7c0489 |
From d3833cb69c7ff42ac8df68ed7b646c98c3a32eb8 Mon Sep 17 00:00:00 2001
|
|
|
7c0489 |
From: Stefan Liebler <stli@linux.ibm.com>
|
|
|
7c0489 |
Date: Wed, 11 Dec 2019 15:09:16 +0100
|
|
|
7c0489 |
Subject: [PATCH 04/28] Always use wordsize-64 version of s_ceil.c.
|
|
|
7c0489 |
|
|
|
7c0489 |
This patch replaces s_ceil.c in sysdeps/dbl-64 with the one in
|
|
|
7c0489 |
sysdeps/dbl-64/wordsize-64 and removes the latter one.
|
|
|
7c0489 |
The code is not changed except changes in code style.
|
|
|
7c0489 |
|
|
|
7c0489 |
Also adjusted the include path in x86_64 and sparc64 files.
|
|
|
7c0489 |
|
|
|
7c0489 |
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
7c0489 |
(cherry picked from commit 9f234eafe8698fd9a441ca2309a299d0bd771156)
|
|
|
7c0489 |
---
|
|
|
7c0489 |
sysdeps/ieee754/dbl-64/s_ceil.c | 59 ++++++-------------
|
|
|
7c0489 |
sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c | 51 ----------------
|
|
|
7c0489 |
.../sparc64/fpu/multiarch/s_ceil-generic.c | 2 +-
|
|
|
7c0489 |
.../sparc/sparc64/fpu/multiarch/s_ceil-vis3.c | 2 +-
|
|
|
7c0489 |
sysdeps/x86_64/fpu/multiarch/s_ceil-c.c | 2 +-
|
|
|
7c0489 |
5 files changed, 21 insertions(+), 95 deletions(-)
|
|
|
7c0489 |
delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
|
|
|
7c0489 |
|
|
|
7c0489 |
diff --git a/sysdeps/ieee754/dbl-64/s_ceil.c b/sysdeps/ieee754/dbl-64/s_ceil.c
|
|
|
7c0489 |
index 5a7434c737..3becdfc515 100644
|
|
|
7c0489 |
--- a/sysdeps/ieee754/dbl-64/s_ceil.c
|
|
|
7c0489 |
+++ b/sysdeps/ieee754/dbl-64/s_ceil.c
|
|
|
7c0489 |
@@ -24,61 +24,38 @@
|
|
|
7c0489 |
double
|
|
|
7c0489 |
__ceil (double x)
|
|
|
7c0489 |
{
|
|
|
7c0489 |
- int32_t i0, i1, j0;
|
|
|
7c0489 |
- uint32_t i, j;
|
|
|
7c0489 |
- EXTRACT_WORDS (i0, i1, x);
|
|
|
7c0489 |
- j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
|
|
|
7c0489 |
- if (j0 < 20)
|
|
|
7c0489 |
+ int64_t i0, i;
|
|
|
7c0489 |
+ int32_t j0;
|
|
|
7c0489 |
+ EXTRACT_WORDS64 (i0, x);
|
|
|
7c0489 |
+ j0 = ((i0 >> 52) & 0x7ff) - 0x3ff;
|
|
|
7c0489 |
+ if (j0 <= 51)
|
|
|
7c0489 |
{
|
|
|
7c0489 |
if (j0 < 0)
|
|
|
7c0489 |
{
|
|
|
7c0489 |
- /* return 0*sign(x) if |x|<1 */
|
|
|
7c0489 |
+ /* return 0 * sign(x) if |x| < 1 */
|
|
|
7c0489 |
if (i0 < 0)
|
|
|
7c0489 |
- {
|
|
|
7c0489 |
- i0 = 0x80000000; i1 = 0;
|
|
|
7c0489 |
- }
|
|
|
7c0489 |
- else if ((i0 | i1) != 0)
|
|
|
7c0489 |
- {
|
|
|
7c0489 |
- i0 = 0x3ff00000; i1 = 0;
|
|
|
7c0489 |
- }
|
|
|
7c0489 |
+ i0 = INT64_C (0x8000000000000000);
|
|
|
7c0489 |
+ else if (i0 != 0)
|
|
|
7c0489 |
+ i0 = INT64_C (0x3ff0000000000000);
|
|
|
7c0489 |
}
|
|
|
7c0489 |
else
|
|
|
7c0489 |
{
|
|
|
7c0489 |
- i = (0x000fffff) >> j0;
|
|
|
7c0489 |
- if (((i0 & i) | i1) == 0)
|
|
|
7c0489 |
- return x; /* x is integral */
|
|
|
7c0489 |
+ i = INT64_C (0x000fffffffffffff) >> j0;
|
|
|
7c0489 |
+ if ((i0 & i) == 0)
|
|
|
7c0489 |
+ return x; /* x is integral */
|
|
|
7c0489 |
if (i0 > 0)
|
|
|
7c0489 |
- i0 += (0x00100000) >> j0;
|
|
|
7c0489 |
- i0 &= (~i); i1 = 0;
|
|
|
7c0489 |
+ i0 += UINT64_C (0x0010000000000000) >> j0;
|
|
|
7c0489 |
+ i0 &= ~i;
|
|
|
7c0489 |
}
|
|
|
7c0489 |
}
|
|
|
7c0489 |
- else if (j0 > 51)
|
|
|
7c0489 |
+ else
|
|
|
7c0489 |
{
|
|
|
7c0489 |
if (j0 == 0x400)
|
|
|
7c0489 |
- return x + x; /* inf or NaN */
|
|
|
7c0489 |
+ return x + x; /* inf or NaN */
|
|
|
7c0489 |
else
|
|
|
7c0489 |
- return x; /* x is integral */
|
|
|
7c0489 |
- }
|
|
|
7c0489 |
- else
|
|
|
7c0489 |
- {
|
|
|
7c0489 |
- i = ((uint32_t) (0xffffffff)) >> (j0 - 20);
|
|
|
7c0489 |
- if ((i1 & i) == 0)
|
|
|
7c0489 |
- return x; /* x is integral */
|
|
|
7c0489 |
- if (i0 > 0)
|
|
|
7c0489 |
- {
|
|
|
7c0489 |
- if (j0 == 20)
|
|
|
7c0489 |
- i0 += 1;
|
|
|
7c0489 |
- else
|
|
|
7c0489 |
- {
|
|
|
7c0489 |
- j = i1 + (1 << (52 - j0));
|
|
|
7c0489 |
- if (j < i1)
|
|
|
7c0489 |
- i0 += 1; /* got a carry */
|
|
|
7c0489 |
- i1 = j;
|
|
|
7c0489 |
- }
|
|
|
7c0489 |
- }
|
|
|
7c0489 |
- i1 &= (~i);
|
|
|
7c0489 |
+ return x; /* x is integral */
|
|
|
7c0489 |
}
|
|
|
7c0489 |
- INSERT_WORDS (x, i0, i1);
|
|
|
7c0489 |
+ INSERT_WORDS64 (x, i0);
|
|
|
7c0489 |
return x;
|
|
|
7c0489 |
}
|
|
|
7c0489 |
#ifndef __ceil
|
|
|
7c0489 |
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
|
|
|
7c0489 |
deleted file mode 100644
|
|
|
7c0489 |
index b99829d2b0..0000000000
|
|
|
7c0489 |
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
|
|
|
7c0489 |
+++ /dev/null
|
|
|
7c0489 |
@@ -1,51 +0,0 @@
|
|
|
7c0489 |
-/* @(#)s_ceil.c 5.1 93/09/24 */
|
|
|
7c0489 |
-/*
|
|
|
7c0489 |
- * ====================================================
|
|
|
7c0489 |
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
|
7c0489 |
- *
|
|
|
7c0489 |
- * Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
|
7c0489 |
- * Permission to use, copy, modify, and distribute this
|
|
|
7c0489 |
- * software is freely granted, provided that this notice
|
|
|
7c0489 |
- * is preserved.
|
|
|
7c0489 |
- * ====================================================
|
|
|
7c0489 |
- */
|
|
|
7c0489 |
-
|
|
|
7c0489 |
-/*
|
|
|
7c0489 |
- * ceil(x)
|
|
|
7c0489 |
- * Return x rounded toward -inf to integral value
|
|
|
7c0489 |
- * Method:
|
|
|
7c0489 |
- * Bit twiddling.
|
|
|
7c0489 |
- */
|
|
|
7c0489 |
-
|
|
|
7c0489 |
-#include <math.h>
|
|
|
7c0489 |
-#include <math_private.h>
|
|
|
7c0489 |
-#include <libm-alias-double.h>
|
|
|
7c0489 |
-
|
|
|
7c0489 |
-double
|
|
|
7c0489 |
-__ceil(double x)
|
|
|
7c0489 |
-{
|
|
|
7c0489 |
- int64_t i0,i;
|
|
|
7c0489 |
- int32_t j0;
|
|
|
7c0489 |
- EXTRACT_WORDS64(i0,x);
|
|
|
7c0489 |
- j0 = ((i0>>52)&0x7ff)-0x3ff;
|
|
|
7c0489 |
- if(j0<=51) {
|
|
|
7c0489 |
- if(j0<0) {
|
|
|
7c0489 |
- /* return 0*sign(x) if |x|<1 */
|
|
|
7c0489 |
- if(i0<0) {i0=INT64_C(0x8000000000000000);}
|
|
|
7c0489 |
- else if(i0!=0) { i0=INT64_C(0x3ff0000000000000);}
|
|
|
7c0489 |
- } else {
|
|
|
7c0489 |
- i = INT64_C(0x000fffffffffffff)>>j0;
|
|
|
7c0489 |
- if((i0&i)==0) return x; /* x is integral */
|
|
|
7c0489 |
- if(i0>0) i0 += UINT64_C(0x0010000000000000)>>j0;
|
|
|
7c0489 |
- i0 &= (~i);
|
|
|
7c0489 |
- }
|
|
|
7c0489 |
- } else {
|
|
|
7c0489 |
- if(j0==0x400) return x+x; /* inf or NaN */
|
|
|
7c0489 |
- else return x; /* x is integral */
|
|
|
7c0489 |
- }
|
|
|
7c0489 |
- INSERT_WORDS64(x,i0);
|
|
|
7c0489 |
- return x;
|
|
|
7c0489 |
-}
|
|
|
7c0489 |
-#ifndef __ceil
|
|
|
7c0489 |
-libm_alias_double (__ceil, ceil)
|
|
|
7c0489 |
-#endif
|
|
|
7c0489 |
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c
|
|
|
7c0489 |
index febea745e1..80f68b6766 100644
|
|
|
7c0489 |
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c
|
|
|
7c0489 |
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c
|
|
|
7c0489 |
@@ -1,2 +1,2 @@
|
|
|
7c0489 |
#define __ceil __ceil_generic
|
|
|
7c0489 |
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c>
|
|
|
7c0489 |
+#include <sysdeps/ieee754/dbl-64/s_ceil.c>
|
|
|
7c0489 |
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.c
|
|
|
7c0489 |
index a03a0090f0..59822e0f8c 100644
|
|
|
7c0489 |
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.c
|
|
|
7c0489 |
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.c
|
|
|
7c0489 |
@@ -20,4 +20,4 @@
|
|
|
7c0489 |
|
|
|
7c0489 |
#define __ceil __ceil_vis3
|
|
|
7c0489 |
|
|
|
7c0489 |
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c>
|
|
|
7c0489 |
+#include <sysdeps/ieee754/dbl-64/s_ceil.c>
|
|
|
7c0489 |
diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c b/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c
|
|
|
7c0489 |
index 6a5ea3ff27..ada28baa1a 100644
|
|
|
7c0489 |
--- a/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c
|
|
|
7c0489 |
+++ b/sysdeps/x86_64/fpu/multiarch/s_ceil-c.c
|
|
|
7c0489 |
@@ -1,2 +1,2 @@
|
|
|
7c0489 |
#define __ceil __ceil_c
|
|
|
7c0489 |
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c>
|
|
|
7c0489 |
+#include <sysdeps/ieee754/dbl-64/s_ceil.c>
|
|
|
7c0489 |
--
|
|
|
7c0489 |
2.18.2
|
|
|
7c0489 |
|