From patchwork Tue Aug 16 17:02:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 14618 X-Patchwork-Delegate: joseph@codesourcery.com Received: (qmail 60897 invoked by alias); 16 Aug 2016 17:02:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 60833 invoked by uid 89); 16 Aug 2016 17:02:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=H*m:linux, __glibc_likely, 22, 7, 4, 7 X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: murphyp@linux.vnet.ibm.com From: "Paul E. Murphy" To: libc-alpha@sourceware.org Subject: [PATCH 6/6] Make shared ldbl files more shareable. Date: Tue, 16 Aug 2016 12:02:17 -0500 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16081617-0024-0000-0000-000014566B40 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005604; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000181; SDB=6.00745515; UDB=6.00351365; IPR=6.00518063; BA=6.00004662; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012351; XFM=3.00000011; UTC=2016-08-16 17:02:29 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16081617-0025-0000-0000-0000439AEFDF Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-16_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608160195 Use integer constants when equivalent, and use ldouble_t to enable sharing with the _Float128 variants. * math/e_exp2l.c (__ieee754_exp2l): Replace long double with ldouble_t, and use integer constants as appropriate. * math/s_fdiml.c: (__fdiml): Likewise. * math/k_rem_pio2l.c: (__kernel_rem_pio2l): Replace long double with ldouble_t. * math/s_ldexpl.c: (__ldexpl): Likewise. * math/s_nextdownl.c: (__nextdownl): Likewise. * math/s_fmaxl.c: (__fmaxl): Likewise, and include math_private.h for alias. * math/s_fminl.c: (__fminl): Likewise. --- math/e_exp2l.c | 20 ++++++++++---------- math/k_rem_pio2l.c | 2 +- math/s_fdiml.c | 10 ++++++---- math/s_fmaxl.c | 5 +++-- math/s_fminl.c | 5 +++-- math/s_ldexpl.c | 3 ++- math/s_nextdownl.c | 4 ++-- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/math/e_exp2l.c b/math/e_exp2l.c index b1ea7c7..5111a95 100644 --- a/math/e_exp2l.c +++ b/math/e_exp2l.c @@ -27,20 +27,20 @@ # define LDBL_EPSILON 0x1p-106L #endif -long double -__ieee754_exp2l (long double x) +ldouble_t +__ieee754_exp2l (ldouble_t x) { - if (__glibc_likely (isless (x, (long double) LDBL_MAX_EXP))) + if (__glibc_likely (isless (x, (ldouble_t) LDBL_MAX_EXP))) { - if (__builtin_expect (isgreaterequal (x, (long double) (LDBL_MIN_EXP - - LDBL_MANT_DIG - - 1)), 1)) + if (__builtin_expect (isgreaterequal (x, (ldouble_t) (LDBL_MIN_EXP + - LDBL_MANT_DIG + - 1)), 1)) { int intx = (int) x; - long double fractx = x - intx; - long double result; - if (fabsl (fractx) < LDBL_EPSILON / 4.0L) - result = __scalbnl (1.0L + fractx, intx); + ldouble_t fractx = x - intx; + ldouble_t result; + if (fabsl (fractx) < LDBL_EPSILON / 4) + result = __scalbnl (1 + fractx, intx); else result = __scalbnl (__ieee754_expl (M_LN2l * fractx), intx); math_check_force_underflow_nonneg (result); diff --git a/math/k_rem_pio2l.c b/math/k_rem_pio2l.c index 01bf158..d9613ed 100644 --- a/math/k_rem_pio2l.c +++ b/math/k_rem_pio2l.c @@ -4,7 +4,7 @@ #include int -__kernel_rem_pio2l (long double *x, long double *y, int e0, int nx, int prec, +__kernel_rem_pio2l (ldouble_t *x, ldouble_t *y, int e0, int nx, int prec, const int *ipio2) { fputs ("__kernel_rem_pio2l not implemented\n", stderr); diff --git a/math/s_fdiml.c b/math/s_fdiml.c index 4a1f672..38a2687 100644 --- a/math/s_fdiml.c +++ b/math/s_fdiml.c @@ -20,13 +20,15 @@ #include #include -long double -__fdiml (long double x, long double y) +#include + +ldouble_t +__fdiml (ldouble_t x, ldouble_t y) { if (islessequal (x, y)) - return 0.0f; + return 0; - long double r = x - y; + ldouble_t r = x - y; if (isinf (r) && !isinf (x) && !isinf (y)) __set_errno (ERANGE); diff --git a/math/s_fmaxl.c b/math/s_fmaxl.c index 3b22735..9536f9f 100644 --- a/math/s_fmaxl.c +++ b/math/s_fmaxl.c @@ -18,10 +18,11 @@ . */ #include +#include -long double -__fmaxl (long double x, long double y) +ldouble_t +__fmaxl (ldouble_t x, ldouble_t y) { return (isgreaterequal (x, y) || isnan (y)) ? x : y; } diff --git a/math/s_fminl.c b/math/s_fminl.c index 84e9e51..3ca2b47 100644 --- a/math/s_fminl.c +++ b/math/s_fminl.c @@ -18,10 +18,11 @@ . */ #include +#include -long double -__fminl (long double x, long double y) +ldouble_t +__fminl (ldouble_t x, ldouble_t y) { return (islessequal (x, y) || isnan (y)) ? x : y; } diff --git a/math/s_ldexpl.c b/math/s_ldexpl.c index 52fb093..d95708e 100644 --- a/math/s_ldexpl.c +++ b/math/s_ldexpl.c @@ -22,7 +22,8 @@ static char rcsid[] = "$NetBSD: $"; #include #include -long double __ldexpl(long double value, int exp) +ldouble_t +__ldexpl(ldouble_t value, int exp) { if(!isfinite(value)||value==0.0) return value + value; value = __scalbnl(value,exp); diff --git a/math/s_nextdownl.c b/math/s_nextdownl.c index e7607f5..e81d255 100644 --- a/math/s_nextdownl.c +++ b/math/s_nextdownl.c @@ -20,8 +20,8 @@ #include /* Return the greatest floating-point number less than X. */ -long double -__nextdownl (long double x) +ldouble_t +__nextdownl (ldouble_t x) { return -__nextupl (-x); }