From patchwork Tue Mar 13 18:31:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 26303 Received: (qmail 80302 invoked by alias); 13 Mar 2018 18:31:34 -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 80286 invoked by uid 89); 13 Mar 2018 18:31:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com From: Wilco Dijkstra To: "libc-alpha@sourceware.org" CC: nd Subject: [PATCH v3 3/3] Cleanup __ieee754_sqrt(f/l) Date: Tue, 13 Mar 2018 18:31:27 +0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1718; 7:25T4a/Mys6WOUBKFU9FTqw01bezkITLz1isEtGs9OACOlmvPBAEAyOPVfd1zekcABgnQHZA0rtOhT6PtLS5uZs3sgHwydi00nbSiWHllVuIhra7PFveiASCFD7t/mfCWlK13edlbXqDjbYJIw2wgy4y5zmTw8c7k4nmb/VhTcI2ZuzLDgmhuV0N2tJ7C/d39fTnx5SDr9D76OqdznYX4cRtEKzppgbDWgoabqVEA38K3yftD5E+bq24TlaFN3ZhQ x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 7332bbac-e1de-4bfc-ee55-08d58910a21a x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1718; x-ms-traffictypediagnostic: DB6PR0801MB1718: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(250305191791016)(180628864354917)(22074186197030); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231221)(944501244)(52105095)(6055026)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:DB6PR0801MB1718; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1718; x-forefront-prvs: 0610D16BBE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(376002)(396003)(39380400002)(346002)(377424004)(189003)(199004)(54534003)(99286004)(97736004)(7696005)(25786009)(55016002)(6116002)(3280700002)(9686003)(575784001)(86362001)(3846002)(6306002)(5660300001)(3660700001)(6916009)(2906002)(8936002)(2501003)(81166006)(5250100002)(105586002)(2900100001)(316002)(4326008)(102836004)(53936002)(7736002)(305945005)(26005)(106356001)(6436002)(68736007)(14454004)(66066001)(6506007)(81156014)(33656002)(478600001)(74316002)(8676002)(5640700003)(72206003)(2351001)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1718; H:DB6PR0801MB2053.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5BSkkL8QO11aNaT82S/XBo0Vao+lxhixrjiBNWZT0HdGQfKzE0GGMOC5o4cfWcy2wFdqqDQ6ftGKhzHw6fi58t/zWaV/semJKiZRR0hvtNscWL8XginwWi7TGtEGRMPhOs9caIt9sBWRM+eeZXobMFP5HyMwAleFe5PXUJTjkrnr9E9f5HtW6JKaGs4CYa54cxe7j/4/MlrbGPr4iZPIpW+gGv7DkZPBNq93+OVf855yPGL7OY2tIsSBbgBvhrQS+PHZ1yf8zPX0kTuA5ZHo9WPbiZOCehqdD/izXaYEckbQYBe3l/PlU88IapZiKSnRWwTwSLFthoG6jnVDLhdEQw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7332bbac-e1de-4bfc-ee55-08d58910a21a X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Mar 2018 18:31:27.4011 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1718 Finally remove the now unused target specific__ieee754_sqrt(f/l) inlines. ChangeLog: 2018-03-13 Wilco Dijkstra * sysdeps/aarch64/fpu/math_private.h (__ieee754_sqrt): Remove. (__ieee754_sqrtf): Remove. * sysdeps/alpha/fpu/math_private.h (__ieee754_sqrt): Remove. (__ieee754_sqrtf): Remove. * sysdeps/generic/math-type-macros.h (M_SQRT): Use __builtin_sqrt(f). * sysdeps/m68k/m680x0/fpu/mathimpl.h (__ieee754_sqrt): Remove. * sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrt): Remove. (__ieee754_sqrtf): Remove. * sysdeps/s390/fpu/bits/mathinline.h (__ieee754_sqrt): Remove. (__ieee754_sqrtf): Remove. (sqrtl): Remove. * sysdeps/sparc/fpu/bits/mathinline.h (sqrt) Remove. (sqrtf): Remove. (sqrtl): Remove. (__ieee754_sqrt): Remove. (__ieee754_sqrtf): Remove. (__ieee754_sqrtl): Remove. * sysdeps/m68k/m680x0/fpu/mathimpl.h (__ieee754_sqrt): Remove. * sysdeps/x86/fpu/math_private.h (__ieee754_sqrt): Remove. * sysdeps/x86_64/fpu/math_private.h (__ieee754_sqrt): Remove. (__ieee754_sqrtf): Remove. (__ieee754_sqrtl): Remove. diff --git a/sysdeps/aarch64/fpu/math_private.h b/sysdeps/aarch64/fpu/math_private.h index 3eea86eac19520a0932c6debd2a616f035fcf5f1..d9c2d710a95ebe76b25c9dc86ed0bea729a3a6cd 100644 --- a/sysdeps/aarch64/fpu/math_private.h +++ b/sysdeps/aarch64/fpu/math_private.h @@ -27,22 +27,6 @@ #define math_force_eval(x) \ ({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "w" (__x)); }) -extern __always_inline double -__ieee754_sqrt (double d) -{ - double res; - asm __volatile__ ("fsqrt %d0, %d1" : "=w" (res) : "w" (d)); - return res; -} - -extern __always_inline float -__ieee754_sqrtf (float s) -{ - float res; - asm __volatile__ ("fsqrt %s0, %s1" : "=w" (res) : "w" (s)); - return res; -} - static __always_inline void libc_feholdexcept_aarch64 (fenv_t *envp) { diff --git a/sysdeps/alpha/fpu/math_private.h b/sysdeps/alpha/fpu/math_private.h index 1e97c867c38767a2237df21f84e9c55a53ad13bb..95dc32c969c1133add0d5a1c42e1f1bd0c9d0e2d 100644 --- a/sysdeps/alpha/fpu/math_private.h +++ b/sysdeps/alpha/fpu/math_private.h @@ -21,30 +21,4 @@ #include_next -#ifdef __alpha_fix__ -extern __always_inline double -__ieee754_sqrt (double d) -{ - double ret; -# ifdef _IEEE_FP_INEXACT - asm ("sqrtt/suid %1,%0" : "=&f"(ret) : "f"(d)); -# else - asm ("sqrtt/sud %1,%0" : "=&f"(ret) : "f"(d)); -# endif - return ret; -} - -extern __always_inline float -__ieee754_sqrtf (float d) -{ - float ret; -# ifdef _IEEE_FP_INEXACT - asm ("sqrts/suid %1,%0" : "=&f"(ret) : "f"(d)); -# else - asm ("sqrts/sud %1,%0" : "=&f"(ret) : "f"(d)); -# endif - return ret; -} -#endif /* FIX */ - #endif /* ALPHA_MATH_PRIVATE_H */ diff --git a/sysdeps/generic/math-type-macros.h b/sysdeps/generic/math-type-macros.h index 8ceaa4e02fc3a56d7fae56111b93dd7e44d050a3..ffcf7b80b608df537f578fcb0ae584d46fe68eb1 100644 --- a/sysdeps/generic/math-type-macros.h +++ b/sysdeps/generic/math-type-macros.h @@ -91,7 +91,7 @@ #define M_HYPOT M_SUF (__ieee754_hypot) #define M_LOG M_SUF (__ieee754_log) #define M_SINH M_SUF (__ieee754_sinh) -#define M_SQRT M_SUF (__ieee754_sqrt) +#define M_SQRT M_SUF (sqrt) /* Needed to evaluate M_MANT_DIG below. */ #include diff --git a/sysdeps/m68k/m680x0/fpu/mathimpl.h b/sysdeps/m68k/m680x0/fpu/mathimpl.h index 848f9cffaadad09443cd539ceb68da5712a93b39..d39094cccbd3712dfae4601967ee695722b446a0 100644 --- a/sysdeps/m68k/m680x0/fpu/mathimpl.h +++ b/sysdeps/m68k/m680x0/fpu/mathimpl.h @@ -30,7 +30,6 @@ __inline_mathop (__ieee754_exp10, tentox,) __inline_mathop (__ieee754_log10, log10,) __inline_mathop (__ieee754_log2, log2,) __inline_mathop (__ieee754_log, logn,) -__inline_mathop (__ieee754_sqrt, sqrt,) __inline_mathop (__ieee754_atanh, atanh,) __m81_defun (double, __ieee754_remainder, (double __x, double __y),) diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h index 4d1e571f8489300c35ca8a44cd0d83c5199f2267..b9fc721257235a549873beb9e31fa30085b76d4a 100644 --- a/sysdeps/powerpc/fpu/math_private.h +++ b/sysdeps/powerpc/fpu/math_private.h @@ -42,36 +42,6 @@ __ieee754_sqrtf128 (_Float128 __x) } #endif -extern double __slow_ieee754_sqrt (double); -extern __always_inline double -__ieee754_sqrt (double __x) -{ - double __z; - -#ifdef _ARCH_PPCSQ - asm ("fsqrt %0,%1" : "=f" (__z) : "f" (__x)); -#else - __z = __slow_ieee754_sqrt(__x); -#endif - - return __z; -} - -extern float __slow_ieee754_sqrtf (float); -extern __always_inline float -__ieee754_sqrtf (float __x) -{ - float __z; - -#ifdef _ARCH_PPCSQ - asm ("fsqrts %0,%1" : "=f" (__z) : "f" (__x)); -#else - __z = __slow_ieee754_sqrtf(__x); -#endif - - return __z; -} - #if defined _ARCH_PWR5X # ifndef __round diff --git a/sysdeps/s390/fpu/bits/mathinline.h b/sysdeps/s390/fpu/bits/mathinline.h deleted file mode 100644 index 83ce6fa4e0915aaa7651263255776e96d9aee290..0000000000000000000000000000000000000000 --- a/sysdeps/s390/fpu/bits/mathinline.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Inline math functions for s390. - Copyright (C) 2004-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _MATH_H -# error "Never use directly; include instead." -#endif - -#ifndef __extern_inline -# define __MATH_INLINE __inline -#else -# define __MATH_INLINE __extern_inline -#endif - -#if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ - && defined __OPTIMIZE__ - -/* This code is used internally in the GNU libc. */ -#ifdef __LIBC_INTERNAL_MATH_INLINES - -__MATH_INLINE double -__NTH (__ieee754_sqrt (double x)) -{ - double res; - - __asm__ ( "sqdbr %0,%1" : "=f" (res) : "f" (x) ); - return res; -} - -__MATH_INLINE float -__NTH (__ieee754_sqrtf (float x)) -{ - float res; - - __asm__ ( "sqebr %0,%1" : "=f" (res) : "f" (x) ); - return res; -} - -# if !defined __NO_LONG_DOUBLE_MATH -__MATH_INLINE long double -__NTH (sqrtl (long double __x)) -{ - long double res; - - __asm__ ( "sqxbr %0,%1" : "=f" (res) : "f" (__x) ); - return res; -} -# endif /* !__NO_LONG_DOUBLE_MATH */ - -#endif /* __LIBC_INTERNAL_MATH_INLINES */ - -#endif /* __NO_MATH_INLINES */ diff --git a/sysdeps/sparc/fpu/bits/mathinline.h b/sysdeps/sparc/fpu/bits/mathinline.h index 5940a1d0a00224d43715da715986ead6c48b4322..f6118c7ca50bb3630a81e6b415dea77aad8f5c68 100644 --- a/sysdeps/sparc/fpu/bits/mathinline.h +++ b/sysdeps/sparc/fpu/bits/mathinline.h @@ -33,86 +33,6 @@ # define __MATH_INLINE __extern_inline # endif /* __cplusplus */ -/* The gcc, version 2.7 or below, has problems with all this inlining - code. So disable it for this version of the compiler. */ -# if __GNUC_PREREQ (2, 8) - -# if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2) - -__MATH_INLINE double -__NTH (sqrt (double __x)) -{ - register double __r; - __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x)); - return __r; -} - -__MATH_INLINE float -__NTH (sqrtf (float __x)) -{ - register float __r; - __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x)); - return __r; -} - -# if __WORDSIZE == 64 -__MATH_INLINE long double -__NTH (sqrtl (long double __x)) -{ - long double __r; - extern void _Qp_sqrt (long double *, const long double *); - _Qp_sqrt (&__r, &__x); - return __r; -} -# elif !defined __NO_LONG_DOUBLE_MATH -__MATH_INLINE long double -sqrtl (long double __x) __THROW -{ - extern long double _Q_sqrt (const long double); - return _Q_sqrt (__x); -} -# endif /* sparc64 */ - -# endif /* !__NO_MATH_INLINES && !GCC 3.2+ */ - -/* This code is used internally in the GNU libc. */ -# ifdef __LIBC_INTERNAL_MATH_INLINES -__MATH_INLINE double -__ieee754_sqrt (double __x) -{ - register double __r; - __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x)); - return __r; -} - -__MATH_INLINE float -__ieee754_sqrtf (float __x) -{ - register float __r; - __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x)); - return __r; -} - -# if __WORDSIZE == 64 -__MATH_INLINE long double -__ieee754_sqrtl (long double __x) -{ - long double __r; - extern void _Qp_sqrt (long double *, const long double *); - _Qp_sqrt(&__r, &__x); - return __r; -} -# elif !defined __NO_LONG_DOUBLE_MATH -__MATH_INLINE long double -__ieee754_sqrtl (long double __x) -{ - extern long double _Q_sqrt (const long double); - return _Q_sqrt (__x); -} -# endif /* sparc64 */ -# endif /* __LIBC_INTERNAL_MATH_INLINES */ -# endif /* gcc 2.8+ */ - # ifdef __USE_ISOC99 # ifndef __NO_MATH_INLINES diff --git a/sysdeps/x86/fpu/bits/mathinline.h b/sysdeps/x86/fpu/bits/mathinline.h index aed2a8febb7987789c08556d618afb2010e099ff..9b7a28f83e38ff5e40f20f6d0236020fb73961d0 100644 --- a/sysdeps/x86/fpu/bits/mathinline.h +++ b/sysdeps/x86/fpu/bits/mathinline.h @@ -819,7 +819,6 @@ __NTH (__finite (double __x)) /* This code is used internally in the GNU libc. */ # ifdef __LIBC_INTERNAL_MATH_INLINES -__inline_mathop (__ieee754_sqrt, "fsqrt") __inline_mathcode2_ (long double, __ieee754_atan2l, __y, __x, register long double __value; __asm __volatile__ ("fpatan\n\t" diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h index 027a6a3a4d0a68948f19ebaa129bf442a9f4f3e6..13052893ef9541e100d6d68b85ff16a2910a28e3 100644 --- a/sysdeps/x86_64/fpu/math_private.h +++ b/sysdeps/x86_64/fpu/math_private.h @@ -48,38 +48,6 @@ #include #include_next -extern __always_inline double -__ieee754_sqrt (double d) -{ - double res; -#if defined __AVX__ || defined SSE2AVX - asm ("vsqrtsd %1, %0, %0" : "=x" (res) : "xm" (d)); -#else - asm ("sqrtsd %1, %0" : "=x" (res) : "xm" (d)); -#endif - return res; -} - -extern __always_inline float -__ieee754_sqrtf (float d) -{ - float res; -#if defined __AVX__ || defined SSE2AVX - asm ("vsqrtss %1, %0, %0" : "=x" (res) : "xm" (d)); -#else - asm ("sqrtss %1, %0" : "=x" (res) : "xm" (d)); -#endif - return res; -} - -extern __always_inline long double -__ieee754_sqrtl (long double d) -{ - long double res; - asm ("fsqrt" : "=t" (res) : "0" (d)); - return res; -} - #ifdef __SSE4_1__ extern __always_inline double __rint (double d)