From patchwork Tue Feb 5 01:16:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul A. Clarke" X-Patchwork-Id: 1036387 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-99778-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="AYtPvYyp"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43tmrg47jmz9s4V for ; Tue, 5 Feb 2019 12:17:06 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:from:subject:date:mime-version :message-id:content-type:content-transfer-encoding; q=dns; s= default; b=ewZdbGhMkKc3U2pNz6ouqhsbacEM/uI5tiX2L3z7NBhIPpKx5Bvi2 IcyKkstLk6LJooyuIQgTaLf5BLadcnEiVZiL3diQn+rKi7uJQyNbHa30kRSeLVyA ypH64uWSe7Gyg9sV8PQPBBi6H/ecBepoqBh4K2wR0Ljmkt22N8yBak= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:from:subject:date:mime-version :message-id:content-type:content-transfer-encoding; s=default; bh=Ur75y2igfwv4PTixLZnXzemSVbE=; b=AYtPvYypNsPSKJzBV/cIZR8LCOEq JRWHHJHTpB/2NBpn7Tb6AJmgZ2F/7d3CQCwxtbhujgm0oXTfJbrZQp8lkGoMb9qB oLELC0KvTged4XV/VflEfR8G2yDNbMlyQUqg1H0XOmb4ieXIINR+LmTjWvvfHbR0 tyay38QGfEYMqTo= 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: 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 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 Cc: Tulio Magno Quites Machado Filho , Anton Blanchard From: Paul Clarke 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> 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 * 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(-) 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));