Message ID | 8e1e3e59-26a6-b1cd-812e-b273b2c883ad@us.ibm.com |
---|---|
State | Committed |
Headers |
Received: (qmail 76233 invoked by alias); 5 Feb 2019 01:17:00 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 76212 invoked by uid 89); 5 Feb 2019 01:16:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Blanchard, blanchard, HContent-Transfer-Encoding:8bit X-HELO: mx0a-001b2d01.pphosted.com To: GNU C Library <libc-alpha@sourceware.org> Cc: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>, Anton Blanchard <anton@ozlabs.org> From: Paul Clarke <pc@us.ibm.com> Subject: [PATCH] [powerpc] Use float in e_sqrt.c Date: Mon, 4 Feb 2019 19:16:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 x-cbid: 19020501-0052-0000-0000-000003833776 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010537; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000279; SDB=6.01156479; UDB=6.00603229; IPR=6.00936938; MB=3.00025439; MTD=3.00000008; XFM=3.00000015; UTC=2019-02-05 01:16:54 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19020501-0053-0000-0000-00005FB898BB Message-Id: <8e1e3e59-26a6-b1cd-812e-b273b2c883ad@us.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit |
Commit Message
Paul A. Clarke
Feb. 5, 2019, 1:16 a.m. UTC
The type used within e_sqrt.c(__slow_ieee754_sqrtf) was, unnecessarily and likely inadvertently, double. float is not only appropriate, but also more efficient, avoiding the need for the compiler to emit a round-to-single-precision instruction. This is the difference in compiled code: 0000000000000000 <__ieee754_sqrtf>: 0: 2c 08 20 ec fsqrts f1,f1 - 4: 18 08 20 fc frsp f1,f1 - 8: 20 00 80 4e blr + 4: 20 00 80 4e blr (Found by Anton Blanchard.) 2019-02-04 Paul A. Clarke <pc@us.ibm.com> * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrtf): Use float instead of double. --- sysdeps/powerpc/fpu/e_sqrtf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 04/02/2019 23:16, Paul Clarke wrote: > The type used within e_sqrt.c(__slow_ieee754_sqrtf) was, unnecessarily and > likely inadvertently, double. float is not only appropriate, but also > more efficient, avoiding the need for the compiler to emit a > round-to-single-precision instruction. > > This is the difference in compiled code: > 0000000000000000 <__ieee754_sqrtf>: > 0: 2c 08 20 ec fsqrts f1,f1 > - 4: 18 08 20 fc frsp f1,f1 > - 8: 20 00 80 4e blr > + 4: 20 00 80 4e blr > > (Found by Anton Blanchard.) > > 2019-02-04 Paul A. Clarke <pc@us.ibm.com> > > * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrtf): > Use float instead of double. LGTM, thanks. > --- > sysdeps/powerpc/fpu/e_sqrtf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c > index 65df94b..5d9e900 100644 > --- a/sysdeps/powerpc/fpu/e_sqrtf.c > +++ b/sysdeps/powerpc/fpu/e_sqrtf.c > @@ -138,7 +138,7 @@ __slow_ieee754_sqrtf (float x) > float > __ieee754_sqrtf (float x) > { > - double z; > + float z; > > #ifdef _ARCH_PPCSQ > asm ("fsqrts %0,%1\n" :"=f" (z):"f" (x)); >
On Mon, Feb 04 2019, Paul Clarke wrote: > > * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrtf): > Use float instead of double. Looks good to me.
On Mon, Feb 04 2019, Paul Clarke wrote: > > * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrtf): > Use float instead of double. This patch is now committed. Thanks.
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c index 65df94b..5d9e900 100644 --- a/sysdeps/powerpc/fpu/e_sqrtf.c +++ b/sysdeps/powerpc/fpu/e_sqrtf.c @@ -138,7 +138,7 @@ __slow_ieee754_sqrtf (float x) float __ieee754_sqrtf (float x) { - double z; + float z; #ifdef _ARCH_PPCSQ asm ("fsqrts %0,%1\n" :"=f" (z):"f" (x));