From patchwork Fri Mar 29 13:35:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161423 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2048535jan; Fri, 29 Mar 2019 06:35:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAG6kXLDv6GHl4d2KHJlEAHGHb5MwWVB9IwLHgcOXJMcIqF9q7aBCAx1VOolDwbZoFWrGB X-Received: by 2002:a63:e151:: with SMTP id h17mr45810333pgk.413.1553866553375; Fri, 29 Mar 2019 06:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866553; cv=none; d=google.com; s=arc-20160816; b=OerXSJTDR5TJpNkXdMuYI+nTiBfEkbaEfELiBpM+siF5UUTaptCxNDeeW4OwvZ8VgM aa3s5vco1ascmHqc037galXsFXYZjhf/eMVxRGSDD3aZAVJ/IMmKDD5USYcTis9rTV9q ApUJNMS/QmoE113ZQ60odxCxMVn+DafOEG/yyOiOUbou2+iTSuQI3XJ6ge7S5tcxrQrq 2ZX3RKVqRAq0x4sYIrGKMv6G3tLCnHVUFTfS5kUmGWg+VhsdePZPWOyB/0RqZ6xoEx63 Ua5CERSfzFrjo86WsDEMoEnU0Brz886gvRRpc5caEc/IKfYiIMGM12NS+mWZZEhhHKiJ +f6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=TAo2DUAUJQd/vqo7PkXi8uccCXl0fbPQ2DNEDL1dVr8=; b=cuDlHohs6uzRDuZoEjUz2Qb754dhm7XeMOGzCrXsESb1qy0FgGjXvw2LfwzFHBBKu9 gl6NV7ir3eXjb3iyl3+7rC6GK0I7PhMbLbFJ1+J6gpIHKogiFeMS5rndJ8cwb0ULxIwA 13WWyP53DnbJi5RL5f28PwdS5Nwx5T1H0dm+CzdHxP7E6wnJhvZVB9HxKvNYLpsml7S+ U35b0Yk9l1qf6daWr2I9VSUvDL6ue/W4w90szK5j3cvP8wwWAU3PYvQjlkODRt5viDfM hmZ4gsdlUAA+UI8ocpzwx6hWn9gl+Ky1Og7M5wf1G11j+gvxaETyjkdi6PnDkyzYXeq0 WL8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=s3Bx7Z1q; dkim=pass header.i=@linaro.org header.s=google header.b=heMyRpn9; spf=pass (google.com: domain of libc-alpha-return-100992-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100992-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a64si1946086pfb.56.2019.03.29.06.35.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:35:53 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100992-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=s3Bx7Z1q; dkim=pass header.i=@linaro.org header.s=google header.b=heMyRpn9; spf=pass (google.com: domain of libc-alpha-return-100992-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100992-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=g20casecSOyGe/xuCDRZbdDxYLHMJn7 zBqHZ6Y2FR2bNFPP3RlP/JGTHr4o79gLzakXBs+7Ag+kBxwb4NDOsyjSOPXf8QQk DW+HwvDJUmViDLDMqNvlM6pPMTPGIMxXcMu6VvU0dfNluptkeTjX3kGn+dMLGTrZ Dzu/EpB+z+QE= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=KeYOaPr3LO7XRwX2622i0MkjYEk=; b=s3Bx7 Z1qmnOGgSDUxm0qeXle08xUD/1Eh1xqZTk6U9K4XFbiubOjrgx0gki98pWKOBZ0X xK0k8hWHgKAUko1tJxDV/bj+LiepwTi/yrE/Ev4Kq9Ls9IOAppWvlkoiDfcCRKZ5 J9t4O7/JZiX9BhiIw9nIkeomjEzCwo4y4uIN4A= Received: (qmail 117829 invoked by alias); 29 Mar 2019 13:35:39 -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 117814 invoked by uid 89); 29 Mar 2019 13:35:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=UD:S, HX-HELO:sk:mail-ua, distributed X-HELO: mail-ua1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=TAo2DUAUJQd/vqo7PkXi8uccCXl0fbPQ2DNEDL1dVr8=; b=heMyRpn9+usSDOoaqI6DDPXeZ8AZ0zTQ18B8RAGdxGJoHQeaXuact6o+zueWsrgoDF qP8RFuvgrUnkbdHrlNL/D1ADfAHtHzVV5fhVqXwZfbw74fA2tLuDYfh3CsZNVMYjIul1 nXfwmwjbupo/az5oN60A3zC4GUohQM5IsRvXDhbfOpN1Y5Jt5paqPBOJx3D6drdcRj8G TMEsLENqNvuyqFn/sohINZ6FHIczwwHAikEZWknVzQHvYN6U4RZbx2gKs2qZCfHtNTCO y7pNDEthC1Hv6yfF59k/LR0k/kKzxpPEx5ArTR0gqVJiw8WTw5MDSWR38nNV1AA3RpKF yGdQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 01/28] powerpc: Use generic fabs{f} implementations Date: Fri, 29 Mar 2019 10:35:02 -0300 Message-Id: <20190329133529.22523-2-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> Since be2e25bbd78f9fdf the generic ieee754 implementation uses compiler builtin which generates fabs{f} for all supported targets. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/s_fabs.S: Remove file. * sysdeps/powerpc/fpu/s_fabsf.S: Likewise. --- sysdeps/powerpc/fpu/s_fabs.S | 33 --------------------------------- sysdeps/powerpc/fpu/s_fabsf.S | 1 - 2 files changed, 34 deletions(-) delete mode 100644 sysdeps/powerpc/fpu/s_fabs.S delete mode 100644 sysdeps/powerpc/fpu/s_fabsf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/s_fabs.S b/sysdeps/powerpc/fpu/s_fabs.S deleted file mode 100644 index 7147f6b4a2..0000000000 --- a/sysdeps/powerpc/fpu/s_fabs.S +++ /dev/null @@ -1,33 +0,0 @@ -/* Floating-point absolute value. PowerPC version. - Copyright (C) 1997-2019 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 - . */ - -#include -#include -#include - -ENTRY(__fabs) -/* double [f1] fabs (double [f1] x); */ - fabs fp1,fp1 - blr -END(__fabs) - -libm_alias_double (__fabs, fabs) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__fabs,__fabsf) -libm_alias_float (__fabs, fabs) diff --git a/sysdeps/powerpc/fpu/s_fabsf.S b/sysdeps/powerpc/fpu/s_fabsf.S deleted file mode 100644 index 877c710ce8..0000000000 --- a/sysdeps/powerpc/fpu/s_fabsf.S +++ /dev/null @@ -1 +0,0 @@ -/* __fabsf is in s_fabs.S */ From patchwork Fri Mar 29 13:35:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161424 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2048875jan; Fri, 29 Mar 2019 06:36:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkj2juOCD75YYj62Rb9jqwJdyc/BZEaX31EEGMAz4izNp3FYZyjUo89XmWsuFC+1GNEaQz X-Received: by 2002:a62:75d7:: with SMTP id q206mr23638581pfc.213.1553866568913; Fri, 29 Mar 2019 06:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866568; cv=none; d=google.com; s=arc-20160816; b=BKpZW/k9pAxlGlYz7RkdsVAMyadEpNcVy1tYVqSSbYhqNfjnv3mFL/uhtAPAy14/p1 HJYLgPcey2uv++f+OBetd4ehYFuRpGVZdTCwt4aZ5yMutQjhOBdRMVEf0G5EgWZOVEsa eUqAKIXCPHn9dtIjZba39VdnLUZ51q4+oQzC8hhBzKzixxjoBf5ilEVW4zvaf04+Qkys koJXCRkG1fvt3XujDP3EDRo9x3qmenyaxsSC0gTs8paAAVB+E7E4tyOrtAeuStat53V/ zrLPawAvYDpqWIbywyBYYpa9+PgZF/63oy7qEDRVfIJhRjoj15KEEeWGb1HJtl5f0ynz uCLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=Z/sHlL5wy7TiyYQfadp1i9xEkRP/M/305UolO73VwP4=; b=aUIPkH/rp2r1942hubX8DE3BBc/qDhIpl1/3B+Pms8v9gAoJVmYgPxmE9JN7Os3mNs I+mudmE7Y59piX+ijKlsrOoOW/hxF85TgRBr0PLLnXOkV48Ip9XtntD5XknLiKLDLhh3 +l1L3F3RerF8T5dazCn6KtpgaE4PGpnwhB4v2saVpKTRMJwzGQPH/uV8R7SGdwmksAwL pBirBLyD1pdTDQaabqQS4XCe/CYdsz+kXAz7PK82IrJ+dnMm5ZWu21p2gN7SQiCU+//+ JpBDDW0grliZpMRdtMAVrALZIDltkO80R687lKP1iq85FLMmaSAzgugCODaA9xnBJch1 vvqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=TuCtL6LZ; dkim=pass header.i=@linaro.org header.s=google header.b=EKArZg5r; spf=pass (google.com: domain of libc-alpha-return-100993-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100993-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g126si1889571pgc.75.2019.03.29.06.36.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:36:08 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100993-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=TuCtL6LZ; dkim=pass header.i=@linaro.org header.s=google header.b=EKArZg5r; spf=pass (google.com: domain of libc-alpha-return-100993-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100993-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=nrHZabBxwk2orVNzM2AQwN8NnU4skyd OjbOzsgyCafzRwh1JUnWwauR8OR1wJ4v3XmIeaCofBKHxZtriD3AfXpqgxqJ7Ejs n0sfTF4AeZKstxru1nlTnZZzWFc30gk3vOgSR/C981PbfEcQIfp0uEejx1yWJ4RA M4nXTWp5+OL0= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=4RrTUdmjgGshyMovIra2ZKaQ8eA=; b=TuCtL 6LZhy05uEKqTU4XmaG9PoTVC+HLl6LIsL6v+id320wFch859qoK5QlsbmtZQncT/ ZNOzD0EZm2r026sTerlzih8TTL1ZFPMNBLil765hYUrPaBj9/t+OIF/jSvnMezsA rVsGa/KopQXYJRONsrqNm5fFuSboHvQ/BdvWGs= Received: (qmail 117857 invoked by alias); 29 Mar 2019 13:35:39 -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 117831 invoked by uid 89); 29 Mar 2019 13:35:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=UD:S X-HELO: mail-vs1-f52.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Z/sHlL5wy7TiyYQfadp1i9xEkRP/M/305UolO73VwP4=; b=EKArZg5ryAw9nnt31RDClO+kHgB5LHXX77F0A0LdXo28FqOFG3llpAY5Jg/7bsdlft Z+tTiYDwQygXqOfGqFXB95Y/9vtQW4JChS4N7XdcHzy529miiAsq98o2jo496nfKx3oA rfOedgFhSpiB1KMoI74FiZy7XNveCV/HBfUn5rMAoK2Bawld7ClaqBvIW/Yka22QDDlE GqIpu1M0Hn4rge5tT2oubIcOb46iQG+eR3JxMsZ5SvUk7S4TBJoBWVCsz9ER2+PfmVjo TdFm3NdiUx62tXhv7jG1VozNXhgau0V47d6mh7WngIzI7MyNx4PMXuVr2dydR+Yb0aoZ shww== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 02/28] powerpc: fma using builtins Date: Fri, 29 Mar 2019 10:35:03 -0300 Message-Id: <20190329133529.22523-3-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patch just refactor the assembly implementation to use compiler builtins instead. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/s_fma.S: Remove file. * sysdeps/powerpc/fpu/s_fmaf.S: Likewise. * sysdeps/powerpc/fpu/s_fma.c: New file. * sysdeps/powerpc/fpu/s_fmaf.c: Likewise. --- sysdeps/powerpc/fpu/{s_fma.S => s_fma.c} | 12 +++++------- sysdeps/powerpc/fpu/{s_fmaf.S => s_fmaf.c} | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) rename sysdeps/powerpc/fpu/{s_fma.S => s_fma.c} (82%) rename sysdeps/powerpc/fpu/{s_fmaf.S => s_fmaf.c} (82%) -- 2.17.1 diff --git a/sysdeps/powerpc/fpu/s_fma.S b/sysdeps/powerpc/fpu/s_fma.c similarity index 82% rename from sysdeps/powerpc/fpu/s_fma.S rename to sysdeps/powerpc/fpu/s_fma.c index 92e08eb583..688f9badf5 100644 --- a/sysdeps/powerpc/fpu/s_fma.S +++ b/sysdeps/powerpc/fpu/s_fma.c @@ -1,5 +1,5 @@ /* Compute x * y + z as ternary operation. PowerPC version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2019 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 @@ -19,10 +19,8 @@ #include #include -ENTRY_TOCLESS(__fma) -/* double [f1] fma (double [f1] x, double [f2] y, double [f3] z); */ - fmadd fp1,fp1,fp2,fp3 - blr -END(__fma) - +double __fma (double x, double y, double z) +{ + return __builtin_fma (x, y, z); +} libm_alias_double (__fma, fma) diff --git a/sysdeps/powerpc/fpu/s_fmaf.S b/sysdeps/powerpc/fpu/s_fmaf.c similarity index 82% rename from sysdeps/powerpc/fpu/s_fmaf.S rename to sysdeps/powerpc/fpu/s_fmaf.c index 9579e9492e..38b59e1f2f 100644 --- a/sysdeps/powerpc/fpu/s_fmaf.S +++ b/sysdeps/powerpc/fpu/s_fmaf.c @@ -1,5 +1,5 @@ /* Compute x * y + z as ternary operation. PowerPC version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2019 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 @@ -19,10 +19,8 @@ #include #include -ENTRY_TOCLESS(__fmaf) -/* float [f1] fmaf (float [f1] x, float [f2] y, float [f3] z); */ - fmadds fp1,fp1,fp2,fp3 - blr -END(__fmaf) - +float __fmaf (float x, float y, float z) +{ + return __builtin_fmaf (x, y, z); +} libm_alias_float (__fma, fma) From patchwork Fri Mar 29 13:35:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161425 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2049169jan; Fri, 29 Mar 2019 06:36:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqztCXNmVEjopVOt5waDpqXvEo2SVJebs+RGOJMohxNr79vsh47ZTjaulYcqgVjnYGMyQ+ow X-Received: by 2002:a62:14d7:: with SMTP id 206mr18891525pfu.162.1553866582517; Fri, 29 Mar 2019 06:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866582; cv=none; d=google.com; s=arc-20160816; b=Ae1KzW04ctLBb4Vyx3b2lSnnahf3Mn3UQiICr/qpGyDmhvkHJ9THf495thoCTJb+VP hVw/ACx+MBlFbZ/PYsTPmUQsxLDDZHgEwOoxtasDAA6g1rT4AIyfxW7QDLZ8tBLi5e9M ZCIzEzJu0olAtULfvrNwe1iMjq4nT9XuQqGnPNKRN1UmzS252VC5qt4z3G2p+jztxBu7 sMqh+mBeHibNlBgBLuxM7c5XCSmVsaOh9nGvLFZZ5UfDeF/W/ZYSbb+SPiIO73xynRHI kadi6akWyLBudUKjpZUPQvtfUfg2AKFImeGw2tlj+Bcy0Z7kii3JZq8DfKFwB9oSFo1b cHZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=uG6MUedU6ifpcrxFJiMSLEOPSJnsbLQDK0VUB1Nwn3E=; b=zOOPwS7EtcaMp0dqqwwUS6O17bFxkK0aR5vaguAIDYCxt4fICxg/i/Y1jbALVwEh0H Me+488MloXSq0OCx/aCHA3Jh9Xk+uxo+7KZp7Ep/3drWwlhKiPyzRjXoifvTx5Vz68bm DJLli3XmRv0+U+M0YFE5/Z/IoENaYfWMga9sKQJ08GEucU2oxK15l3LE/IzQrXIucAuj qeUdwFRyxtAdDY5gXm0LzLRoMqd162ZF//+D5GXXxathkVxe7sG3i0hDxyugZF7PtTGV C/3geB7KV4uaLV4vFtbiZo1lKIlx93kFmFdVEKrb1E88xsUSumkqBov4u1liHVdw4Yuq E1dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=v7FuQl00; dkim=pass header.i=@linaro.org header.s=google header.b=rhKMyfjk; spf=pass (google.com: domain of libc-alpha-return-100994-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100994-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v5si1868915plp.392.2019.03.29.06.36.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:36:22 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100994-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=v7FuQl00; dkim=pass header.i=@linaro.org header.s=google header.b=rhKMyfjk; spf=pass (google.com: domain of libc-alpha-return-100994-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100994-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=ihbKTvZVJCl/GwXVYSL/QSFXfp8j56J wVqqOK8ZTABbx9N2G+HQ6ABj+XgXdN9JMlOgF5hyfINXkFhDLAiVqJC0Vh7SE0Pf AUDYAuwbMBJfOUmDz1AxmbRKj5T/8/p6huEMhlfD0GARzz2sf9WJEtLgnHeUZHcO YTUhWIJdm9ZY= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=hE9yjMTbV/bx9tjWZaLwjrPXPdw=; b=v7FuQ l00a/aITFeDqMKGedpqBNvqMpqMAdO6oTL9f7b3KuloHbgcYCw0ujwSZoEdptaMO YCCDMKVzuNu+fz9+nhlFuEbu9KdYbZVTeqzyiiQfa+bbQpL96djkOhUGz9a9livs RdzTBu7kakgZM1yK/gWkB3X+FvGH+f1XupyKWo= Received: (qmail 118359 invoked by alias); 29 Mar 2019 13:35:43 -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 118257 invoked by uid 89); 29 Mar 2019 13:35:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS, TVD_SUBJ_WIPE_DEBT autolearn=ham version=3.3.1 spammy=POWER7, duration, 20012019, pointless X-HELO: mail-ua1-f50.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=uG6MUedU6ifpcrxFJiMSLEOPSJnsbLQDK0VUB1Nwn3E=; b=rhKMyfjkqfORydQ/nY8G/XiNzX6edmn5vG485XBIRIQbTgK7x4ucDWJFf02lQS+aUt HR/g8Jb4fQ3yU5z9pInTZONrzEjTLd5edqXP4RC93TuusOOzKdOixgfvRWx47OGIVaEM p74c9WqfLDeYxGlNHRCNqsX89aQasvTuLxqA8vSrNTmy/3w8h0FEqaMq3mx7drY/v3V3 OgLAeQo/iqVUASiniyWtJplKEqLgruHcer1WmeZA9wCrCBPRegwALo7JiKNFDjKDtizC EEhHnhz0afSNMkYUx7Sy4jBbpzDuVVvx2/tz5XYPL5oxLEbi1PFso5Pv49/bxQ32jIc1 HmDA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 03/28] powerpc: Remove power4 mpa optimization Date: Fri, 29 Mar 2019 10:35:04 -0300 Message-Id: <20190329133529.22523-4-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patch removes the POWER4 optimized mpa optimization used for power4+ build. For newer chips, GCC generates *worse* code than generic implementation as benchmaks result below. One possibilty would to add IFUNC variants for the mpa routines (as x86_64), but it will add complexity only for older chips (and one would need to check if power5, power5+, and power6 do benefict from this optimization), and only for specific implementation (since most used ones such as sin, cos, exp, pow already avoid calling the slow multiprecision path). * POWER9 patched "atan": { "": { "duration": 5.12565e+09, "iterations": 1.552e+08, "max": 100.552, "min": 7.799, "mean": 33.0261 }, "144bits": { "duration": 5.12745e+09, "iterations": 825000, "max": 7517.17, "min": 6186.3, "mean": 6215.09 } } "acos": { "": { "duration": 5.21741e+09, "iterations": 1.269e+08, "max": 191.738, "min": 7.931, "mean": 41.1144 }, "slow": { "duration": 5.25999e+09, "iterations": 198000, "max": 26681.7, "min": 26463.6, "mean": 26565.6 } } * POWER9 master "atan": { "": { "duration": 5.12815e+09, "iterations": 1.552e+08, "max": 134.788, "min": 7.803, "mean": 33.0422 }, "144bits": { "duration": 5.1209e+09, "iterations": 447000, "max": 11615.8, "min": 11301.8, "mean": 11456.2 } } "acos": { "": { "duration": 5.22272e+09, "iterations": 1.269e+08, "max": 115.981, "min": 7.931, "mean": 41.1562 }, "slow": { "duration": 5.28723e+09, "iterations": 96000, "max": 55434.1, "min": 54820.6, "mean": 55075.3 } } * POWER8 patched "acos": { "": { "duration": 5.16398e+09, "iterations": 9.99e+07, "max": 174.408, "min": 8.645, "mean": 51.6915 }, "slow": { "duration": 5.16982e+09, "iterations": 96000, "max": 54830.5, "min": 53703.8, "mean": 53852.3 } } * POWER8 master "acos": { "": { "duration": 5.17019e+09, "iterations": 9.99e+07, "max": 186.127, "min": 8.633, "mean": 51.7537 }, "slow": { "duration": 5.34225e+09, "iterations": 90000, "max": 60353.2, "min": 59155.3, "mean": 59358.4 } } * POWER7 patched "asin": { "": { "duration": 5.15559e+09, "iterations": 6.5e+07, "max": 193.335, "min": 12.227, "mean": 79.3168 }, "slow": { "duration": 5.20538e+09, "iterations": 80000, "max": 65705.2, "min": 64299.4, "mean": 65067.3 } } * POWER7 master "asin": { "": { "duration": 5.15446e+09, "iterations": 6.5e+07, "max": 184.575, "min": 12.226, "mean": 79.2994 }, "slow": { "duration": 5.20616e+09, "iterations": 80000, "max": 65705.1, "min": 64336.6, "mean": 65076.9 } } Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/power4/fpu/Makefile: Remove file. * sysdeps/powerpc/power4/fpu/mpa-arch.h: Likewise. * sysdeps/powerpc/power4/fpu/mpa.c: Likewise. --- sysdeps/powerpc/power4/fpu/Makefile | 5 - sysdeps/powerpc/power4/fpu/mpa-arch.h | 56 ------- sysdeps/powerpc/power4/fpu/mpa.c | 214 -------------------------- 3 files changed, 275 deletions(-) delete mode 100644 sysdeps/powerpc/power4/fpu/Makefile delete mode 100644 sysdeps/powerpc/power4/fpu/mpa-arch.h delete mode 100644 sysdeps/powerpc/power4/fpu/mpa.c -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/power4/fpu/Makefile b/sysdeps/powerpc/power4/fpu/Makefile deleted file mode 100644 index f487ed6014..0000000000 --- a/sysdeps/powerpc/power4/fpu/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# Makefile fragment for POWER4/5/5+ with FPU. - -ifeq ($(subdir),math) -CFLAGS-mpa.c += --param max-unroll-times=4 -funroll-loops -fpeel-loops -endif diff --git a/sysdeps/powerpc/power4/fpu/mpa-arch.h b/sysdeps/powerpc/power4/fpu/mpa-arch.h deleted file mode 100644 index 929c60b314..0000000000 --- a/sysdeps/powerpc/power4/fpu/mpa-arch.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Overridable constants and operations. - Copyright (C) 2013-2019 Free Software Foundation, Inc. - - This program 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. - - This program 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 this program; if not, see . */ - -typedef double mantissa_t; -typedef double mantissa_store_t; - -#define TWOPOW(i) (0x1.0p##i) - -#define RADIX TWOPOW (24) /* 2^24 */ -#define CUTTER TWOPOW (76) /* 2^76 */ -#define RADIXI 0x1.0p-24 /* 2^-24 */ -#define TWO52 TWOPOW (52) /* 2^52 */ - -/* Divide D by RADIX and put the remainder in R. */ -#define DIV_RADIX(d,r) \ - ({ \ - double u = ((d) + CUTTER) - CUTTER; \ - if (u > (d)) \ - u -= RADIX; \ - r = (d) - u; \ - (d) = u * RADIXI; \ - }) - -/* Put the integer component of a double X in R and retain the fraction in - X. */ -#define INTEGER_OF(x, r) \ - ({ \ - double u = ((x) + TWO52) - TWO52; \ - if (u > (x)) \ - u -= 1; \ - (r) = u; \ - (x) -= u; \ - }) - -/* Align IN down to a multiple of F, where F is a power of two. */ -#define ALIGN_DOWN_TO(in, f) \ - ({ \ - double factor = f * TWO52; \ - double u = (in + factor) - factor; \ - if (u > in) \ - u -= f; \ - u; \ - }) diff --git a/sysdeps/powerpc/power4/fpu/mpa.c b/sysdeps/powerpc/power4/fpu/mpa.c deleted file mode 100644 index 1be2e93cb7..0000000000 --- a/sysdeps/powerpc/power4/fpu/mpa.c +++ /dev/null @@ -1,214 +0,0 @@ - -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2019 Free Software Foundation, Inc. - * - * This program 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. - * - * This program 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 this program; if not, see . - */ - -/* Define __mul and __sqr and use the rest from generic code. */ -#define NO__MUL -#define NO__SQR - -#include - -/* Multiply *X and *Y and store result in *Z. X and Y may overlap but not X - and Z or Y and Z. For P in [1, 2, 3], the exact result is truncated to P - digits. In case P > 3 the error is bounded by 1.001 ULP. */ -void -__mul (const mp_no *x, const mp_no *y, mp_no *z, int p) -{ - long i, i1, i2, j, k, k2; - long p2 = p; - double u, zk, zk2; - - /* Is z=0? */ - if (__glibc_unlikely (X[0] * Y[0] == 0)) - { - Z[0] = 0; - return; - } - - /* Multiply, add and carry */ - k2 = (p2 < 3) ? p2 + p2 : p2 + 3; - zk = Z[k2] = 0; - for (k = k2; k > 1;) - { - if (k > p2) - { - i1 = k - p2; - i2 = p2 + 1; - } - else - { - i1 = 1; - i2 = k; - } -#if 1 - /* Rearrange this inner loop to allow the fmadd instructions to be - independent and execute in parallel on processors that have - dual symmetrical FP pipelines. */ - if (i1 < (i2 - 1)) - { - /* Make sure we have at least 2 iterations. */ - if (((i2 - i1) & 1L) == 1L) - { - /* Handle the odd iterations case. */ - zk2 = x->d[i2 - 1] * y->d[i1]; - } - else - zk2 = 0.0; - /* Do two multiply/adds per loop iteration, using independent - accumulators; zk and zk2. */ - for (i = i1, j = i2 - 1; i < i2 - 1; i += 2, j -= 2) - { - zk += x->d[i] * y->d[j]; - zk2 += x->d[i + 1] * y->d[j - 1]; - } - zk += zk2; /* Final sum. */ - } - else - { - /* Special case when iterations is 1. */ - zk += x->d[i1] * y->d[i1]; - } -#else - /* The original code. */ - for (i = i1, j = i2 - 1; i < i2; i++, j--) - zk += X[i] * Y[j]; -#endif - - u = (zk + CUTTER) - CUTTER; - if (u > zk) - u -= RADIX; - Z[k] = zk - u; - zk = u * RADIXI; - --k; - } - Z[k] = zk; - - int e = EX + EY; - /* Is there a carry beyond the most significant digit? */ - if (Z[1] == 0) - { - for (i = 1; i <= p2; i++) - Z[i] = Z[i + 1]; - e--; - } - - EZ = e; - Z[0] = X[0] * Y[0]; -} - -/* Square *X and store result in *Y. X and Y may not overlap. For P in - [1, 2, 3], the exact result is truncated to P digits. In case P > 3 the - error is bounded by 1.001 ULP. This is a faster special case of - multiplication. */ -void -__sqr (const mp_no *x, mp_no *y, int p) -{ - long i, j, k, ip; - double u, yk; - - /* Is z=0? */ - if (__glibc_unlikely (X[0] == 0)) - { - Y[0] = 0; - return; - } - - /* We need not iterate through all X's since it's pointless to - multiply zeroes. */ - for (ip = p; ip > 0; ip--) - if (X[ip] != 0) - break; - - k = (__glibc_unlikely (p < 3)) ? p + p : p + 3; - - while (k > 2 * ip + 1) - Y[k--] = 0; - - yk = 0; - - while (k > p) - { - double yk2 = 0.0; - long lim = k / 2; - - if (k % 2 == 0) - { - yk += X[lim] * X[lim]; - lim--; - } - - /* In __mul, this loop (and the one within the next while loop) run - between a range to calculate the mantissa as follows: - - Z[k] = X[k] * Y[n] + X[k+1] * Y[n-1] ... + X[n-1] * Y[k+1] - + X[n] * Y[k] - - For X == Y, we can get away with summing halfway and doubling the - result. For cases where the range size is even, the mid-point needs - to be added separately (above). */ - for (i = k - p, j = p; i <= lim; i++, j--) - yk2 += X[i] * X[j]; - - yk += 2.0 * yk2; - - u = (yk + CUTTER) - CUTTER; - if (u > yk) - u -= RADIX; - Y[k--] = yk - u; - yk = u * RADIXI; - } - - while (k > 1) - { - double yk2 = 0.0; - long lim = k / 2; - - if (k % 2 == 0) - { - yk += X[lim] * X[lim]; - lim--; - } - - /* Likewise for this loop. */ - for (i = 1, j = k - 1; i <= lim; i++, j--) - yk2 += X[i] * X[j]; - - yk += 2.0 * yk2; - - u = (yk + CUTTER) - CUTTER; - if (u > yk) - u -= RADIX; - Y[k--] = yk - u; - yk = u * RADIXI; - } - Y[k] = yk; - - /* Squares are always positive. */ - Y[0] = 1.0; - - int e = EX * 2; - /* Is there a carry beyond the most significant digit? */ - if (__glibc_unlikely (Y[1] == 0)) - { - for (i = 1; i <= p; i++) - Y[i] = Y[i + 1]; - e--; - } - EY = e; -} From patchwork Fri Mar 29 13:35:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161428 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2049968jan; Fri, 29 Mar 2019 06:37:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqy86Y16i5Plltr3Gv1faT4VAV9PBir0JJgbatymsZ6/5Gwo42qiCdYi+iPj8ldNM8q4zqxv X-Received: by 2002:a17:902:ab95:: with SMTP id f21mr49237918plr.188.1553866623841; Fri, 29 Mar 2019 06:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866623; cv=none; d=google.com; s=arc-20160816; b=IOJHt14gSFFco0F3pLvgbG4dXpBdyVZVOufTVTDNyzX2GOP9EnfNhxqqIz3A7yIBn2 pPW25TOjAhBsJYLRKCtLNkey4+rAtDV+0sKpCT/uttH6vpi135y2uyvkrxGS0hziNXW4 jE5tuNB4fR/A4QON1nRfklBxP7Dqh5VF4Hsz/XMAWIFilVDlX4cXPhh5Yyu/BZSC1eOY ZQc3ql7qe1OTXs/ZoxqnRf+85rxqJEiSmPH4cSRuUq2Q7k0v0T0FzpZ2sxCKYqNAL6YT PP5P1qm3t+3zBOlk2iM/cYPNCbZpB+U3pLbe9x4PQnVLekzFWqp8Pw1xd434DDAhfWPX a6ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=C3rDPXaQRXHIhh1L3ozP8UUc311TRaaGSlC6lC3WGoA=; b=SnjVLyfCaG+Ind3qlPFahYArmBbDJ2t5qjckOmYLy/zMqkfqsL8hfcvFohLsG2NJOj /xtZOXaEKsYSXWREQdIi8+pkMyk0b7b+KN8SY/xmOYkkMhGp5uR3zH3FkT0owZBgAoZ5 M9SWakL5u2yiS1tAXP2jmCHxhMXKUUrPGbpEdjYuXyKF9BMcGNy8U0yGlzIXV+pcR8xb Ge6NiyoChwU64nV7YTHUHUguWklOmwze7YYyAj9q5bdgoKGN0ntz4HYUacNZJ4m7qMzJ 6eA46tfpzr79avBQFc0RpaGpOrljmm/MmdXU6knQ/bV4QxPGvJJNxJJOUoGf1Jt74+uJ 1szg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=KQCTFi1t; dkim=pass header.i=@linaro.org header.s=google header.b=gGLSptA7; spf=pass (google.com: domain of libc-alpha-return-100997-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100997-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id x8si1914008pll.207.2019.03.29.06.37.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:37:03 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100997-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=KQCTFi1t; dkim=pass header.i=@linaro.org header.s=google header.b=gGLSptA7; spf=pass (google.com: domain of libc-alpha-return-100997-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100997-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=JodRkXpbXWV3N5Tx79jGDsipJGHKL9w 2sR9Brr7UkCQwdIn+eUYIQ4QOeJinK/NoeyTFNy9eYaxUnri13PYnRJC3bKH5YdI Lte91z9ihih+v4cAMOnAA0XlSFk7GG95xZbWgLFMGbN/I8G9qlyxLdAm/Ixw3G8h pG58nQ/tttpY= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=R8c8gT5hNJWGu+pUy+l+uuzPynk=; b=KQCTF i1tXcITmdRnIwqmzmNkpx8kQT9GPUyRncecnkGyN6T5+KrRCYua1TZ4tU9A6G9cO K77RI44znHogWCAh/ojiBwE7aS15+FdpoS+qNDygmrpYUMF3MCgHHc57TnLbXuc9 trBCHumsLD/wdY5jr9sx9YxJkTC23V90khljM4= Received: (qmail 119218 invoked by alias); 29 Mar 2019 13:35:52 -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 119073 invoked by uid 89); 29 Mar 2019 13:35:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=lc0, a, b, ab, ble X-HELO: mail-ua1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=C3rDPXaQRXHIhh1L3ozP8UUc311TRaaGSlC6lC3WGoA=; b=gGLSptA7PAIwUt9GfaZXTBtSfjYlSRlLTVG+u9M0C5v50JPzsHccVaooorahT7pB82 YzYTn8Nc4r70TpJxyQSbTU334hFowWyZJorGIwms0iLNlCPYn+kUzrzv8GwNK1YyKrnD kbKyo2Kwq0SqE0Ss8BQDWnK5dACswwpkZCBfURVsOWPAuI/wK/wnmJDS2k8rIQafo/tK mQ5NQimk6nQlSv3A9VhNoZxgDBKz1IblsDaYfg5kGB8DG2yZ1sRZ8FcpOcO6QnfT9ODu koydBqyxUjXRpurtxYN5OhTiDPFug+LF441i6Neq/fhPzG5yrkdLVOLvdlm6SmaXNeT8 EUKQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 04/28] powerpc: ceil/ceilf refactor Date: Fri, 29 Mar 2019 10:35:05 -0300 Message-Id: <20190329133529.22523-5-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc ceil{f} implementations on the generic sysdeps/powerpc/fpu/s_ceil{f}. The generic implementation uses either the compiler builts for ISA 2.03+ (which generates the frip instruction) or a generic implementation which uses FP only operations. It adds a generic implementation (round_to_integer.h) which is shared with other rounding to integer routines. The resulting code should be similar performance-wise to previous assembly one. The IFUNC organization for powerpc64 is also change to be enabled only for powerpc64 and not for powerpc64le. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/fenv_libc.h (__fesetround_inline_nocheck): New macro. * sysdeps/powerpc/fpu/round_to_integer.h: New file. * sysdeps/powerpc/fpu/s_ceil.c: Likewise. * sysdeps/powerpc/fpu/s_ceilf.c: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile (CFLAGS-s_ceil-power5+.c, CFLAGS-s_ceilf-power5+.c): New rule. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c: New file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Remove file. * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile: New file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c: ... here. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c: New file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c: ... * here. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_ceil-power5+, s_ceil-ppc64, s_ceilf-power5+, and s_ceilf-ppc64. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise. --- sysdeps/powerpc/fpu/fenv_libc.h | 8 ++ sysdeps/powerpc/fpu/round_to_integer.h | 109 ++++++++++++++++++ sysdeps/powerpc/fpu/s_ceil.c | 35 ++++++ sysdeps/powerpc/fpu/s_ceilf.c | 35 ++++++ sysdeps/powerpc/powerpc32/fpu/s_ceil.S | 76 ------------ sysdeps/powerpc/powerpc32/fpu/s_ceilf.S | 76 ------------ .../powerpc32/power4/fpu/multiarch/Makefile | 2 + .../power4/fpu/multiarch/s_ceil-power5+.S | 33 ------ .../power4/fpu/multiarch/s_ceil-power5+.c | 3 + .../power4/fpu/multiarch/s_ceil-ppc32.S | 31 ----- .../power4/fpu/multiarch/s_ceil-ppc32.c | 3 + .../power4/fpu/multiarch/s_ceilf-power5+.S | 26 ----- .../power4/fpu/multiarch/s_ceilf-power5+.c | 3 + .../power4/fpu/multiarch/s_ceilf-ppc32.S | 27 ----- .../power4/fpu/multiarch/s_ceilf-ppc32.c | 3 + .../powerpc/powerpc32/power5+/fpu/s_ceil.S | 29 ----- .../powerpc/powerpc32/power5+/fpu/s_ceilf.S | 30 ----- .../powerpc64/be/fpu/multiarch/Makefile | 9 ++ .../be/fpu/multiarch/s_ceil-power5+.c | 3 + .../powerpc64/be/fpu/multiarch/s_ceil-ppc64.c | 3 + .../powerpc64/{ => be}/fpu/multiarch/s_ceil.c | 4 +- .../be/fpu/multiarch/s_ceilf-power5+.c | 3 + .../be/fpu/multiarch/s_ceilf-ppc64.c | 3 + .../{ => be}/fpu/multiarch/s_ceilf.c | 4 +- .../powerpc/powerpc64/fpu/multiarch/Makefile | 3 +- .../powerpc64/fpu/multiarch/s_ceil-power5+.S | 30 ----- .../powerpc64/fpu/multiarch/s_ceil-ppc64.S | 30 ----- .../powerpc64/fpu/multiarch/s_ceilf-power5+.S | 24 ---- .../powerpc64/fpu/multiarch/s_ceilf-ppc64.S | 24 ---- sysdeps/powerpc/powerpc64/fpu/s_ceil.S | 65 ----------- sysdeps/powerpc/powerpc64/fpu/s_ceilf.S | 67 ----------- .../powerpc/powerpc64/power5+/fpu/s_ceil.S | 30 ----- .../powerpc/powerpc64/power5+/fpu/s_ceilf.S | 31 ----- 33 files changed, 225 insertions(+), 637 deletions(-) create mode 100644 sysdeps/powerpc/fpu/round_to_integer.h create mode 100644 sysdeps/powerpc/fpu/s_ceil.c create mode 100644 sysdeps/powerpc/fpu/s_ceilf.c delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_ceil.S delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_ceilf.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_ceil.c (95%) create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_ceilf.c (95%) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_ceil.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_ceilf.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h index 67a9c9a51a..01dccb15a8 100644 --- a/sysdeps/powerpc/fpu/fenv_libc.h +++ b/sysdeps/powerpc/fpu/fenv_libc.h @@ -98,6 +98,14 @@ __fesetround_inline (int round) return 0; } +/* Same as __fesetround_inline, however without runtime check to use DFP + mtfsfi syntax or if round is valid. */ +static inline void +__fesetround_inline_nocheck (const int round) +{ + asm volatile ("mtfsfi 7,%0" : : "i" (round)); +} + /* Definitions of all the FPSCR bit numbers */ enum { FPSCR_FX = 0, /* exception summary */ diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h new file mode 100644 index 0000000000..417aae6242 --- /dev/null +++ b/sysdeps/powerpc/fpu/round_to_integer.h @@ -0,0 +1,109 @@ +/* Round to integer generic implementation. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#ifndef _ROUND_TO_INTEGER_H +#define _ROUND_TO_INTEGER_H + +#include + +enum round_mode +{ + CEIL, + FLOOR, + ROUND, + TRUNC, + NEARBYINT, +}; + +static inline void +set_fenv_mode (enum round_mode mode) +{ + int rmode; + switch (mode) + { + case CEIL: rmode = FE_UPWARD; break; + default: rmode = FE_TONEAREST; break; + } + __fesetround_inline_nocheck (rmode); +} + +static inline float +round_to_integer_float (enum round_mode mode, float x) +{ + /* Ensure sNaN input is converted to qNaN. */ + if (__glibc_unlikely (isnan (x))) + return x + x; + + if (fabs (x) > 0x1p+23) + return x; + + float r = x; + + /* Save current FPU rounding mode and inexact state. */ + fenv_t fe = fegetenv_register (); + set_fenv_mode (mode); + if (x > 0.0) + { + r += 0x1p+23; + r -= 0x1p+23; + r = fabs (r); + } + else if (x < 0.0) + { + r -= 0x1p+23; + r += 0x1p+23; + r = -fabs (r); + } + __builtin_mtfsf (0xff, fe); + + return r; +} + +static inline double +round_to_integer_double (enum round_mode mode, double x) +{ + /* Ensure sNaN input is converted to qNaN. */ + if (__glibc_unlikely (isnan (x))) + return x + x; + + if (fabs (x) > 0x1p+52) + return x; + + double r = x; + + /* Save current FPU rounding mode and inexact state. */ + fenv_t fe = fegetenv_register (); + set_fenv_mode (mode); + if (x > 0.0) + { + r += 0x1p+52; + r -= 0x1p+52; + r = fabs (r); + } + else if (x < 0.0) + { + r -= 0x1p+52; + r += 0x1p+52; + r = -fabs (r); + } + __builtin_mtfsf (0xff, fe); + + return r; +} + +#endif diff --git a/sysdeps/powerpc/fpu/s_ceil.c b/sysdeps/powerpc/fpu/s_ceil.c new file mode 100644 index 0000000000..49008c7af8 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_ceil.c @@ -0,0 +1,35 @@ +/* Smallest integral value not less than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +double +__ceil (double x) +{ +#ifdef _ARCH_PWR5X + return __builtin_ceil (x); +#else + return round_to_integer_double (CEIL, x); +#endif +} +#ifndef __ceil +libm_alias_double (__ceil, ceil) +#endif diff --git a/sysdeps/powerpc/fpu/s_ceilf.c b/sysdeps/powerpc/fpu/s_ceilf.c new file mode 100644 index 0000000000..8c86bf30a3 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_ceilf.c @@ -0,0 +1,35 @@ +/* Smallest integral value not less than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +float +__ceilf (float x) +{ +#ifdef _ARCH_PWR5X + return __builtin_ceilf (x); +#else + return round_to_integer_float (CEIL, x); +#endif +} +#ifndef __ceilf +libm_alias_float (__ceil, ceil) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S deleted file mode 100644 index 4d0fdad2c1..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S +++ /dev/null @@ -1,76 +0,0 @@ -/* ceil function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 - - .section ".text" -ENTRY (__ceil) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,2 /* Set rounding mode toward +inf. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__ceil) - -libm_alias_double (__ceil, ceil) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S deleted file mode 100644 index c32044afa6..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S +++ /dev/null @@ -1,76 +0,0 @@ -/* float ceil function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**23 */ - .long 0x4b000000 - - .section ".text" -ENTRY (__ceilf) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,2 /* Set rounding mode toward +inf. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__ceilf) - -libm_alias_float (__ceil, ceil) - diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile index 4e85021d50..cf38e347f2 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile @@ -26,6 +26,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \ s_logbf-power7 s_logbf-ppc32 e_hypot-power7 \ e_hypot-ppc32 e_hypotf-power7 e_hypotf-ppc32 +CFLAGS-s_ceil-power5+.c = -mcpu=power5+ +CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ CFLAGS-s_modf-power5+.c = -mcpu=power5+ CFLAGS-s_modff-power5+.c = -mcpu=power5+ CFLAGS-s_logbl-power7.c = -mcpu=power7 diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S deleted file mode 100644 index b13a56667e..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S +++ /dev/null @@ -1,33 +0,0 @@ -/* ceil function. PowerPC32/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __ceil __ceil_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c new file mode 100644 index 0000000000..87bc66cdb0 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c @@ -0,0 +1,3 @@ +#include +#define __ceil __ceil_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S deleted file mode 100644 index 899dc140c6..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S +++ /dev/null @@ -1,31 +0,0 @@ -/* ceil function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __ceil __ceil_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c new file mode 100644 index 0000000000..93c098476b --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c @@ -0,0 +1,3 @@ +#include +#define __ceil __ceil_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S deleted file mode 100644 index 6279638031..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S +++ /dev/null @@ -1,26 +0,0 @@ -/* ceilf function. PowerPC32/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(name, alias) - -#define __ceilf __ceilf_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c new file mode 100644 index 0000000000..a5bfa98535 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c @@ -0,0 +1,3 @@ +#include +#define __ceilf __ceilf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S deleted file mode 100644 index a84edf7a5b..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S +++ /dev/null @@ -1,27 +0,0 @@ -/* ceilf function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) - -#define __ceilf __ceilf_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c new file mode 100644 index 0000000000..a4dcdcb406 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c @@ -0,0 +1,3 @@ +#include +#define __ceilf __ceilf_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S deleted file mode 100644 index 7dab4023f7..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S +++ /dev/null @@ -1,29 +0,0 @@ -/* ceil function. PowerPC32/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include - - .machine "power5" -EALIGN (__ceil, 4, 0) - frip fp1, fp1 - blr - END (__ceil) - -libm_alias_double (__ceil, ceil) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S deleted file mode 100644 index 15a6f27d28..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S +++ /dev/null @@ -1,30 +0,0 @@ -/* ceilf function. PowerPC32/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include - - .machine "power5" -EALIGN (__ceilf, 4, 0) - frip fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__ceilf) - -libm_alias_float (__ceil, ceil) - diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile new file mode 100644 index 0000000000..932c3c7e6c --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -0,0 +1,9 @@ +ifeq ($(subdir),math) +libm-sysdep_routines += s_ceil-power5+ \ + s_ceil-ppc64 \ + s_ceilf-power5+ \ + s_ceilf-ppc64 + +CFLAGS-s_ceil-power5+.c = -mcpu=power5+ +CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ +endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c new file mode 100644 index 0000000000..87bc66cdb0 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c @@ -0,0 +1,3 @@ +#include +#define __ceil __ceil_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c new file mode 100644 index 0000000000..8711ff3229 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c @@ -0,0 +1,3 @@ +#include +#define __ceil __ceil_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c similarity index 95% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c index b72f4b1cc0..36976a0404 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c @@ -18,10 +18,8 @@ #define NO_MATH_REDIRECT #include -#include -#include -#include "init-arch.h" #include +#include "init-arch.h" extern __typeof (__ceil) __ceil_ppc64 attribute_hidden; extern __typeof (__ceil) __ceil_power5plus attribute_hidden; diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c new file mode 100644 index 0000000000..a5bfa98535 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c @@ -0,0 +1,3 @@ +#include +#define __ceilf __ceilf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c new file mode 100644 index 0000000000..086251dc09 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c @@ -0,0 +1,3 @@ +#include +#define __ceilf __ceilf_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c similarity index 95% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c index 707f07c0bb..34811330d5 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c @@ -18,10 +18,8 @@ #define NO_MATH_REDIRECT #include -#include -#include -#include "init-arch.h" #include +#include "init-arch.h" extern __typeof (__ceilf) __ceilf_ppc64 attribute_hidden; extern __typeof (__ceilf) __ceilf_power5plus attribute_hidden; diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 39b557604c..ac6d162f91 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -14,8 +14,7 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \ sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_llround-power6x \ - s_llround-power5+ s_llround-ppc64 s_ceil-power5+ \ - s_ceil-ppc64 s_ceilf-power5+ s_ceilf-ppc64 \ + s_llround-power5+ s_llround-ppc64 \ s_floor-power5+ s_floor-ppc64 s_floorf-power5+ \ s_floorf-ppc64 s_round-power5+ s_round-ppc64 \ s_roundf-power5+ s_roundf-ppc64 s_trunc-power5+ \ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S deleted file mode 100644 index 8782e6378e..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S +++ /dev/null @@ -1,30 +0,0 @@ -/* ceil function. PowerPC64/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __ceil __ceil_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S deleted file mode 100644 index 5d9b30d50d..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S +++ /dev/null @@ -1,30 +0,0 @@ -/* ceil function. PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __ceil __ceil_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S deleted file mode 100644 index 6c9d18880e..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S +++ /dev/null @@ -1,24 +0,0 @@ -/* ceilf function. PowerPC64/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#undef weak_alias -#define weak_alias(a,b) - -#define __ceilf __ceilf_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S deleted file mode 100644 index 2aaa8c4e4a..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S +++ /dev/null @@ -1,24 +0,0 @@ -/* ceilf function. PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#undef weak_alias -#define weak_alias(a,b) - -#define __ceilf __ceilf_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S deleted file mode 100644 index 3e0a968abe..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S +++ /dev/null @@ -1,65 +0,0 @@ -/* ceil function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section ".toc","aw" -.LC0: /* 2**52 */ - .tc FD_43300000_0[TC],0x4330000000000000 - .section ".text" - -ENTRY (__ceil, 4) - CALL_MCOUNT 0 - lfd fp13,.LC0@toc(2) - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,2 /* Set rounding mode toward +inf. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__ceil) - -libm_alias_double (__ceil, ceil) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S deleted file mode 100644 index a189f9fd58..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S +++ /dev/null @@ -1,67 +0,0 @@ -/* float ceil function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section ".toc","aw" - .p2align 3 -.LC0: /* 2**23 */ - .long 0x4b000000 - .long 0x0 - .section ".text" - -ENTRY (__ceilf, 4) - CALL_MCOUNT 0 - lfs fp13,.LC0@toc(2) - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,2 /* Set rounding mode toward +inf. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__ceilf) - -libm_alias_float (__ceil, ceil) - diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S deleted file mode 100644 index 8feb687697..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S +++ /dev/null @@ -1,30 +0,0 @@ -/* ceil function. PowerPC64/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include - - .machine "power5" -ENTRY_TOCLESS (__ceil, 4) - CALL_MCOUNT 0 - frip fp1, fp1 - blr - END (__ceil) - -libm_alias_double (__ceil, ceil) diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S deleted file mode 100644 index 11d13abd11..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S +++ /dev/null @@ -1,31 +0,0 @@ -/* ceilf function. PowerPC64/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include - - .machine "power5" -ENTRY_TOCLESS (__ceilf, 4) - CALL_MCOUNT 0 - frip fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__ceilf) - -libm_alias_float (__ceil, ceil) - From patchwork Fri Mar 29 13:35:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161429 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2050228jan; Fri, 29 Mar 2019 06:37:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyeHOSv0F5CFzoLZqOmz8b1qh2VzupjVvP6Io7VZ0cW4aWSDjunPvYKwV5pLKNIeOD3o4J9 X-Received: by 2002:a63:4b0a:: with SMTP id y10mr45595319pga.66.1553866637238; Fri, 29 Mar 2019 06:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866637; cv=none; d=google.com; s=arc-20160816; b=JUY81rb5Xb1ISfWCCCMVG9zg+sSFPz3O5UfGAljX+A1+qUTPYJeONfNRen4ZKNxtDS B4+LOxlxtM/o9GKKj8IP6RNpXGPCVxknBAhAE151w0Rw20VFMvz5OiivyeJ880PLF4jZ ZkgbrHiDFOl6JI6NsKmA/5mVbtEiiTuZeGrgm4/AX+CF8wP2uFn7gqXLaQ3W4s9Xyahe 18FSh+0nEwyymJLH3blmOOFnM+w6ejZyeWkbgDorS4n0O3px5Un9csE+n0oQlbuy35nO 0vD7QgG29J+3Wi078RCa1AbiGL0ZT6VLalm0vpm5lhN/VGNLIKS2V+cAPhih9lYxdPMK yLOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=8AxYHo5LUls+gqkSS2X7giSl1FBSIPCvTj/OWnbaTww=; b=pRbMY+elyVNWBER+tys1061bqhOOEhZGNI/mdWQkXrLKnNBp+SPMhIAPla873BHvQr 84eU3qQ43WZeOey4gelB6FOMg4Np+JuvNmUMvKSNHVhoflviQAjuGiNOQqcLjhfndwAN Eo44rdnKp1ztHFx7mZ+VtCzJ2Cxky5+OqwgOKH9q4VOP2V7G+wehD/woWxKgjkWXDF+4 /eVinxDTSL0AOUExVguH1PlX6uJKo0M8ezk5CIFCMHIU+sGpdJoNd32/5TgeVuJArgHG xq+tUj1Q6sLTBLz9KcTzBob0wbALH7ISEXnexuXhotGSmteVIv4/FAJRy/FeLEV9l85+ 6zyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=rk7hdGlm; dkim=pass header.i=@linaro.org header.s=google header.b=OtejXxCl; spf=pass (google.com: domain of libc-alpha-return-100998-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100998-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v79si1872911pgb.56.2019.03.29.06.37.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:37:17 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100998-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=rk7hdGlm; dkim=pass header.i=@linaro.org header.s=google header.b=OtejXxCl; spf=pass (google.com: domain of libc-alpha-return-100998-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100998-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Gtha8sZSqXnqm4iUJVQ7TV+07clLD+A V3lwceckL30rptbdRmRYrJZZMc5e4qggHt8U8HtFkirHhW+uxjjlD0HoFaj7cbZP rRy1xs8mycrUevwlyyWRMJJx0Wvo7SA0N2zonpSivfm3eaWwOIxQ8yskEog3zp8s HhTok8wRmVB8= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=I4WZvByjj1ogKDbNHjrGfXsbUgU=; b=rk7hd GlmDU23CcCdrgMtc4eIMj/fQllkHez+GhELPziBXiKBNIs9YPkkSkwR3DgCm9arm WzhgflRvT0NZwABZBdikh6tXygsCdbZZ2YA5FbYlMr9gXq1Siz8WeTK93jiaJf/u X8AX2fh0Ny+Mygy49/OAu+sQpinJNiWal8Msss= Received: (qmail 119256 invoked by alias); 29 Mar 2019 13:35:52 -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 119121 invoked by uid 89); 29 Mar 2019 13:35:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=73, lc0, a, b, ab X-HELO: mail-vs1-f68.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=8AxYHo5LUls+gqkSS2X7giSl1FBSIPCvTj/OWnbaTww=; b=OtejXxCl4jLEVzdcqHiMlvnS+2bxzQ6XzQI/YdzHKzf4l0pwyeG1hQ8o8YJDzvTrqa 7bet0T0Oc0CaHoxERa6ZVNVHbO4jeqI7/bSK9iG7sjOOfYEUMQNOHN+j9ZOOg9Pugyeb ifgsdJHNIQYOO7hJu18swRlW7pbxH5X3YTuHht1TAO2OGZR/saBH6zydfq3SAPiFPCQN iVwq0DQiBmEZkWutuzHvQ9ppKFyBlOuwROtvlemaHrca/KiMYTi/tkBWA3hRip9S+iKE zOZU7DZ7UrCX3eUqvsV6l+6dmPCeglozInRySTOvX0tM/c5mNqZNJxCsz3dNJ1L269us KUpQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 05/28] powerpc: floor/floorf refactor Date: Fri, 29 Mar 2019 10:35:06 -0300 Message-Id: <20190329133529.22523-6-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc floor{f} implementations on the generic sysdeps/powerpc/fpu/s_floor{f}. The generic implementation uses either the compiler builts for ISA 2.03+ (which generates the frim instruction) or a generic implementation which uses FP only operations. The IFUNC organization for powerpc64 is also change to be enabled only for powerpc64 and not for powerpc64le. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/round_to_integer.h (set_rounding_mode): Add FLOOR option. * sysdeps/powerpc/fpu/s_floor.c: New file. * sysdeps/powerpc/fpu/s_floorf.c: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_floor.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_floorf.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S: Likewise * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c: New file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S: Remove file. * sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S: Remove file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_floor-power5+, s_floor-ppc64, s_floorf-power5+, and s_floorf-ppc64. (CFLAGS-s_floor-power5+.c, CFLAGS-s_floorf-power5+.c): New rule. * sysdep/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c: New file. * sysdep/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor.c: ... here. * sysdep/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c: New file. * sysdep/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_floor-power5+, s_floor-ppc64, s_floorf-power5+, and s_floorf-ppc64. * sysdep/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise. --- sysdeps/powerpc/fpu/round_to_integer.h | 1 + sysdeps/powerpc/fpu/s_floor.c | 35 +++++++++ sysdeps/powerpc/fpu/s_floorf.c | 35 +++++++++ sysdeps/powerpc/powerpc32/fpu/s_floor.S | 76 ------------------- sysdeps/powerpc/powerpc32/fpu/s_floorf.S | 76 ------------------- .../power4/fpu/multiarch/s_floor-power5+.S | 33 -------- .../power4/fpu/multiarch/s_floor-power5+.c | 3 + .../power4/fpu/multiarch/s_floor-ppc32.S | 31 -------- .../power4/fpu/multiarch/s_floor-ppc32.c | 3 + .../power4/fpu/multiarch/s_floorf-power5+.S | 26 ------- .../power4/fpu/multiarch/s_floorf-power5+.c | 3 + .../power4/fpu/multiarch/s_floorf-ppc32.S | 27 ------- .../power4/fpu/multiarch/s_floorf-ppc32.c | 3 + .../powerpc/powerpc32/power5+/fpu/s_floor.S | 29 ------- .../powerpc/powerpc32/power5+/fpu/s_floorf.S | 30 -------- .../powerpc64/be/fpu/multiarch/Makefile | 8 +- .../be/fpu/multiarch/s_floor-power5+.c | 3 + .../be/fpu/multiarch/s_floor-ppc64.c | 3 + .../{ => be}/fpu/multiarch/s_floor.c | 0 .../be/fpu/multiarch/s_floorf-power5+.c | 3 + .../be/fpu/multiarch/s_floorf-ppc64.c | 3 + .../{ => be}/fpu/multiarch/s_floorf.c | 0 .../powerpc/powerpc64/fpu/multiarch/Makefile | 3 +- .../powerpc64/fpu/multiarch/s_floor-power5+.S | 30 -------- .../powerpc64/fpu/multiarch/s_floor-ppc64.S | 30 -------- .../fpu/multiarch/s_floorf-power5+.S | 24 ------ .../powerpc64/fpu/multiarch/s_floorf-ppc64.S | 24 ------ sysdeps/powerpc/powerpc64/fpu/s_floor.S | 65 ---------------- sysdeps/powerpc/powerpc64/fpu/s_floorf.S | 67 ---------------- .../powerpc/powerpc64/power5+/fpu/s_floor.S | 30 -------- .../powerpc/powerpc64/power5+/fpu/s_floorf.S | 31 -------- 31 files changed, 103 insertions(+), 632 deletions(-) create mode 100644 sysdeps/powerpc/fpu/s_floor.c create mode 100644 sysdeps/powerpc/fpu/s_floorf.c delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_floor.S delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_floorf.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_floor.c (100%) create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_floorf.c (100%) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_floor.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_floorf.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h index 417aae6242..77d9fc1f86 100644 --- a/sysdeps/powerpc/fpu/round_to_integer.h +++ b/sysdeps/powerpc/fpu/round_to_integer.h @@ -37,6 +37,7 @@ set_fenv_mode (enum round_mode mode) switch (mode) { case CEIL: rmode = FE_UPWARD; break; + case FLOOR: rmode = FE_DOWNWARD; break; default: rmode = FE_TONEAREST; break; } __fesetround_inline_nocheck (rmode); diff --git a/sysdeps/powerpc/fpu/s_floor.c b/sysdeps/powerpc/fpu/s_floor.c new file mode 100644 index 0000000000..fb8df97cca --- /dev/null +++ b/sysdeps/powerpc/fpu/s_floor.c @@ -0,0 +1,35 @@ +/* Largest integral value not greater than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +double +__floor (double x) +{ +#ifdef _ARCH_PWR5X + return __builtin_floor (x); +#else + return round_to_integer_double (FLOOR, x); +#endif +} +#ifndef __floor +libm_alias_double (__floor, floor) +#endif diff --git a/sysdeps/powerpc/fpu/s_floorf.c b/sysdeps/powerpc/fpu/s_floorf.c new file mode 100644 index 0000000000..ea4723bb69 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_floorf.c @@ -0,0 +1,35 @@ +/* Smallest integral value not less than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +float +__floorf (float x) +{ +#ifdef _ARCH_PWR5X + return __builtin_floorf (x); +#else + return round_to_integer_float (FLOOR, x); +#endif +} +#ifndef __floorf +libm_alias_float (__floor, floor) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/s_floor.S deleted file mode 100644 index 3b6492e242..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_floor.S +++ /dev/null @@ -1,76 +0,0 @@ -/* Floor function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 - - .section ".text" -ENTRY (__floor) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,3 /* Set rounding mode toward -inf. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__floor) - -libm_alias_double (__floor, floor) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S deleted file mode 100644 index 907271e031..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S +++ /dev/null @@ -1,76 +0,0 @@ -/* float Floor function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**23 */ - .long 0x4b000000 - - .section ".text" -ENTRY (__floorf) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,3 /* Set rounding mode toward -inf. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__floorf) - -libm_alias_float (__floor, floor) - diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S deleted file mode 100644 index 03babf644c..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S +++ /dev/null @@ -1,33 +0,0 @@ -/* floor function. PowerPC32/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __floor __floor_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c new file mode 100644 index 0000000000..d3c2f52e57 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c @@ -0,0 +1,3 @@ +#include +#define __floor __floor_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S deleted file mode 100644 index 296646109b..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S +++ /dev/null @@ -1,31 +0,0 @@ -/* floor function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __floor __floor_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c new file mode 100644 index 0000000000..9decd0faf8 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c @@ -0,0 +1,3 @@ +#include +#define __floor __floor_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S deleted file mode 100644 index 47a1a18d16..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S +++ /dev/null @@ -1,26 +0,0 @@ -/* floorf function. PowerPC32/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(name, alias) - -#define __floorf __floorf_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c new file mode 100644 index 0000000000..ecc409580b --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c @@ -0,0 +1,3 @@ +#include +#define __floorf __floorf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S deleted file mode 100644 index bce86ab0d3..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S +++ /dev/null @@ -1,27 +0,0 @@ -/* floorf function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) - -#define __floorf __floorf_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c new file mode 100644 index 0000000000..ba1d8f4d55 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c @@ -0,0 +1,3 @@ +#include +#define __floorf __floorf_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S deleted file mode 100644 index 55d88e601a..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S +++ /dev/null @@ -1,29 +0,0 @@ -/* floor function. PowerPC32/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include - - .machine "power5" -EALIGN (__floor, 4, 0) - frim fp1, fp1 - blr - END (__floor) - -libm_alias_double (__floor, floor) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S deleted file mode 100644 index e45c358cdd..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S +++ /dev/null @@ -1,30 +0,0 @@ -/* floorf function. PowerPC32/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include - - .machine "power5" -EALIGN (__floorf, 4, 0) - frim fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__floorf) - -libm_alias_float (__floor, floor) - diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index 932c3c7e6c..8bb06e5cc0 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -2,8 +2,14 @@ ifeq ($(subdir),math) libm-sysdep_routines += s_ceil-power5+ \ s_ceil-ppc64 \ s_ceilf-power5+ \ - s_ceilf-ppc64 + s_ceilf-ppc64 \ + s_floor-power5+ \ + s_floor-ppc64 \ + s_floorf-power5+ \ + s_floorf-ppc64 CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ +CFLAGS-s_floor-power5+.c = -mcpu=power5+ +CFLAGS-s_floorf-power5+.c = -mcpu=power5+ endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c new file mode 100644 index 0000000000..d3c2f52e57 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c @@ -0,0 +1,3 @@ +#include +#define __floor __floor_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c new file mode 100644 index 0000000000..92c072c886 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c @@ -0,0 +1,3 @@ +#include +#define __floor __floor_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor.c diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c new file mode 100644 index 0000000000..ecc409580b --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c @@ -0,0 +1,3 @@ +#include +#define __floorf __floorf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c new file mode 100644 index 0000000000..ad657ecfc4 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c @@ -0,0 +1,3 @@ +#include +#define __floorf __floorf_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index ac6d162f91..8a73108e4c 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -15,8 +15,7 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \ sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_llround-power6x \ s_llround-power5+ s_llround-ppc64 \ - s_floor-power5+ s_floor-ppc64 s_floorf-power5+ \ - s_floorf-ppc64 s_round-power5+ s_round-ppc64 \ + s_round-power5+ s_round-ppc64 \ s_roundf-power5+ s_roundf-ppc64 s_trunc-power5+ \ s_trunc-ppc64 s_truncf-power5+ s_truncf-ppc64 \ s_llrint-power6x s_llrint-ppc64 \ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S deleted file mode 100644 index f4917d5f57..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S +++ /dev/null @@ -1,30 +0,0 @@ -/* floor function. PowerPC64/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __floor __floor_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S deleted file mode 100644 index 982d4a1b7f..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S +++ /dev/null @@ -1,30 +0,0 @@ -/* floor function. PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __floor __floor_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S deleted file mode 100644 index 01a15e4e55..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S +++ /dev/null @@ -1,24 +0,0 @@ -/* floorf function. PowerPC64/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#undef weak_alias -#define weak_alias(a,b) - -#define __floorf __floorf_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S deleted file mode 100644 index 2b31a96c86..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S +++ /dev/null @@ -1,24 +0,0 @@ -/* floorf function. PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#undef weak_alias -#define weak_alias(a,b) - -#define __floorf __floorf_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/fpu/s_floor.S deleted file mode 100644 index 78cacd88ca..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_floor.S +++ /dev/null @@ -1,65 +0,0 @@ -/* Floor function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section ".toc","aw" -.LC0: /* 2**52 */ - .tc FD_43300000_0[TC],0x4330000000000000 - .section ".text" - -ENTRY (__floor, 4) - CALL_MCOUNT 0 - lfd fp13,.LC0@toc(2) - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,3 /* Set rounding mode toward -inf. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__floor) - -libm_alias_double (__floor, floor) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S b/sysdeps/powerpc/powerpc64/fpu/s_floorf.S deleted file mode 100644 index ba2ba3b293..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S +++ /dev/null @@ -1,67 +0,0 @@ -/* float Floor function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section ".toc","aw" - .p2align 3 -.LC0: /* 2**23 */ - .long 0x4b000000 - .long 0x0 - .section ".text" - -ENTRY (__floorf, 4) - CALL_MCOUNT 0 - lfs fp13,.LC0@toc(2) - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,3 /* Set rounding mode toward -inf. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__floorf) - -libm_alias_float (__floor, floor) - diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S deleted file mode 100644 index 6ddaf21862..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S +++ /dev/null @@ -1,30 +0,0 @@ -/* floor function. PowerPC64/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include - - .machine "power5" -ENTRY_TOCLESS (__floor, 4) - CALL_MCOUNT 0 - frim fp1, fp1 - blr - END (__floor) - -libm_alias_double (__floor, floor) diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S deleted file mode 100644 index b43f7a27e6..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S +++ /dev/null @@ -1,31 +0,0 @@ -/* floorf function. PowerPC64/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include - - .machine "power5" -ENTRY_TOCLESS (__floorf, 4) - CALL_MCOUNT 0 - frim fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__floorf) - -libm_alias_float (__floor, floor) - From patchwork Fri Mar 29 13:35:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161432 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2050982jan; Fri, 29 Mar 2019 06:37:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzc7Dh+Iv7RjSxDuJ5uFAkY/1YxWPVfHJxdvZXPkkItGX2h8xoFQBZvJwTuO09Mlb3GW7Sv X-Received: by 2002:a63:ef07:: with SMTP id u7mr23153210pgh.0.1553866677577; Fri, 29 Mar 2019 06:37:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866677; cv=none; d=google.com; s=arc-20160816; b=GqgtYod9cSZTIyfmJFBtSt8sSclCaH8s3CVp0eacdAZa8eJ1qhrYQ9so+FZMIhW02c Svbn1MPni0CRBIka7lfOmD/KmXy2FN3fsgXNBC8Q6FD+zOPQzBKVq8qjxzArsgI/fud5 7cbIP9jnKk0C7vUSbfqKIXbfGHEkvlY2IS9O79ugn2TAaiCSt53GqZw46vbMCZFUZ46w 6QpLG1vHYSBf5U2Fow4SaeVjTJM38/AAx2PxenAYprUH1y0GfAmkG+42VVvZq2ClWh25 LbndzWd6qwqIzH247UBS1cklIhV75A9aZ6GyQw02i2lh0te8u0Nul9+ga9xcGOeartev Dtmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=DWDej6seHh/v1iAxbqOy8/sxbX16lnbFOYkBs0vzzaY=; b=TpIerUwczsu70QcVF4FMoL1rq7njSJtKdjqrmISoswVHNtLUWQUvuWwV8OBX7qrpID IF91ADFiSI39s7REJom5Lgedmevx6RQmiZlaPbrv7A3Hz/AQec2b/NNMgvFYmkBgGMJe f/+t5lU0W6xDIQfIczGKsMDPysr9v1BKMB0J4xXRV0/zHocSeE0bhQUNuDOCes03sqG5 3bb3kfa2zDPjBcdBkW6Xhd8c4ysN3WYncbykuhlcfU+2IsiHuwaH7LQBk1vAMHKHNmNp t1Y05aph1Pd2fqYgri9y/uf8VD9wTwFSwu7VWECA8YjWubXg8ilig4ewNZOQF0zTPJOW GwNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=QcNkhKrt; dkim=pass header.i=@linaro.org header.s=google header.b="VjCR/geW"; spf=pass (google.com: domain of libc-alpha-return-101001-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101001-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id r59si2009645plb.257.2019.03.29.06.37.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:37:57 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101001-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=QcNkhKrt; dkim=pass header.i=@linaro.org header.s=google header.b="VjCR/geW"; spf=pass (google.com: domain of libc-alpha-return-101001-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101001-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Dr55aSY2u9Ub2EWsKH4T+P8JyrGbxJZ M1gQ4xPYM23nHKe1AJz3JFlursNt1HH/xP7X0XJZenGeDwn+Ot6Vl3r+QKEYFxLH VXIDTDXGoGE1vYK8iZd1wcX9S/HOIQ+TrnpDzV0iCBLSrKcK9DNRGJkn0qQZd95v Hht8MKw85A6E= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=belEw2usYgDp47AH12yqqTGyYfc=; b=QcNkh KrtoUPSZIcP/CwaXEJWruG9wnsFY2kE3ZwOso1l47nWlW6NsBlawGevfTJw80Arc rAOdnjNX7faLjdT0Guv6ne4oshOqv/h3LXl23hZBw9p8YJ3ImWXr6Pi/P0uChD0Y GGJOUDDnIct1AkDU3lQktcPy2ytxvky2pJ+DtM= Received: (qmail 119830 invoked by alias); 29 Mar 2019 13:35:58 -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 119537 invoked by uid 89); 29 Mar 2019 13:35:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Nearest, lc0, a, b, ab X-HELO: mail-ua1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=DWDej6seHh/v1iAxbqOy8/sxbX16lnbFOYkBs0vzzaY=; b=VjCR/geWZcHW5l5OaFcwdAh4Qw3jYdlBu2WUgUxPkTrM4KuJb+t5299qcHYv6s3LgM b1Bm2oPqbO7DiY3iamGvb6Uwp4e1bnjXJV1OLZA15GiuohvbAyAqkqE2Ekm7pKWmE57/ p2rhhlkGlNhqCzq1abqQG0tJ6+6/VmSkOD3jcFXKYOOYbTFRbFpWGVh9PfbOCgeOyUBe ZjaYaAtPb3JII90BNDU9b4Rksda671jiJ3Li9ShQsleB5GgDtdarO/WTWCyXPXHGFZIf +a3VDGBOh/aIA9vPImIvgwB+Bknirss5q+YMwmxT4T3ywFkiEH5kzclNbebi555z2vxa tiag== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 06/28] powerpc: round/roundf refactor Date: Fri, 29 Mar 2019 10:35:07 -0300 Message-Id: <20190329133529.22523-7-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc round{f} implementations on the generic sysdeps/powerpc/fpu/s_round{f}. The generic implementation uses either the compiler builts for ISA 2.03+ (which generates the frim instruction) or a generic implementation which uses FP only operations. The IFUNC organization for powerpc64 is also change to be enabled only for powerpc64 and not for powerpc64le. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/round_to_integer.h (set_rounding_mode): Add ROUND handling. (round_to_integer_float): Likewise. * sysdeps/powerpc/fpu/s_round.c: New file. * sysdeps/powerpc/fpu/s_roundf.c: New file. * sysdeps/powerpc/powerpc32/fpu/s_round.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-power5+.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-ppc32.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-power5+.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-ppc32.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-power5+.c: New file. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-ppc32.c: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-power5+.c: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-ppc32.c: Likewise. * sysdep/powerpc/powerpc32/power5+/fpu/s_round.S: Remove file. * sysdep/powerpc/powerpc32/power5+/fpu/s_roundf.S: Likewise. * sysdep/powerpc/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_round-power5+, s_round-ppc64, s_roundf-power5+, and s_roundf-ppc64. (CFLAGS-s_round-power5+.c, CFLAGS-s_roundf-power5+.c): New rule. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_round-power5+.c: New file. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_round-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c: ... here. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_roundf-power5+.c: New file. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_roundf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_round-power5+, s_round-ppc64, s_roundf-power5+, and s_roundf-ppc64. * sysdep/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S: Remove file. * sysdep/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S: Likewise. * sysdep/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S: Likewise. * sysdep/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise. * sysdep/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise. * sysdep/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise. --- sysdeps/powerpc/fpu/round_to_integer.h | 17 ++++ sysdeps/powerpc/fpu/s_round.c | 35 +++++++ sysdeps/powerpc/fpu/s_roundf.c | 35 +++++++ sysdeps/powerpc/powerpc32/fpu/s_round.S | 97 ------------------- sysdeps/powerpc/powerpc32/fpu/s_roundf.S | 96 ------------------ .../power4/fpu/multiarch/s_round-power5+.S | 33 ------- .../power4/fpu/multiarch/s_round-power5+.c | 3 + .../power4/fpu/multiarch/s_round-ppc32.S | 31 ------ .../power4/fpu/multiarch/s_round-ppc32.c | 3 + .../power4/fpu/multiarch/s_roundf-power5+.S | 26 ----- .../power4/fpu/multiarch/s_roundf-power5+.c | 3 + .../power4/fpu/multiarch/s_roundf-ppc32.S | 27 ------ .../power4/fpu/multiarch/s_roundf-ppc32.c | 3 + .../powerpc/powerpc32/power5+/fpu/s_round.S | 29 ------ .../powerpc/powerpc32/power5+/fpu/s_roundf.S | 30 ------ .../powerpc64/be/fpu/multiarch/Makefile | 8 +- .../be/fpu/multiarch/s_round-power5+.c | 3 + .../be/fpu/multiarch/s_round-ppc64.c | 3 + .../{ => be}/fpu/multiarch/s_round.c | 0 .../be/fpu/multiarch/s_roundf-power5+.c | 3 + .../be/fpu/multiarch/s_roundf-ppc64.c | 3 + .../{ => be}/fpu/multiarch/s_roundf.c | 0 .../powerpc/powerpc64/fpu/multiarch/Makefile | 3 +- .../powerpc64/fpu/multiarch/s_round-power5+.S | 30 ------ .../powerpc64/fpu/multiarch/s_round-ppc64.S | 30 ------ .../fpu/multiarch/s_roundf-power5+.S | 24 ----- .../powerpc64/fpu/multiarch/s_roundf-ppc64.S | 24 ----- sysdeps/powerpc/powerpc64/fpu/s_round.S | 80 --------------- sysdeps/powerpc/powerpc64/fpu/s_roundf.S | 82 ---------------- .../powerpc/powerpc64/power5+/fpu/s_round.S | 30 ------ .../powerpc/powerpc64/power5+/fpu/s_roundf.S | 31 ------ 31 files changed, 119 insertions(+), 703 deletions(-) create mode 100644 sysdeps/powerpc/fpu/s_round.c create mode 100644 sysdeps/powerpc/fpu/s_roundf.c delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_round.S delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_roundf.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_round.c (100%) create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_roundf.c (100%) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_round.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_roundf.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h index 77d9fc1f86..3fa2b77b6d 100644 --- a/sysdeps/powerpc/fpu/round_to_integer.h +++ b/sysdeps/powerpc/fpu/round_to_integer.h @@ -38,6 +38,7 @@ set_fenv_mode (enum round_mode mode) { case CEIL: rmode = FE_UPWARD; break; case FLOOR: rmode = FE_DOWNWARD; break; + case ROUND: rmode = FE_TOWARDZERO; break; default: rmode = FE_TONEAREST; break; } __fesetround_inline_nocheck (rmode); @@ -60,12 +61,24 @@ round_to_integer_float (enum round_mode mode, float x) set_fenv_mode (mode); if (x > 0.0) { + /* IEEE 1003.1 round function. IEEE specifies "round to the nearest + integer value, rounding halfway cases away from zero, regardless of + the current rounding mode." However PowerPC Architecture defines + "Round to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". + So we can't use the PowerPC "Round to Nearest" mode. Instead we set + "Round toward Zero" mode and round by adding +-0.5 before rounding + to the integer value. */ + if (mode == ROUND) + r += 0.5f; r += 0x1p+23; r -= 0x1p+23; r = fabs (r); } else if (x < 0.0) { + if (mode == ROUND) + r -= 0.5f; r -= 0x1p+23; r += 0x1p+23; r = -fabs (r); @@ -92,12 +105,16 @@ round_to_integer_double (enum round_mode mode, double x) set_fenv_mode (mode); if (x > 0.0) { + if (mode == ROUND) + r += 0.5; r += 0x1p+52; r -= 0x1p+52; r = fabs (r); } else if (x < 0.0) { + if (mode == ROUND) + r -= 0.5; r -= 0x1p+52; r += 0x1p+52; r = -fabs (r); diff --git a/sysdeps/powerpc/fpu/s_round.c b/sysdeps/powerpc/fpu/s_round.c new file mode 100644 index 0000000000..cd105567ef --- /dev/null +++ b/sysdeps/powerpc/fpu/s_round.c @@ -0,0 +1,35 @@ +/* Largest integral value not greater than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +double +__round (double x) +{ +#ifdef _ARCH_PWR5X + return __builtin_round (x); +#else + return round_to_integer_double (ROUND, x); +#endif +} +#ifndef __round +libm_alias_double (__round, round) +#endif diff --git a/sysdeps/powerpc/fpu/s_roundf.c b/sysdeps/powerpc/fpu/s_roundf.c new file mode 100644 index 0000000000..418062adba --- /dev/null +++ b/sysdeps/powerpc/fpu/s_roundf.c @@ -0,0 +1,35 @@ +/* Smallest integral value not less than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +float +__roundf (float x) +{ +#ifdef _ARCH_PWR5X + return __builtin_roundf (x); +#else + return round_to_integer_float (ROUND, x); +#endif +} +#ifndef __roundf +libm_alias_float (__round, round) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S deleted file mode 100644 index 26c7516458..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_round.S +++ /dev/null @@ -1,97 +0,0 @@ -/* round function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section .rodata.cst8,"aM",@progbits,8 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 -.LC1: /* 0.5 */ - .long 0x3f000000 - -/* double [fp1] round (double x [fp1]) - IEEE 1003.1 round function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "Round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "Round to Nearest" mode. Instead we set - "Round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. */ - - .section ".text" -ENTRY (__round) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - addi r9,r9,.LC0-got_label@l - mtlr r11 - cfi_same_value (lr) - lfs fp13,0(r9) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,1 /* Set rounding mode toward 0. */ -#ifdef SHARED - lfs fp10,.LC1-.LC0(r9) -#else - lis r9,.LC1@ha - lfs fp10,.LC1@l(r9) -#endif - ble- cr6,.L4 - fadd fp1,fp1,fp10 /* x+= 0.5; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - fsub fp9,fp1,fp10 /* x+= 0.5; */ - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp9,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__round) - -libm_alias_double (__round, round) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S deleted file mode 100644 index cb59a2ba51..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S +++ /dev/null @@ -1,96 +0,0 @@ -/* roundf function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 -.LC0: /* 2**23 */ - .long 0x4b000000 -.LC1: /* 0.5 */ - .long 0x3f000000 - -/* float [fp1] roundf (float x [fp1]) - IEEE 1003.1 round function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "Round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "Round to Nearest" mode. Instead we set - "Round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. */ - - .section ".text" -ENTRY (__roundf ) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - addi r9,r9,.LC0-got_label@l - mtlr r11 - cfi_same_value (lr) - lfs fp13,0(r9) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,1 /* Set rounding mode toward 0. */ -#ifdef SHARED - lfs fp10,.LC1-.LC0(r9) -#else - lfs fp10,.LC1@l(r9) -#endif - ble- cr6,.L4 - fadds fp1,fp1,fp10 /* x+= 0.5; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - fsubs fp9,fp1,fp10 /* x+= 0.5; */ - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp9,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__roundf) - -libm_alias_float (__round, round) - diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S deleted file mode 100644 index eab96dbba7..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S +++ /dev/null @@ -1,33 +0,0 @@ -/* round function. PowerPC32/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __round __round_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c new file mode 100644 index 0000000000..3f6f87b4e2 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c @@ -0,0 +1,3 @@ +#include +#define __round __round_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S deleted file mode 100644 index c2208c18fe..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S +++ /dev/null @@ -1,31 +0,0 @@ -/* round function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __round __round_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c new file mode 100644 index 0000000000..92fbadf789 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c @@ -0,0 +1,3 @@ +#include +#define __round __round_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S deleted file mode 100644 index ce4d89c669..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S +++ /dev/null @@ -1,26 +0,0 @@ -/* roundf function. PowerPC32/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(name, alias) - -#define __roundf __roundf_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c new file mode 100644 index 0000000000..b0cb5c5190 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c @@ -0,0 +1,3 @@ +#include +#define __roundf __roundf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S deleted file mode 100644 index 30f4e3f7cd..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S +++ /dev/null @@ -1,27 +0,0 @@ -/* roundf function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) - -#define __roundf __roundf_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c new file mode 100644 index 0000000000..44023bbefd --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c @@ -0,0 +1,3 @@ +#include +#define __roundf __roundf_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S deleted file mode 100644 index 327d970b02..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S +++ /dev/null @@ -1,29 +0,0 @@ -/* round function. PowerPC32/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include - - .machine "power5" -EALIGN (__round, 4, 0) - frin fp1, fp1 - blr - END (__round) - -libm_alias_double (__round, round) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S deleted file mode 100644 index 59a21708f5..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S +++ /dev/null @@ -1,30 +0,0 @@ -/* roundf function. PowerPC32/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include - - .machine "power5" -EALIGN (__roundf, 4, 0) - frin fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__roundf) - -libm_alias_float (__round, round) - diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index 8bb06e5cc0..722f974cfb 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -6,10 +6,16 @@ libm-sysdep_routines += s_ceil-power5+ \ s_floor-power5+ \ s_floor-ppc64 \ s_floorf-power5+ \ - s_floorf-ppc64 + s_floorf-ppc64 \ + s_round-power5+ \ + s_round-ppc64 \ + s_roundf-power5+ \ + s_roundf-ppc64 CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ CFLAGS-s_floor-power5+.c = -mcpu=power5+ CFLAGS-s_floorf-power5+.c = -mcpu=power5+ +CFLAGS-s_round-power5+.c = -mcpu=power5+ +CFLAGS-s_roundf-power5+.c = -mcpu=power5+ endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c new file mode 100644 index 0000000000..3f6f87b4e2 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c @@ -0,0 +1,3 @@ +#include +#define __round __round_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c new file mode 100644 index 0000000000..cb122e6afc --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c @@ -0,0 +1,3 @@ +#include +#define __round __round_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c new file mode 100644 index 0000000000..b0cb5c5190 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c @@ -0,0 +1,3 @@ +#include +#define __roundf __roundf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c new file mode 100644 index 0000000000..3e1de69147 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c @@ -0,0 +1,3 @@ +#include +#define __roundf __roundf_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 8a73108e4c..11c39f4b35 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -15,8 +15,7 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \ sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_llround-power6x \ s_llround-power5+ s_llround-ppc64 \ - s_round-power5+ s_round-ppc64 \ - s_roundf-power5+ s_roundf-ppc64 s_trunc-power5+ \ + s_trunc-power5+ \ s_trunc-ppc64 s_truncf-power5+ s_truncf-ppc64 \ s_llrint-power6x s_llrint-ppc64 \ s_logb-power7 s_logbf-power7 \ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S deleted file mode 100644 index 8c38759d3f..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S +++ /dev/null @@ -1,30 +0,0 @@ -/* round function. PowerPC64/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __round __round_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S deleted file mode 100644 index 5ea616d429..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S +++ /dev/null @@ -1,30 +0,0 @@ -/* round function. PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __round __round_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S deleted file mode 100644 index c29c31785e..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S +++ /dev/null @@ -1,24 +0,0 @@ -/* roundf function. PowerPC64/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#undef weak_alias -#define weak_alias(a,b) - -#define __roundf __roundf_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S deleted file mode 100644 index ced4241b2b..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S +++ /dev/null @@ -1,24 +0,0 @@ -/* roundf function. PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#undef weak_alias -#define weak_alias(a,b) - -#define __roundf __roundf_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/s_round.S b/sysdeps/powerpc/powerpc64/fpu/s_round.S deleted file mode 100644 index 0b06a52d09..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_round.S +++ /dev/null @@ -1,80 +0,0 @@ -/* round function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section ".toc","aw" -.LC0: /* 2**52 */ - .tc FD_43300000_0[TC],0x4330000000000000 -.LC1: /* 0.5 */ - .tc FD_3fe00000_0[TC],0x3fe0000000000000 - .section ".text" - -/* double [fp1] round (double x [fp1]) - IEEE 1003.1 round function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "Round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "Round to Nearest" mode. Instead we set - "Round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. */ - -ENTRY (__round, 4) - CALL_MCOUNT 0 - lfd fp13,.LC0@toc(2) - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,1 /* Set rounding mode toward 0. */ - lfd fp10,.LC1@toc(2) - ble- cr6,.L4 - fadd fp1,fp1,fp10 /* x+= 0.5; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - fsub fp9,fp1,fp10 /* x+= 0.5; */ - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp9,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__round) - -libm_alias_double (__round, round) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S deleted file mode 100644 index a9c32c5774..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S +++ /dev/null @@ -1,82 +0,0 @@ -/* roundf function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section ".toc","aw" - .p2align 3 -.LC0: /* 2**23 */ - .long 0x4b000000 -.LC1: /* 0.5 */ - .long 0x3f000000 - - .section ".text" - -/* float [fp1] roundf (float x [fp1]) - IEEE 1003.1 round function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "Round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "Round to Nearest" mode. Instead we set - "Round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. */ - -ENTRY (__roundf, 4) - CALL_MCOUNT 0 - lfs fp13,.LC0@toc(2) - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,1 /* Set rounding mode toward 0. */ - lfs fp10,.LC1@toc(2) - ble- cr6,.L4 - fadds fp1,fp1,fp10 /* x+= 0.5; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - fsubs fp9,fp1,fp10 /* x+= 0.5; */ - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp9,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__roundf) - -libm_alias_float (__round, round) - diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S deleted file mode 100644 index 45d010a919..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S +++ /dev/null @@ -1,30 +0,0 @@ -/* round function. PowerPC64/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include - - .machine "power5" -ENTRY_TOCLESS (__round, 4) - CALL_MCOUNT 0 - frin fp1, fp1 - blr - END (__round) - -libm_alias_double (__round, round) diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S deleted file mode 100644 index 69fad1069f..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S +++ /dev/null @@ -1,31 +0,0 @@ -/* roundf function. PowerPC64/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include - - .machine "power5" -ENTRY_TOCLESS (__roundf, 4) - CALL_MCOUNT 0 - frin fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__roundf) - -libm_alias_float (__round, round) - From patchwork Fri Mar 29 13:35:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161433 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2051286jan; Fri, 29 Mar 2019 06:38:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqznXtdFepILWdvXKNl3o2eez8NFY+DmvMDkceAB+dcMGYkLjCE5brgtKX5c12psm7W/OiJg X-Received: by 2002:a62:6444:: with SMTP id y65mr39124245pfb.56.1553866692266; Fri, 29 Mar 2019 06:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866692; cv=none; d=google.com; s=arc-20160816; b=jXJDFgl5zhUyTwN9jsyPReXNkjp1ph1udoFion2vo0UwQ7Px8pIOJmqzFS87bZxP5E UFLmMP1DAcsjhXjhh0UAyoLSykbqojBR8PGj1+Ba5Gjto9cJvMMyccUbF8QYBjOdNeyX 8KpMM21yOayKZ4N2BEPo2twSCYODo1yvB8SzO1YRdxPAwYrtKYmdiegDzYy1CPU2lHXL 1W0Mqu5IB9t6XdxMMlqvLakZJnwwvICId0mOvKEKLHda0ViBbceTxIUHmjpQ+n/Wy7Nb JCpXVwPo/j3LqzzddfXZxbZQK05Aj841o9zaD5rx52Ea7xrXOq4x+IvzPFcS6e7nMMIm i0Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=oxW5gw7U3vz5PXMPhecDSJ8Vku2Gi3OxbsH3g/JpnjQ=; b=hi9TWwJ+EFLb1mdfWHCY5pQXFronGwDrJvYnj57FOymHmOlVxIXCGegQBE0fEpdf1m sCj6Fu6oZEyZXJyxK+wxdGODEyT1Tu0T86X9yd3in8ZuxWZ9KRr4QD0U+ksZPRd3PJTP YlFbhnItsDMTQPVAVuH148LBOClu6+IWiZxnIGg6BgYfSw7Idxoc9w/k+7vS9yaqOaZt eEzw/YoyldhE1QE22VWTa6299yXZilCBGUtDCZAKcnw+EvZk2cnSm9K3f+Rw8ei5NLVQ 8AejetSEHrv3aRrwViTekdU4jwWjyhPmXEfHyhxAKa0IzlX51WMaCHnzqSGqnEyehxg6 xOJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=vyHusF3i; dkim=pass header.i=@linaro.org header.s=google header.b=HXdMgwBC; spf=pass (google.com: domain of libc-alpha-return-101002-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101002-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m3si1907445plt.310.2019.03.29.06.38.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:38:12 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101002-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=vyHusF3i; dkim=pass header.i=@linaro.org header.s=google header.b=HXdMgwBC; spf=pass (google.com: domain of libc-alpha-return-101002-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101002-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=d7Fr+ws4BfaH1gqTZsDBVmeWvKw/o0f Xcu6rpKiMZAu2C41WqrU6vDyBx0IDx8/UAS8d7f1AZyARvsvYrR1wiCH+aHIAJ4+ AbXsRD//Dpzx5A/RHNx6/acMAGlh3vSwtwh6sPo9hwzLILkQyTeEiNK2XITSUkPw bKDCRWnoosTs= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=+A8jyZH2o1kuHCTIasL2SEDH2hE=; b=vyHus F3ivX0LjnofUvNxRHwRxjvJhvR60SBSiO88Hwe0dMMlvfP0xkXiMxdbFhN0dSTbW FjnJ3vI5q8z7bv2+7QHSteScgMBELPJM52QprP9j45EjopXuxeMnu9y2Mh8KT/FH xozzMNGrJHMTCeqTDRxzzkd0s09EowcUJfIGYY= Received: (qmail 119970 invoked by alias); 29 Mar 2019 13:36: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 119534 invoked by uid 89); 29 Mar 2019 13:35:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=1011, lc0, a, b, ab X-HELO: mail-ua1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=oxW5gw7U3vz5PXMPhecDSJ8Vku2Gi3OxbsH3g/JpnjQ=; b=HXdMgwBCWlhUQfPmkxGVQxF8847svNkgPrgd5XUg7uv7fANeYeGC5bLr0IZbUsbxGi 77pcjn4qQbCkJsIg1UBszT1QBOEBzfkBgxqctcHRfcMnagUwNQ4dETsobEtcHtSXlSwQ PKq5RNR0NusONLZ0nCrjrD8UNa1EZFPCds79MTDiU+RybeBZmhPzGipYDhJ+MI0ey49/ pxrOT9TA4NbTOUjEaKNz7zKAqtr2ep54+HgW7e5PzAD8Vzsi/U7QfQy0X7vU7CNkqJ18 bhuWlmg6aX++sjHqsrCqpWc35620pmDogMBMxxJrcTql56sRdaJuEcYt+Oqp69mFzw41 ToRg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 07/28] powerpc: trunc/truncf refactor Date: Fri, 29 Mar 2019 10:35:08 -0300 Message-Id: <20190329133529.22523-8-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc trunc{f} implementations on the generic sysdeps/powerpc/fpu/s_trunc{f}. The generic implementation uses either the compiler builts for ISA 2.03+ (which generates the frim instruction) or a generic implementation which uses FP only operations. The IFUNC organization for powerpc64 is also change to be enabled only for powerpc64 and not for powerpc64le. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/trunc_to_integer.h (set_truncing_mode): Add TRUNC handling. * sysdeps/powerpc/fpu/s_trunc.c: New file. * sysdeps/powerpc/fpu/s_truncf.c: New file. * sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_trunc-power5+.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_trunc-ppc32.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_truncf-power5+.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_truncf-ppc32.S: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_trunc-power5+.c: New file. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_trunc-ppc32.c: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_truncf-power5+.c: Likewise. * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_truncf-ppc32.c: Likewise. * sysdep/powerpc/powerpc32/power5+/fpu/s_trunc.S: Remove file. * sysdep/powerpc/powerpc32/power5+/fpu/s_truncf.S: Likewise. * sysdep/powerpc/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_trunc-power5+, s_trunc-ppc64, s_truncf-power5+, and s_truncf-ppc64. (CFLAGS-s_trunc-power5+.c, CFLAGS-s_truncf-power5+.c): New rule. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_trunc-power5+.c: New file. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_trunc-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c: ... here. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_truncf-power5+.c: New file. * sysdep/powerpc/powercp64/be/fpu/multiarch/s_truncf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_trunc-power5+, s_trunc-ppc64, s_truncf-power5+, and s_truncf-ppc64. * sysdep/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S: Remove file. * sysdep/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S: Likewise. * sysdep/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S: Likewise. * sysdep/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise. * sysdep/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise. * sysdep/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise. --- sysdeps/powerpc/fpu/round_to_integer.h | 1 + sysdeps/powerpc/fpu/s_trunc.c | 35 ++++++++ sysdeps/powerpc/fpu/s_truncf.c | 35 ++++++++ sysdeps/powerpc/powerpc32/fpu/s_trunc.S | 83 ------------------- sysdeps/powerpc/powerpc32/fpu/s_truncf.S | 83 ------------------- .../power4/fpu/multiarch/s_trunc-power5+.S | 33 -------- .../power4/fpu/multiarch/s_trunc-power5+.c | 3 + .../power4/fpu/multiarch/s_trunc-ppc32.S | 31 ------- .../power4/fpu/multiarch/s_trunc-ppc32.c | 3 + .../power4/fpu/multiarch/s_truncf-power5+.S | 26 ------ .../power4/fpu/multiarch/s_truncf-power5+.c | 3 + .../power4/fpu/multiarch/s_truncf-ppc32.S | 27 ------ .../power4/fpu/multiarch/s_truncf-ppc32.c | 3 + .../powerpc/powerpc32/power5+/fpu/s_trunc.S | 29 ------- .../powerpc/powerpc32/power5+/fpu/s_truncf.S | 30 ------- .../powerpc64/be/fpu/multiarch/Makefile | 8 +- .../powerpc64/be/fpu/multiarch/s_roundf.c | 2 - .../be/fpu/multiarch/s_trunc-power5+.c | 3 + .../be/fpu/multiarch/s_trunc-ppc64.c | 3 + .../{ => be}/fpu/multiarch/s_trunc.c | 0 .../be/fpu/multiarch/s_truncf-power5+.c | 3 + .../be/fpu/multiarch/s_truncf-ppc64.c | 3 + .../{ => be}/fpu/multiarch/s_truncf.c | 2 - .../powerpc/powerpc64/fpu/multiarch/Makefile | 2 - .../powerpc64/fpu/multiarch/s_trunc-power5+.S | 30 ------- .../powerpc64/fpu/multiarch/s_trunc-ppc64.S | 30 ------- .../fpu/multiarch/s_truncf-power5+.S | 24 ------ .../powerpc64/fpu/multiarch/s_truncf-ppc64.S | 24 ------ sysdeps/powerpc/powerpc64/fpu/s_trunc.S | 72 ---------------- sysdeps/powerpc/powerpc64/fpu/s_truncf.S | 74 ----------------- .../powerpc/powerpc64/power5+/fpu/s_trunc.S | 30 ------- .../powerpc/powerpc64/power5+/fpu/s_truncf.S | 31 ------- 32 files changed, 102 insertions(+), 664 deletions(-) create mode 100644 sysdeps/powerpc/fpu/s_trunc.c create mode 100644 sysdeps/powerpc/fpu/s_truncf.c delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_trunc.S delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_truncf.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_trunc.c (100%) create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_truncf.c (95%) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_trunc.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_truncf.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h index 3fa2b77b6d..ba2d355fb0 100644 --- a/sysdeps/powerpc/fpu/round_to_integer.h +++ b/sysdeps/powerpc/fpu/round_to_integer.h @@ -38,6 +38,7 @@ set_fenv_mode (enum round_mode mode) { case CEIL: rmode = FE_UPWARD; break; case FLOOR: rmode = FE_DOWNWARD; break; + case TRUNC: case ROUND: rmode = FE_TOWARDZERO; break; default: rmode = FE_TONEAREST; break; } diff --git a/sysdeps/powerpc/fpu/s_trunc.c b/sysdeps/powerpc/fpu/s_trunc.c new file mode 100644 index 0000000000..83caf6b9cc --- /dev/null +++ b/sysdeps/powerpc/fpu/s_trunc.c @@ -0,0 +1,35 @@ +/* Largest integral value not greater than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +double +__trunc (double x) +{ +#ifdef _ARCH_PWR5X + return __builtin_trunc (x); +#else + return round_to_integer_double (TRUNC, x); +#endif +} +#ifndef __trunc +libm_alias_double (__trunc, trunc) +#endif diff --git a/sysdeps/powerpc/fpu/s_truncf.c b/sysdeps/powerpc/fpu/s_truncf.c new file mode 100644 index 0000000000..c9f091cf2a --- /dev/null +++ b/sysdeps/powerpc/fpu/s_truncf.c @@ -0,0 +1,35 @@ +/* Smallest integral value not less than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +float +__truncf (float x) +{ +#ifdef _ARCH_PWR5X + return __builtin_truncf (x); +#else + return round_to_integer_float (TRUNC, x); +#endif +} +#ifndef __truncf +libm_alias_float (__trunc, trunc) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S deleted file mode 100644 index 31daff161f..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S +++ /dev/null @@ -1,83 +0,0 @@ -/* trunc function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 - -/* double [fp1] trunc (double x [fp1]) - IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer - value, in floating format, nearest to but no larger in magnitude - then the argument." - We set "round toward Zero" mode and trunc by adding +-2**52 then - subtracting +-2**52. */ - - .section ".text" -ENTRY (__trunc) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,1 /* Set rounding toward 0 mode. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__trunc) - -libm_alias_double (__trunc, trunc) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S deleted file mode 100644 index 630300c5dc..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S +++ /dev/null @@ -1,83 +0,0 @@ -/* truncf function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**23 */ - .long 0x4b000000 - -/* float [fp1] truncf (float x [fp1]) - IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer - value, in floating format, nearest to but no larger in magnitude - then the argument." - We set "round toward Zero" mode and trunc by adding +-2**23 then - subtracting +-2**23. */ - - .section ".text" -ENTRY (__truncf) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,1 /* Set rounding toward 0 mode. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__truncf) - -libm_alias_float (__trunc, trunc) - diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S deleted file mode 100644 index 3ed99c3f7e..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S +++ /dev/null @@ -1,33 +0,0 @@ -/* trunc function. PowerPC32/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __trunc __trunc_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c new file mode 100644 index 0000000000..47abda6810 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c @@ -0,0 +1,3 @@ +#include +#define __trunc __trunc_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S deleted file mode 100644 index 67b87c5db1..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S +++ /dev/null @@ -1,31 +0,0 @@ -/* trunc function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __trunc __trunc_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c new file mode 100644 index 0000000000..5b9164295f --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c @@ -0,0 +1,3 @@ +#include +#define __trunc __trunc_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S deleted file mode 100644 index a18af562e6..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S +++ /dev/null @@ -1,26 +0,0 @@ -/* truncf function. PowerPC32/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(name, alias) - -#define __truncf __truncf_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c new file mode 100644 index 0000000000..b8e75d4e28 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c @@ -0,0 +1,3 @@ +#include +#define __truncf __truncf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S deleted file mode 100644 index a7bf3943f2..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S +++ /dev/null @@ -1,27 +0,0 @@ -/* truncf function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) - -#define __truncf __truncf_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c new file mode 100644 index 0000000000..f20c82553a --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c @@ -0,0 +1,3 @@ +#include +#define __truncf __truncf_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S deleted file mode 100644 index 37a24104e7..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S +++ /dev/null @@ -1,29 +0,0 @@ -/* trunc function. PowerPC32/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include - - .machine "power5" -EALIGN (__trunc, 4, 0) - friz fp1, fp1 - blr - END (__trunc) - -libm_alias_double (__trunc, trunc) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S deleted file mode 100644 index f24c1f6cda..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S +++ /dev/null @@ -1,30 +0,0 @@ -/* truncf function. PowerPC32/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include - - .machine "power5" -EALIGN (__truncf, 4, 0) - friz fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__truncf) - -libm_alias_float (__trunc, trunc) - diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index 722f974cfb..53e600f5f6 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -10,7 +10,11 @@ libm-sysdep_routines += s_ceil-power5+ \ s_round-power5+ \ s_round-ppc64 \ s_roundf-power5+ \ - s_roundf-ppc64 + s_roundf-ppc64 \ + s_trunc-power5+ \ + s_trunc-ppc64 \ + s_truncf-power5+ \ + s_truncf-ppc64 CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ @@ -18,4 +22,6 @@ CFLAGS-s_floor-power5+.c = -mcpu=power5+ CFLAGS-s_floorf-power5+.c = -mcpu=power5+ CFLAGS-s_round-power5+.c = -mcpu=power5+ CFLAGS-s_roundf-power5+.c = -mcpu=power5+ +CFLAGS-s_trunc-power5+.c = -mcpu=power5+ +CFLAGS-s_truncf-power5+.c = -mcpu=power5+ endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c index 640bca5a7a..db6a17c5b2 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c @@ -18,8 +18,6 @@ #define NO_MATH_REDIRECT #include -#include -#include #include "init-arch.h" #include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c new file mode 100644 index 0000000000..47abda6810 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c @@ -0,0 +1,3 @@ +#include +#define __trunc __trunc_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c new file mode 100644 index 0000000000..21c47308fc --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c @@ -0,0 +1,3 @@ +#include +#define __trunc __trunc_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c new file mode 100644 index 0000000000..b8e75d4e28 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c @@ -0,0 +1,3 @@ +#include +#define __truncf __truncf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c new file mode 100644 index 0000000000..aa6c6c1f98 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c @@ -0,0 +1,3 @@ +#include +#define __truncf __truncf_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c similarity index 95% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c index be124b2023..b6c8260b69 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c @@ -18,8 +18,6 @@ #define NO_MATH_REDIRECT #include -#include -#include #include "init-arch.h" #include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 11c39f4b35..7d469d79af 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -15,8 +15,6 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \ sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_llround-power6x \ s_llround-power5+ s_llround-ppc64 \ - s_trunc-power5+ \ - s_trunc-ppc64 s_truncf-power5+ s_truncf-ppc64 \ s_llrint-power6x s_llrint-ppc64 \ s_logb-power7 s_logbf-power7 \ s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S deleted file mode 100644 index 9ce3db48e4..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S +++ /dev/null @@ -1,30 +0,0 @@ -/* trunc function. PowerPC64/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __trunc __trunc_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S deleted file mode 100644 index ca9d831850..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S +++ /dev/null @@ -1,30 +0,0 @@ -/* trunc function. PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __trunc __trunc_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S deleted file mode 100644 index 4e651172af..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S +++ /dev/null @@ -1,24 +0,0 @@ -/* truncf function. PowerPC64/power5+ version. - Copyright (C) 2013-2019 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 - . */ - -#undef weak_alias -#define weak_alias(a,b) - -#define __truncf __truncf_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S deleted file mode 100644 index 5420eb26c7..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S +++ /dev/null @@ -1,24 +0,0 @@ -/* truncf function. PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#undef weak_alias -#define weak_alias(a,b) - -#define __truncf __truncf_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S deleted file mode 100644 index 628960dd27..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S +++ /dev/null @@ -1,72 +0,0 @@ -/* trunc function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section ".toc","aw" -.LC0: /* 2**52 */ - .tc FD_43300000_0[TC],0x4330000000000000 - .section ".text" - -/* double [fp1] trunc (double x [fp1]) - IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer - value, in floating format, nearest to but no larger in magnitude - then the argument." - We set "round toward Zero" mode and trunc by adding +-2**52 then - subtracting +-2**52. */ - -ENTRY (__trunc, 4) - CALL_MCOUNT 0 - lfd fp13,.LC0@toc(2) - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,1 /* Set rounding toward 0 mode. */ - ble- cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__trunc) - -libm_alias_double (__trunc, trunc) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S deleted file mode 100644 index 7b9294595a..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S +++ /dev/null @@ -1,74 +0,0 @@ -/* truncf function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section ".toc","aw" - .p2align 3 -.LC0: /* 2**23 */ - .long 0x4b000000 - .long 0x0 - .section ".text" - -/* float [fp1] truncf (float x [fp1]) - IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer - value, in floating format, nearest to but no larger in magnitude - then the argument." - We set "round toward Zero" mode and trunc by adding +-2**23 then - subtracting +-2**23. */ - -ENTRY (__truncf, 4) - CALL_MCOUNT 0 - lfs fp13,.LC0@toc(2) - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - mffs fp11 /* Save current FPU rounding mode and - "inexact" state. */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl- cr7,.L10 - mtfsfi 7,1 /* Set rounding toward 0 mode. */ - ble- cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - /* x = 0.0; */ - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L4: - bge- cr6,.L9 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - /* x = -0.0; */ -.L9: - mtfsf 0xff,fp11 /* Restore previous rounding mode and - "inexact" state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__truncf) - -libm_alias_float (__trunc, trunc) - diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S deleted file mode 100644 index fbd0c318ef..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S +++ /dev/null @@ -1,30 +0,0 @@ -/* trunc function. PowerPC64/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include - - .machine "power5" -ENTRY_TOCLESS (__trunc, 4) - CALL_MCOUNT 0 - friz fp1, fp1 - blr - END (__trunc) - -libm_alias_double (__trunc, trunc) diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S deleted file mode 100644 index 91612aa4e9..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S +++ /dev/null @@ -1,31 +0,0 @@ -/* truncf function. PowerPC64/power5+ version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include - - .machine "power5" -ENTRY_TOCLESS (__truncf, 4) - CALL_MCOUNT 0 - friz fp1, fp1 /* The rounding instructions are double. */ - frsp fp1, fp1 /* But we need to set ooverflow for float. */ - blr - END (__truncf) - -libm_alias_float (__trunc, trunc) - From patchwork Fri Mar 29 13:35:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161427 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2049687jan; Fri, 29 Mar 2019 06:36:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyytetLr2XwrztqhwVai8MvVwZPIFUVdbPeIBkBiSCbeea1zaX/gzsW029OEc6KgUVcQFDW X-Received: by 2002:a17:902:7206:: with SMTP id ba6mr11250630plb.301.1553866609652; Fri, 29 Mar 2019 06:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866609; cv=none; d=google.com; s=arc-20160816; b=uM16R5OsdH4oQhmeNZfUahHf8zbygRAaIEpKcIhhAqRQS4LJC5rl8ovPOTHnC+FOpJ wJUUYxe65doiKRBjtus5VT+O/m+bXQ+cb+Xmy01kE9GgtYLs6set+N7YizfC4/B8qVVy BTPLaXEJU1oTVtk1C4SgLvWN1s3OGfjWa48GyA/ZS92ZIGxry7fIG74QTTVf0xUaIze+ J11GsU9ZR/EhNs6N29HMYF0eOt2wuZAODDLbtlKoUQLPnq/Z93jcd28kFq88Fu6gyEqP 7akw3u9HZd3TK/wd4/ORofJ//Hg0Sjqb/Js14TdYWlj5b0qdpgZLc6zOjRR2WaGwnx5W XVEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=YOfJpX8aFO+6NBbMNlYw1JrhmlQwaiujyMc/jiHOBs8=; b=xfHIvLIQJvV3C6+1Q9r3365dSJgNXkhsyy+sD14lb3ZYuHygJ4nvsslSAYpldvCX4n nPYFvzjDoXQfI6Tn/fphv9eDBO3GqdWbPTPkUXmuFnGWX1K4zrn+9tmgXeUoNHZRzvMe qi4VDihyaf+vJomUKfyKr05rFHHUMCLEcuGSA0h/MSVUV5Lmcgok1jKQ/K3XD++hhFKE QH2u4BjQLZdegWHoWSRA/z3GIwJDm+ZHxMj0jqc8TPs9glh1Xp/AlgPE155pOPyhwApk knDhrygXc74EUUV0KvUbexdorf5cABe4p9JJVwKKH/CYCNVrT4NOdrHWF25is5lYgUnO wbEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=n12y6Vqw; dkim=pass header.i=@linaro.org header.s=google header.b="EvUSV/6x"; spf=pass (google.com: domain of libc-alpha-return-100996-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100996-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id t17si1945435pgi.180.2019.03.29.06.36.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100996-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=n12y6Vqw; dkim=pass header.i=@linaro.org header.s=google header.b="EvUSV/6x"; spf=pass (google.com: domain of libc-alpha-return-100996-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100996-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=uPXF6kW0iSTfCPWEBpGmFXyz9VHaJbh mE2vb5sx3roUy446GKLkDx2qbtCsWLjbAF1QUmdvNM3TMLe3iszgjrZi4nriGSLq t65pEtIl6WBAl91QQfisz3TlpCgV8fAGReYqv5uIc4bypRfk8WAN9myr1/qjvGq4 0F4PNrayxOgQ= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=+ua6PtBlBIdudzwNMjAYKYbt42U=; b=n12y6 Vqw664SImBO6LgaHM/ndELDnIpugsgE1XQd2MjznPxb1a12Iab+SvcI5edig3V3X gs9gQLHhNyZyntawzfZ2Z8pGu4jhvQY8DwCPFbfgYcEHYRdb2KajhRAVm3LTZwlb nr/agTPPJCWTHAmxNz58rimPBKQfT0w5uTX3Bk= Received: (qmail 119107 invoked by alias); 29 Mar 2019 13:35:51 -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 119020 invoked by uid 89); 29 Mar 2019 13:35:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=2011, lc0, ble, Largest X-HELO: mail-vs1-f54.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=YOfJpX8aFO+6NBbMNlYw1JrhmlQwaiujyMc/jiHOBs8=; b=EvUSV/6xe1sPsdc5vdMJ+Krp67K7uS03BfqjbsAXedpUEjf7cIn7SwDjRvyrxwCZDz Mb6E93oU6aXkExtGnY1fiBpUGf5Si1QqFyopduIBe6sA4VWei0uFNnwkrKk9bqHsQ2Ap 7kscu+b5h1KbHE+9pnUMgTrRWaiMr2RHAaIzcx8OnKhcpuJno9OTw2Zq5eflcs4Nk/wL zKpHRIr0xUgS547GRBe1I9QZhFwJn47lvqHA7V/1g114DDSdiNj151yj42g3KrVS6AGc dGwX63dgL2dsAGXZtkKviX2ESdIFXiEitO3dghwjOKADLcq4LdmIk1F697soA0OYcm23 dwOg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 08/28] powerpc: generic nearbyint/nearbyintf Date: Fri, 29 Mar 2019 10:35:09 -0300 Message-Id: <20190329133529.22523-9-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc nearbyint{f} implementations on the generic sysdeps/powerpc/fpu/s_nearbyint{f}. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode): Add NEARBYINT handling. * sysdeps/powerpc/fpu/s_nearbyint.c: New file. * sysdeps/powerpc/fpu/s_nearbyintf.c: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise. --- sysdeps/powerpc/fpu/round_to_integer.h | 19 +++-- sysdeps/powerpc/fpu/s_nearbyint.c | 30 ++++++++ sysdeps/powerpc/fpu/s_nearbyintf.c | 30 ++++++++ sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S | 80 -------------------- sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S | 79 ------------------- sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S | 68 ----------------- sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S | 69 ----------------- 7 files changed, 73 insertions(+), 302 deletions(-) create mode 100644 sysdeps/powerpc/fpu/s_nearbyint.c create mode 100644 sysdeps/powerpc/fpu/s_nearbyintf.c delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S -- 2.17.1 diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h index ba2d355fb0..5d4378063a 100644 --- a/sysdeps/powerpc/fpu/round_to_integer.h +++ b/sysdeps/powerpc/fpu/round_to_integer.h @@ -33,16 +33,23 @@ enum round_mode static inline void set_fenv_mode (enum round_mode mode) { - int rmode; switch (mode) { - case CEIL: rmode = FE_UPWARD; break; - case FLOOR: rmode = FE_DOWNWARD; break; + case CEIL: + __fesetround_inline_nocheck (FE_UPWARD); + break; + case FLOOR: + __fesetround_inline_nocheck (FE_DOWNWARD); + break; case TRUNC: - case ROUND: rmode = FE_TOWARDZERO; break; - default: rmode = FE_TONEAREST; break; + case ROUND: + __fesetround_inline_nocheck (FE_TOWARDZERO); + break; + case NEARBYINT: + /* Disable FE_INEXACT exception */ + reset_fpscr_bit (FPSCR_XE); + break; } - __fesetround_inline_nocheck (rmode); } static inline float diff --git a/sysdeps/powerpc/fpu/s_nearbyint.c b/sysdeps/powerpc/fpu/s_nearbyint.c new file mode 100644 index 0000000000..48bcd86f04 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_nearbyint.c @@ -0,0 +1,30 @@ +/* Largest integral value not greater than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include +#include + +double +__nearbyint (double x) +{ + return round_to_integer_double (NEARBYINT, x); +} +libm_alias_double (__nearbyint, nearbyint) diff --git a/sysdeps/powerpc/fpu/s_nearbyintf.c b/sysdeps/powerpc/fpu/s_nearbyintf.c new file mode 100644 index 0000000000..db8a3cdac7 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_nearbyintf.c @@ -0,0 +1,30 @@ +/* Smallest integral value not less than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include +#include + +float +__nearbyintf (float x) +{ + return round_to_integer_float (NEARBYINT, x); +} +libm_alias_float (__nearbyint, nearbyint) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S b/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S deleted file mode 100644 index 4ed5d702f1..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S +++ /dev/null @@ -1,80 +0,0 @@ -/* Round to int floating-point values. PowerPC32 version. - Copyright (C) 2011-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella , 2011 - - 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 - . */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include -#include -#include - - -/* double [fp1] nearbyint(double [fp1] x) */ - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 /* TWO52: 2**52 */ - - .section ".text" -ENTRY (__nearbyint) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52 */ - bge cr7,.L10 - fcmpu cr7,fp1,fp12 /* if (x > 0.0 */ - ble cr7,L(lessthanzero) - mffs fp11 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fadd fp1,fp1,fp13 /* x += TWO52 */ - fsub fp1,fp1,fp13 /* x -= TWO52 */ - fabs fp1,fp1 /* if (x == 0.0 */ - mtfsf 0xff,fp11 /* Restore FE_INEXACT state. */ - blr -L(lessthanzero): - bgelr cr7 - mffs fp11 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fsub fp1,fp1,fp13 /* x -= TWO52 */ - fadd fp1,fp1,fp13 /* x += TWO52 */ - fnabs fp1,fp1 /* if (x == 0.0) */ - mtfsf 0xff,fp11 /* Restore FE_INEXACT state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr -END (__nearbyint) - -libm_alias_double (__nearbyint, nearbyint) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S b/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S deleted file mode 100644 index b1895f9d10..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S +++ /dev/null @@ -1,79 +0,0 @@ -/* Round to int floating-point values. PowerPC32 version. - Copyright (C) 2011-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella , 2011 - - 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 - . */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include -#include - - -/* float [fp1] nearbyintf(float [fp1] x) */ - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: - .long 0x4B000000 /* TWO23: 2**23 */ - - .section ".text" -ENTRY (__nearbyintf) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23 */ - bge cr7,.L10 - fcmpu cr7,fp1,fp12 /* if (x > 0.0 */ - ble cr7,L(lessthanzero) - mffs fp11 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fadds fp1,fp1,fp13 /* x += TWO23 */ - fsubs fp1,fp1,fp13 /* x -= TWO23 */ - fabs fp1,fp1 /* if (x == 0.0) */ - mtfsf 0xff,fp11 /* Restore FE_INEXACT state. */ - blr -L(lessthanzero): - bgelr cr7 - mffs fp11 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fsubs fp1,fp1,fp13 /* x -= TWO23 */ - fadds fp1,fp1,fp13 /* x += TWO23 */ - fnabs fp1,fp1 /* if (x == 0.0) */ - mtfsf 0xff,fp11 /* Restore FE_INEXACT state. */ - blr -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr -END (__nearbyintf) - -libm_alias_float (__nearbyint, nearbyint) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S deleted file mode 100644 index 4065af8fe3..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S +++ /dev/null @@ -1,68 +0,0 @@ -/* Round to int floating-point values. PowerPC64 version. - Copyright (C) 2011-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella , 2011 - - 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 - . */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include -#include -#include - - -/* double [fp1] nearbyint(double [fp1] x) */ - - .section ".toc","aw" -.LC0: /* 2**52 */ - .tc FD_43300000_0[TC],0x4330000000000000 - .section ".text" - -ENTRY (__nearbyint, 4) - CALL_MCOUNT 0 - fabs fp0,fp1 - lfd fp13,.LC0@toc(2) - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - bge cr7,.L10 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp1,fp12 /* if (x > 0.0) */ - ble cr7, L(lessthanzero) - mffs fp11 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fadd fp1,fp1,fp13 /* x+= TWO52 */ - fsub fp1,fp1,fp13 /* x-= TWO52 */ - fabs fp1,fp1 /* if (x == 0.0) */ - mtfsf 0xff,fp11 /* Restore FE_INEXACT state. */ - blr /* x = 0.0; */ -L(lessthanzero): - bgelr cr7 /* if (x < 0.0) */ - mffs fp11 - mtfsb0 4*cr7+lt - fsub fp1,fp1,fp13 /* x -= TWO52 */ - fadd fp1,fp1,fp13 /* x += TWO52 */ - fnabs fp1,fp1 /* if (x == 0.0) */ - mtfsf 0xff,fp11 /* Restore FE_INEXACT state. */ - blr /* x = -0.0; */ -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr -END (__nearbyint) - -libm_alias_double (__nearbyint, nearbyint) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S deleted file mode 100644 index 69949028a3..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S +++ /dev/null @@ -1,69 +0,0 @@ -/* Round to int floating-point values. PowerPC64 version. - Copyright (C) 2011-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella , 2011 - - 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 - . */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include -#include - - -/* float [fp1] nearbyintf(float [fp1]) */ - - .section ".toc","aw" - .p2align 3 -.LC0: /* 2**23 */ - .long 0x4b000000 - .long 0x0 - .section ".text" - -ENTRY (__nearbyintf, 4) - CALL_MCOUNT 0 - fabs fp0,fp1 - lfs fp13,.LC0@toc(2) - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - bge cr7,.L10 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp1,fp12 /* if (x > 0.0) */ - ble cr7, L(lessthanzero) - mffs fp11 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fadds fp1,fp1,fp13 /* x += TWO23 */ - fsubs fp1,fp1,fp13 /* x -= TWO23 */ - fabs fp1,fp1 /* if (x == 0.0) */ - mtfsf 0xff,fp11 /* Restore FE_INEXACT state. */ - blr /* x = 0.0; */ -L(lessthanzero): - bgelr cr7 /* if (x < 0.0) */ - mffs fp11 - mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ - fsubs fp1,fp1,fp13 /* x -= TWO23 */ - fadds fp1,fp1,fp13 /* x += TWO23 */ - fnabs fp1,fp1 /* if (x == 0.0) */ - mtfsf 0xff,fp11 /* Restore FE_INEXACT state. */ - blr /* x = -0.0; */ -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr -END (__nearbyintf) - -libm_alias_float (__nearbyint, nearbyint) From patchwork Fri Mar 29 13:35:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161431 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2050738jan; Fri, 29 Mar 2019 06:37:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJPEwb0N4D6KIqGKKIQS6GxkYpBU19S1the1BbxKYI10dAeWm5vGgmF0GALv/f+ivP2jnA X-Received: by 2002:a65:624c:: with SMTP id q12mr44610300pgv.75.1553866664364; Fri, 29 Mar 2019 06:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866664; cv=none; d=google.com; s=arc-20160816; b=KurrxribbSX1z3yKKfXpCWgxf39/YB6mT4jBQ22dTbqDczh7isBPOk0Ga6r2OWMELR qwLPGcbe/SbJAVVqAON12gBsOzR+7qMSTRWcrQP+6VC0DicnY3Pqygz4imW9LR160moP n8bIv8xs3FVNBct7IleokC8vQwY9rAPL7K9kX4Nias/g02Piqta6WIrsmuNLGCef+o8N /Bnx3P+evCzLaufu1gTZB86MEkxotC7rxSfGBLteCoh4h1dyG+98R8L5EuyhjdS4GJ0g yUCcsG2QYD/zUzwLsd+wJPTBrva1xGZBcPjDb7gyrMJ5Vp4TITqBOFc0bd3Um5/J6+Oq QiRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=DOkQDo2LIfMH9lLgF/nW0HzzYLos6t8PTZXdr44AzLM=; b=uvo6fgcN1/Voh2SFZ+f2TJ28gThntQC1DP6TmCr5E3Yx+kQlLcO6Ab2j30nLZajAsY ni5veC5ubhPYVQSpSw/F4JZ5zI1NiO+XkYvWJMcnj1Dp9/GPl97b9f+ifuKFwfQduK9o aqDCERCuHvs2sJx1PvCaNhOO8asSdgu6H0oyyDU3GwvJtUMcQLmkmxEk5Sro8mggjC7X Xs0d5YT2eNprAyNmXkeKZdKz0Ekdmy6KKAom/NBxKZwnajIERADjCZt+mXTyhpS1Noll ZTH2zkSSjj1nnygA36S1N4HBqNVP2tmFNE1z+rUFAhEu06mFXSkfvHBEZA1VX4OSJ1f3 32Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=O6q0TH73; dkim=pass header.i=@linaro.org header.s=google header.b=CAlrMn6a; spf=pass (google.com: domain of libc-alpha-return-101000-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101000-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 73si1902724pgb.250.2019.03.29.06.37.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:37:44 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101000-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=O6q0TH73; dkim=pass header.i=@linaro.org header.s=google header.b=CAlrMn6a; spf=pass (google.com: domain of libc-alpha-return-101000-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101000-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=lt009uQyS/q3XBSWevDG3q71rx9XCTh zuZ8y7zVUw3vg3lBeYaCzL1QadmJ/BdN2DbHFRqVjTYhN+CWrE1fAXR8DO+bVl6R jWqXKUredm4NqVt69/+kh9dFNdtNmt1DMPxsQcFvgHp42RbjMNSlylpDINHt0cyB 8kwj43Gd0vfY= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=APlGG0owF1Rqo6LLBI3/A6ZJSJQ=; b=O6q0T H73h/UVQzTDkhI88pJu/jOoEKJyzJiRogtGU78WtwbDcx1+OQGjIlvDStUeH+oXk V2LKKodrlDYPc41UtKpo4oDJIV3MbEl/AYyVxjhU3AUIwUhyvXq4ecfMMK5ywurC lCWUyY052sxnAglS1G12Hf7GwB5IKPO0lHUsoI= Received: (qmail 119631 invoked by alias); 29 Mar 2019 13:35:56 -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 119509 invoked by uid 89); 29 Mar 2019 13:35:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-ua1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=DOkQDo2LIfMH9lLgF/nW0HzzYLos6t8PTZXdr44AzLM=; b=CAlrMn6a29by0ORFad7ixfDEvcxYUzKnTn/gFg8APVMAuHyrXg/aTCtfetzGzhkdOr CfRMtNYDzNI4xek1eJmrRqVUcdh/jB5cLgy0jjrfeRXGgUaG5AOxRBT9o1nLdj6whz10 hdljN22Pi1SranBv/JxoHdJ2JXoe+CpE0ugH3g9poyHXQZ3nsyLjUiLWJjbcxAfh8oEc NfzOtrBkVgUHzEDXFrXDRX57xHBlaoHs20WzbtHUaWxAFontMdjVtE3m7zSDa2ylbNaE PXqu+E6qsde9q1Oke1KCciJTAMaapI6axjUUoo5hKU8cy3EFuGFcTUnc6D3Rbcui2rBw Xs6g== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 09/28] powerpc: consolidate rint Date: Fri, 29 Mar 2019 10:35:10 -0300 Message-Id: <20190329133529.22523-10-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc rint{f} implementations on the generic sysdeps/powerpc/fpu/s_rint{f}. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode, round_to_integer_float): Add RINT handling. (reset_fenv_mode): New symbol. * sysdeps/powerpc/fpu/s_rint.c (__rint): Use generic implementation. * sysdeps/powerpc/fpu/s_rintf.c (__rintf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_rint.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise. --- sysdeps/powerpc/fpu/round_to_integer.h | 35 ++++++++++--- sysdeps/powerpc/fpu/s_rint.c | 19 +------ sysdeps/powerpc/fpu/s_rintf.c | 19 +------ sysdeps/powerpc/powerpc32/fpu/s_rint.S | 69 ------------------------- sysdeps/powerpc/powerpc32/fpu/s_rintf.S | 66 ----------------------- sysdeps/powerpc/powerpc64/fpu/s_rint.S | 58 --------------------- sysdeps/powerpc/powerpc64/fpu/s_rintf.S | 57 -------------------- 7 files changed, 31 insertions(+), 292 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_rint.S delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_rintf.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_rint.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_rintf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h index 5d4378063a..c759483230 100644 --- a/sysdeps/powerpc/fpu/round_to_integer.h +++ b/sysdeps/powerpc/fpu/round_to_integer.h @@ -28,11 +28,17 @@ enum round_mode ROUND, TRUNC, NEARBYINT, + RINT }; -static inline void +static inline fenv_t set_fenv_mode (enum round_mode mode) { + fenv_t fe = 0; + if (mode != RINT) + /* Save current FPU rounding mode and inexact state. */ + fe = fegetenv_register (); + switch (mode) { case CEIL: @@ -49,6 +55,22 @@ set_fenv_mode (enum round_mode mode) /* Disable FE_INEXACT exception */ reset_fpscr_bit (FPSCR_XE); break; + case RINT: + break; + } + return fe; +} + +static inline void +reset_fenv_mode (fenv_t fe, enum round_mode mode) +{ + switch (mode) + { + default: + __builtin_mtfsf (0xff, fe); + break; + case RINT: + break; } } @@ -64,9 +86,7 @@ round_to_integer_float (enum round_mode mode, float x) float r = x; - /* Save current FPU rounding mode and inexact state. */ - fenv_t fe = fegetenv_register (); - set_fenv_mode (mode); + fenv_t fe = set_fenv_mode (mode); if (x > 0.0) { /* IEEE 1003.1 round function. IEEE specifies "round to the nearest @@ -91,7 +111,7 @@ round_to_integer_float (enum round_mode mode, float x) r += 0x1p+23; r = -fabs (r); } - __builtin_mtfsf (0xff, fe); + reset_fenv_mode (fe, mode); return r; } @@ -109,8 +129,7 @@ round_to_integer_double (enum round_mode mode, double x) double r = x; /* Save current FPU rounding mode and inexact state. */ - fenv_t fe = fegetenv_register (); - set_fenv_mode (mode); + fenv_t fe = set_fenv_mode (mode); if (x > 0.0) { if (mode == ROUND) @@ -127,7 +146,7 @@ round_to_integer_double (enum round_mode mode, double x) r += 0x1p+52; r = -fabs (r); } - __builtin_mtfsf (0xff, fe); + reset_fenv_mode (fe, mode); return r; } diff --git a/sysdeps/powerpc/fpu/s_rint.c b/sysdeps/powerpc/fpu/s_rint.c index 8bf43e3efe..062d6b125b 100644 --- a/sysdeps/powerpc/fpu/s_rint.c +++ b/sysdeps/powerpc/fpu/s_rint.c @@ -19,26 +19,11 @@ #define NO_MATH_REDIRECT #include #include +#include double __rint (double x) { - static const float TWO52 = 4503599627370496.0; - - if (fabs (x) < TWO52) - { - if (x > 0.0) - { - x += TWO52; - x -= TWO52; - } - else if (x < 0.0) - { - x = TWO52 - x; - x = -(x - TWO52); - } - } - - return x; + return round_to_integer_double (RINT, x); } libm_alias_double (__rint, rint) diff --git a/sysdeps/powerpc/fpu/s_rintf.c b/sysdeps/powerpc/fpu/s_rintf.c index 03aaec2c85..c29e7a22b4 100644 --- a/sysdeps/powerpc/fpu/s_rintf.c +++ b/sysdeps/powerpc/fpu/s_rintf.c @@ -19,26 +19,11 @@ #define NO_MATH_REDIRECT #include #include +#include float __rintf (float x) { - static const float TWO23 = 8388608.0; - - if (fabsf (x) < TWO23) - { - if (x > 0.0) - { - x += TWO23; - x -= TWO23; - } - else if (x < 0.0) - { - x = TWO23 - x; - x = -(x - TWO23); - } - } - - return x; + return round_to_integer_float (RINT, x); } libm_alias_float (__rint, rint) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/sysdeps/powerpc/powerpc32/fpu/s_rint.S deleted file mode 100644 index 0b50b6f053..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_rint.S +++ /dev/null @@ -1,69 +0,0 @@ -/* Round to int floating-point values. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**52 */ - .long 0x59800000 - - .section ".text" -ENTRY (__rint) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl cr7,.L10 - bng cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = 0.0; */ -.L4: - bnllr cr6 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = -0.0; */ -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__rint) - -libm_alias_double (__rint, rint) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S deleted file mode 100644 index f22ad8b2b3..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S +++ /dev/null @@ -1,66 +0,0 @@ -/* Round float to int floating-point values. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 2**23 */ - .long 0x4b000000 - - .section ".text" -ENTRY (__rintf) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfs fp13,.LC0-got_label@l(r9) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp13,.LC0@l(r9) -#endif - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl cr7,.L10 - bng cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = 0.0; */ -.L4: - bnllr cr6 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = -0.0; */ -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__rintf) - -libm_alias_float (__rint, rint) - diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rint.S b/sysdeps/powerpc/powerpc64/fpu/s_rint.S deleted file mode 100644 index 5616f4d908..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_rint.S +++ /dev/null @@ -1,58 +0,0 @@ -/* Round to int floating-point values. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include -#include -#include - - .section ".toc","aw" -.LC0: /* 2**52 */ - .tc FD_43300000_0[TC],0x4330000000000000 - .section ".text" - -ENTRY (__rint, 4) - CALL_MCOUNT 0 - lfd fp13,.LC0@toc(2) - fabs fp0,fp1 - fsub fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl cr7,.L10 - bng cr6,.L4 - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = 0.0; */ -.L4: - bnllr cr6 /* if (x < 0.0) */ - fsub fp1,fp1,fp13 /* x-= TWO52; */ - fadd fp1,fp1,fp13 /* x+= TWO52; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = -0.0; */ -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadd fp1,fp1,fp1 - blr - END (__rint) - -libm_alias_double (__rint, rint) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S deleted file mode 100644 index 4511467584..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S +++ /dev/null @@ -1,57 +0,0 @@ -/* Round float to int floating-point values. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section ".toc","aw" - .p2align 3 -.LC0: /* 2**23 */ - .long 0x4b000000 - .long 0x0 - .section ".text" - -ENTRY (__rintf, 4) - CALL_MCOUNT 0 - lfs fp13,.LC0@toc(2) - fabs fp0,fp1 - fsubs fp12,fp13,fp13 /* generate 0.0 */ - fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */ - fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ - bnl cr7,.L10 - bng cr6,.L4 - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = 0.0; */ -.L4: - bnllr cr6 /* if (x < 0.0) */ - fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fadds fp1,fp1,fp13 /* x+= TWO23; */ - fnabs fp1,fp1 /* if (x == 0.0) */ - blr /* x = -0.0; */ -.L10: - /* Ensure sNaN input is converted to qNaN. */ - fcmpu cr7,fp1,fp1 - beqlr cr7 - fadds fp1,fp1,fp1 - blr - END (__rintf) - -libm_alias_float (__rint, rint) - From patchwork Fri Mar 29 13:35:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161437 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2052226jan; Fri, 29 Mar 2019 06:39:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzd7tj9CzAViFEYlNzvGPiWIiWhWhmD4EGelBM3ahgMMMHOFQ9mQnwMewX+7Z/qfcg8o7nS X-Received: by 2002:a63:4616:: with SMTP id t22mr44818904pga.217.1553866742108; Fri, 29 Mar 2019 06:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866742; cv=none; d=google.com; s=arc-20160816; b=jdzc6zDSB4/nOUWdl0Pw1xymKC6tpHB8AIwV44daLYlYqkkuHK9Vm0vI6NwS+p1s9W CK2RUSm8lfgtzt0Tlx5if0HpWhVHPA7GH5qVj4uVDct1BbmDgylu7VfwZRL3dOeWKvuz 9Y+ML7g5bftzxsp5hsw2adjNiVI4Y15ooq565e/dSRRm4yaCCKG8rftztaUck1wawcmB gBrd+0Y9VWx+oyHAbQAP1P/sjL2AiUt7BiTaA5yAnICCT+7mPCb9Sn0XjCDiAEyK4dkS Bnf4zSCwOTZV2/YzWfjUahbftWQ5BqOUNTDlIJto9SXk/njCBv8wCXVv3QmwvmW2lgQ7 lCAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=vidfdPFx8RpQ5jeRzFfNblR6BSHPgUIExvVZVWInFI4=; b=fsh6t2cHiWZom+Xbbjs+l8KVaL9g5KAAgtoZoSiw9Htbu9MlMRIRPIjNtZ+fn5+25e 3oOxMAymeGUsmEstPz7Roma2oWiCJ4/4qOpsOAHXIY3Gi3bBV/H1BpOLC4cgyvsOw9Wz n2Ox9bsgWNTxyVIFsQ7J39u5/oJs3bQx1VQorc5VCYGUKlgUPksvvHXuES5ZxOx2c+0b J/FroMZ6tK9ATV64O3UUQW3o3FvQ4JJLarlhXhNAo43Zudohgw5t4bpLB1c83JrBHQT6 LJdr94FoREdzWPOZvSKMTUXl3J3tCTjtnfAFDSxMJGl8yOa0J4wOEODOu/C1G+o4D+mI dl+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=clVxDCRi; dkim=pass header.i=@linaro.org header.s=google header.b=QvIChj61; spf=pass (google.com: domain of libc-alpha-return-101006-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101006-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z10si1919965pgu.172.2019.03.29.06.39.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:39:02 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101006-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=clVxDCRi; dkim=pass header.i=@linaro.org header.s=google header.b=QvIChj61; spf=pass (google.com: domain of libc-alpha-return-101006-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101006-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=v9dLIGcUXQiYw1Yl2LbFypAFn97qtku 5SbQ9RcX9qBqsophsJTDtrvb1ePkELyuKno/kFV6XA8K84TTqVUrVGbu+uKYZjoS DxjMeC0np7y5hy2HDOgCz4JBC4BHCXJ3R94+zwB5USOJ0CDHeRKyYkr4OSkx9lh8 zclevtnBWM2w= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=x2JC/sbbUIpM/9Mw16uvZ/Efklw=; b=clVxD CRi3nHQ+asqVedmjmFk38vk7AhplCNW+Ejq8/Vl3kna1Dam5/I8ZBuvejkDryrw1 1Uo59/zTu8HTHxdlV8bce4Czav1qn5qLr2zr7S77FdgBymJ7Z2uz3JOCxqemFJmv W66pbOVYPN0DlLuckeeW8McuAE1CV4O9hev6s0= Received: (qmail 120840 invoked by alias); 29 Mar 2019 13:36:09 -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 120067 invoked by uid 89); 29 Mar 2019 13:36:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=luis, Luis X-HELO: mail-vs1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=vidfdPFx8RpQ5jeRzFfNblR6BSHPgUIExvVZVWInFI4=; b=QvIChj61zwB5shgFTfuRYatSSYbAEirJGhoY5grX5WT21uKlOmiu9KZFBPbM3lheat PBjK1MaCGJTDXGXjAu2ZgT0Ycv1xNdVA4UOtp7DbA4y3tlZPYPwDEEG790PzVl4seZ72 BZAznxdYIBizpc8EGywdTNF+Uh4ddrAY7uqNwM3CXXMiv2xmDVZicXj3obSD29IHW0EZ VyyLwYJtCsFnecnncavAYUp3n5SG8oE0xG9ZA6O1xD/b09cx4syaJOOs2d4suOihXdvf DnKQKwHBaMbjHD1BNXCFT2oHjpCNvC2DOqUSo/kHyfqIprdqDpzhKe/35tUIqdsEn9VZ fzKg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 10/28] powerpc: copysign cleanup Date: Fri, 29 Mar 2019 10:35:11 -0300 Message-Id: <20190329133529.22523-11-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> GCC always expand copysign{f} for all possible cpus, so calling the libm is only done if user explicitly states to disable the builtin (which is usually done not for performance reason). So to provide ifunc variant for copysign only adds complexity for powerpc and powerpc64 and it not required for powerpc64le. This patch removes both powerpc32 and powerpc64 ifunc variants and consolidates the powerpc implementation on sysdeps/powerpc/fpu/s_copysign{f}.c using compiler builtins. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/s_copysign.c: New file. * sysdeps/powerpc/fpu/s_copysignf.c: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_copysignf.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile (sysdep_routines, libm-sysdep_routines): Remove s_copysign-power6 and s_copysign-ppc32. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdeps_calls): Remove s_copysign-power6 s_copysign-ppc64. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_copysignf.S: Likewise. * sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise. * sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S: Likewise. --- sysdeps/powerpc/fpu/s_copysign.c | 32 +++++++++++ sysdeps/powerpc/fpu/s_copysignf.c | 28 ++++++++++ sysdeps/powerpc/powerpc32/fpu/s_copysign.S | 53 ------------------- sysdeps/powerpc/powerpc32/fpu/s_copysignf.S | 1 - .../powerpc32/power4/fpu/multiarch/Makefile | 6 +-- .../power4/fpu/multiarch/s_copysign-power6.S | 33 ------------ .../power4/fpu/multiarch/s_copysign-ppc32.S | 34 ------------ .../power4/fpu/multiarch/s_copysign.c | 45 ---------------- .../power4/fpu/multiarch/s_copysignf.c | 34 ------------ .../powerpc/powerpc32/power6/fpu/s_copysign.S | 49 ----------------- .../powerpc32/power6/fpu/s_copysignf.S | 1 - .../powerpc/powerpc64/fpu/multiarch/Makefile | 3 +- .../fpu/multiarch/s_copysign-power6.S | 32 ----------- .../fpu/multiarch/s_copysign-ppc64.S | 34 ------------ .../powerpc64/fpu/multiarch/s_copysign.c | 45 ---------------- .../powerpc64/fpu/multiarch/s_copysignf.c | 34 ------------ sysdeps/powerpc/powerpc64/fpu/s_copysign.S | 53 ------------------- sysdeps/powerpc/powerpc64/fpu/s_copysignf.S | 1 - .../powerpc/powerpc64/power6/fpu/s_copysign.S | 49 ----------------- .../powerpc64/power6/fpu/s_copysignf.S | 1 - 20 files changed, 64 insertions(+), 504 deletions(-) create mode 100644 sysdeps/powerpc/fpu/s_copysign.c create mode 100644 sysdeps/powerpc/fpu/s_copysignf.c delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_copysign.S delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_copysignf.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_copysign.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_copysignf.S delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/s_copysign.c b/sysdeps/powerpc/fpu/s_copysign.c new file mode 100644 index 0000000000..364242e5d9 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_copysign.c @@ -0,0 +1,32 @@ +/* Copy sign of a number. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include +#include + +double +__copysign (double x, double y) +{ + return __builtin_copysign (x, y); +} +libm_alias_double (__copysign, copysign) +#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +compat_symbol (libc, __copysign, copysignl, GLIBC_2_0); +#endif diff --git a/sysdeps/powerpc/fpu/s_copysignf.c b/sysdeps/powerpc/fpu/s_copysignf.c new file mode 100644 index 0000000000..d423bfa793 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_copysignf.c @@ -0,0 +1,28 @@ +/* Smallest integral value not less than argument. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#include +#include + +float +__copysignf (float x, float y) +{ + return __builtin_copysignf (x, y); +} +libm_alias_float (__copysign, copysign) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S deleted file mode 100644 index fa9e5a2a1a..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S +++ /dev/null @@ -1,53 +0,0 @@ -/* Copy a sign bit between floating-point values. - Copyright (C) 1997-2019 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 - . */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include -#include -#include -#include - -ENTRY(__copysign) -/* double [f1] copysign (double [f1] x, double [f2] y); - copysign(x,y) returns a value with the magnitude of x and - with the sign bit of y. */ - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - stfd fp2,8(r1) - lwz r3,8+HIWORD(r1) - cmpwi r3,0 - addi r1,r1,16 - cfi_adjust_cfa_offset (-16) - blt L(0) - fabs fp1,fp1 - blr -L(0): fnabs fp1,fp1 - blr - END (__copysign) - -libm_alias_double (__copysign, copysign) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__copysign,__copysignf) -libm_alias_float (__copysign, copysign) - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __copysign, copysignl, GLIBC_2_0) -#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc32/fpu/s_copysignf.S deleted file mode 100644 index e05438ae7d..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_copysignf.S +++ /dev/null @@ -1 +0,0 @@ -/* __copysignf is in s_copysign.S */ diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile index cf38e347f2..7008e775b7 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile @@ -2,8 +2,8 @@ ifeq ($(subdir),math) sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ s_isnanf-power6 s_isnanf-power5 s_isinf-power7 \ s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \ - s_finite-ppc32 s_finitef-ppc32 s_copysign-power6 \ - s_copysign-ppc32 s_modf-power5+ s_modf-ppc32 \ + s_finite-ppc32 s_finitef-ppc32 \ + s_modf-power5+ s_modf-ppc32 \ s_modff-power5+ s_modff-ppc32 libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \ @@ -18,7 +18,7 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \ s_floorf-ppc32 s_round-power5+ s_round-ppc32 \ s_roundf-power5+ s_roundf-ppc32 s_trunc-power5+ \ s_trunc-ppc32 s_truncf-power5+ s_truncf-ppc32 \ - s_copysign-power6 s_copysign-ppc32 s_lround-power6x \ + s_lround-power6x \ s_lround-power5+ s_lround-ppc32 s_lrint-power6x \ s_lrint-ppc32 s_modf-power5+ s_modf-ppc32 \ s_modff-power5+ s_modff-ppc32 s_logbl-power7 \ diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S deleted file mode 100644 index 24ab12e41e..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S +++ /dev/null @@ -1,33 +0,0 @@ -/* copysign(). PowerPC32/POWER6 version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __copysign __copysign_power6 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S deleted file mode 100644 index 0c283c65b0..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S +++ /dev/null @@ -1,34 +0,0 @@ -/* copysign(). PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a, b, c, d) - -#define __copysign __copysign_ppc32 -#undef hidden_def -#define hidden_def(name) - strong_alias (__copysign_ppc32, __GI___copysign) - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c deleted file mode 100644 index f9d1795732..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Multiple versions of copysign. - Copyright (C) 2013-2019 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 - . */ - -#define NO_MATH_REDIRECT -/* Redefine copysign so that the compiler won't complain about the type - mismatch with the IFUNC selector in strong_alias below. */ -#undef __copysign -#define __copysign __redirect_copysign -#include -#include -#undef __copysign -#include -#include "init-arch.h" -#include - -extern __typeof (__redirect_copysign) __copysign_ppc32 attribute_hidden; -extern __typeof (__redirect_copysign) __copysign_power6 attribute_hidden; - -extern __typeof (__redirect_copysign) __libm_copysign; -libc_ifunc (__libm_copysign, - (hwcap & PPC_FEATURE_ARCH_2_05) - ? __copysign_power6 - : __copysign_ppc32); - -strong_alias (__libm_copysign, __copysign) -libm_alias_double (__copysign, copysign) - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __copysign, copysignl, GLIBC_2_0); -#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c deleted file mode 100644 index 12354d0872..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Multiple versions of copysignf. - Copyright (C) 2013-2019 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 - . */ - -#define NO_MATH_REDIRECT -#include -#include -#include "init-arch.h" -#include - -/* It's safe to use double-precision implementation for single-precision. */ -extern __typeof (__copysignf) __copysign_ppc32 attribute_hidden; -extern __typeof (__copysignf) __copysign_power6 attribute_hidden; - -libc_ifunc (__copysignf, - (hwcap & PPC_FEATURE_ARCH_2_05) - ? __copysign_power6 - : __copysign_ppc32); - -libm_alias_float (__copysign, copysign) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S deleted file mode 100644 index abf84ca191..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S +++ /dev/null @@ -1,49 +0,0 @@ -/* copysign(). PowerPC32/POWER6 version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include -#include -#include -#include - -/* double [f1] copysign (double [f1] x, double [f2] y); - copysign(x,y) returns a value with the magnitude of x and - with the sign bit of y. */ - - .section ".text" - .type __copysign, @function - .machine power6 -EALIGN (__copysign, 4, 0) - CALL_MCOUNT - fcpsgn fp1,fp2,fp1 - blr -END (__copysign) - -hidden_def (__copysign) -libm_alias_double (__copysign, copysign) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__copysign, __copysignf) -hidden_def (__copysignf) -libm_alias_float (__copysign, copysign) - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, copysign, copysignl, GLIBC_2_0); -#endif diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S deleted file mode 100644 index d4aa702d07..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_copysign.S. */ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 7d469d79af..36d5e65ee1 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -2,8 +2,7 @@ ifeq ($(subdir),math) # These functions are built both for libc and libm because they're required # by printf. While the libc objects have the prefix s_, the libm ones are # prefixed with m_. -sysdep_calls := s_copysign-power6 s_copysign-ppc64 \ - s_finite-power8 s_finite-power7 s_finite-ppc64 \ +sysdep_calls := s_finite-power8 s_finite-power7 s_finite-ppc64 \ s_finitef-ppc64 \ s_isinf-power8 s_isinf-ppc64 \ s_isinff-ppc64 s_isinf-power7 \ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S deleted file mode 100644 index e901cea480..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S +++ /dev/null @@ -1,32 +0,0 @@ -/* copysign(). PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a, b, c, d) -#undef hidden_def -#define hidden_def(name) - -#define __copysign __copysign_power6 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S deleted file mode 100644 index a4a783f3f6..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S +++ /dev/null @@ -1,34 +0,0 @@ -/* copysign(). PowerPC64 default version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a, b, c, d) - -#define __copysign __copysign_ppc64 -#undef hidden_def -#define hidden_def(name) \ - strong_alias (__copysign_ppc64, __GI___copysign) - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c deleted file mode 100644 index 3d7f7f051d..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Multiple versions of copysign. - Copyright (C) 2013-2019 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 - . */ - -#define NO_MATH_REDIRECT -/* Redefine copysign so that the compiler won't complain about the type - mismatch with the IFUNC selector in strong_alias below. */ -#undef __copysign -#define __copysign __redirect_copysign -#include -#include -#undef __copysign -#include -#include "init-arch.h" -#include - -extern __typeof (__redirect_copysign) __copysign_ppc64 attribute_hidden; -extern __typeof (__redirect_copysign) __copysign_power6 attribute_hidden; - -extern __typeof (__redirect_copysign) __libm_copysign; -libc_ifunc (__libm_copysign, - (hwcap & PPC_FEATURE_ARCH_2_05) - ? __copysign_power6 - : __copysign_ppc64); - -strong_alias (__libm_copysign, __copysign) -libm_alias_double (__copysign, copysign) - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __copysign, copysignl, GLIBC_2_0); -#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c deleted file mode 100644 index d20984b01a..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Multiple versions of copysignf. - Copyright (C) 2013-2019 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 - . */ - -#define NO_MATH_REDIRECT -#include -#include -#include "init-arch.h" -#include - -/* It's safe to use double-precision implementation for single-precision. */ -extern __typeof (__copysignf) __copysign_ppc64 attribute_hidden; -extern __typeof (__copysignf) __copysign_power6 attribute_hidden; - -libc_ifunc (__copysignf, - (hwcap & PPC_FEATURE_ARCH_2_05) - ? __copysign_power6 - : __copysign_ppc64); - -libm_alias_float (__copysign, copysign) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S deleted file mode 100644 index bf6283361c..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S +++ /dev/null @@ -1,53 +0,0 @@ -/* Copy a sign bit between floating-point values. PowerPC64 version. - Copyright (C) 1997-2019 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 - . */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include -#include -#include -#include - -ENTRY_TOCLESS (__copysign) - CALL_MCOUNT 0 -/* double [f1] copysign (double [f1] x, double [f2] y); - copysign(x,y) returns a value with the magnitude of x and - with the sign bit of y. */ - stfd fp2,-8(r1) - nop - nop - nop - ld r3,-8(r1) - cmpdi r3,0 - blt L(0) - fabs fp1,fp1 - blr -L(0): fnabs fp1,fp1 - blr - END (__copysign) - -libm_alias_double (__copysign, copysign) - -/* It turns out that it's safe to use this code even for single-precision. */ -strong_alias(__copysign,__copysignf) -libm_alias_float (__copysign, copysign) - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __copysign, copysignl, GLIBC_2_0) -#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc64/fpu/s_copysignf.S deleted file mode 100644 index e05438ae7d..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_copysignf.S +++ /dev/null @@ -1 +0,0 @@ -/* __copysignf is in s_copysign.S */ diff --git a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S deleted file mode 100644 index feba531e5b..0000000000 --- a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S +++ /dev/null @@ -1,49 +0,0 @@ -/* copysign(). PowerPC64/POWER6 version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include -#include -#include -#include - -/* double [f1] copysign (double [f1] x, double [f2] y); - copysign(x,y) returns a value with the magnitude of x and - with the sign bit of y. */ - - .section ".text" - .type __copysign, @function - .machine power6 -ENTRY_TOCLESS (__copysign, 4) - CALL_MCOUNT 0 - fcpsgn fp1,fp2,fp1 - blr -END (__copysign) - -hidden_def (__copysign) -libm_alias_double (__copysign, copysign) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__copysign, __copysignf) -hidden_def (__copysignf) -libm_alias_float (__copysign, copysign) - -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, copysign, copysignl, GLIBC_2_0); -#endif diff --git a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S deleted file mode 100644 index d4aa702d07..0000000000 --- a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_copysign.S. */ From patchwork Fri Mar 29 13:35:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161430 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2050506jan; Fri, 29 Mar 2019 06:37:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxoTCRE4RdphSiyaP+3tv9phb4ueIA5kmv1zfgyh3EyZdV1STEdghmX04BCJC44pVtTO7d X-Received: by 2002:a17:902:599d:: with SMTP id p29mr13891012pli.156.1553866651874; Fri, 29 Mar 2019 06:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866651; cv=none; d=google.com; s=arc-20160816; b=Ht5YuYPnFrFf58a7leWL8tRtqgR8qLR0NelIldrVAov0fhBW4bk+sT5ei8JVq3WM82 GRIIhhzG1ncAOQ5x/GBzVNv/I7bZ+yU7AE6mLhZ5W+Xk5yt/cG8w/NtbLFTeHmu65EIL 07F3VCNFD9BeDwWBRVmqGK1fG1NEqyGCqYpRtTOOfpqaV/oPdqVVneGz587gIFHaCVEE OX1VaJXNLTQiRYOq4X4oQQH4X2vLTY57N4S8VzWrQQS8/oqBmAkis+dklnVox56T00ej MH02OwwPHfX+0kw0AMIC4nAx4RurcSnFtuiD49xDFjdEA77aqswzwFlsQi2tiy9ndhpp BCCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=u/k0wby2Ymif5gYMnVtSF/mDZLo0yU97s3/DQStpuPs=; b=oHL0KqEzBaDTbYe1dGKPZ5wdCNbD2EH29EXUBVsyaG2vk/3XW9qIUPQVTfwaNWgBUS bjlsABt+GYpnF/wsHn9y+BE7nTqYeWfvMsoHva510dQWDAtk+025IVbRj+ot6uFCgA3U 1A+pst3kz5KHJ299Aymn4Ly9JXfujxGc6YHhH+w5pR5iP4IPajl75M+9ZbOENqJFnFzO s+tXn6qqagBy7xIIMGdfIv3mIlWn4QY9rlP5Lw/X3qk4vJhyaJe0OCfD8NQFArKvRjft SrdHWZjPgufoijWHVO3vZGxoCA1RuNjaKHRk5oHRhQu2t9124sZCMPA+KKqnmClwMtnq Zj4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=uqloKmby; dkim=pass header.i=@linaro.org header.s=google header.b=zLdEQ3PP; spf=pass (google.com: domain of libc-alpha-return-100999-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100999-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y9si1787392pgg.15.2019.03.29.06.37.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-100999-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=uqloKmby; dkim=pass header.i=@linaro.org header.s=google header.b=zLdEQ3PP; spf=pass (google.com: domain of libc-alpha-return-100999-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-100999-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=xZUGPP+vSZsz/Ru4VpVF3sefe8N6k1u c6G9w2Y2rBxtx0VFdsFobs2elXTU8c56SXUpsnHKBXirnzospHC97JUSyR5bnX5j oNlNYELiWxRPDd1zV+NMGZ+OsZmbHD3KRtqpw/IqJf+LNI/EGEd4RA/Rduu4eLqt OvNpDEvVkgtU= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=TOPYWmbgkXFpnTIZ1X+xDE/P+VY=; b=uqloK mby5chMKOIN/WyvWP8AODgEgQTg/i/HeNN3EKCDtNDeZ9BDRwU12wSMl/fBNZavV JCvjRn0bqLzYW8b+Gyp8MiaDonBPBkqoQQWTaEpe1Q7l5upyMcT9IKD3K5i/yJV8 bE0aAIZqgy1T/6gOr1RkO47mc2weZ+vATC6o68= Received: (qmail 119505 invoked by alias); 29 Mar 2019 13:35:54 -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 119421 invoked by uid 89); 29 Mar 2019 13:35:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=nan, log2 X-HELO: mail-vs1-f44.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=u/k0wby2Ymif5gYMnVtSF/mDZLo0yU97s3/DQStpuPs=; b=zLdEQ3PP76A5YRG3FkI5pns+cmUlnBEg8O54z8NOsponVpH1Jsdr5EMPbZm3oj6e/2 h4V6MrnXJKpF+WwVHfFbR6faRom+/hFT9h//wteIkoaGvb3i5Z2ulcd2giqq5JsCvHdR w/PSSVuYHHzkj05DOyhIQcY9G2dJHksEK+t6X+OWNVlSjiWoOsNuYOf7VFsCew1bxaq7 SxZ7nEBjVkKMjVxSYKUsB72S8xarC956bY+zYMawFm3EZRrpjp1Vw27tx1QbE995jQQa u5SaZGdSa6Uh4D69MrbdEleX4MYHg6GCK7Mfyc48gy+Omu0k9HnNPrNCUJ8mBYTU8jDZ yllQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 11/28] benchtests: Add isnan/isinf/isfinite benchmark Date: Fri, 29 Mar 2019 10:35:12 -0300 Message-Id: <20190329133529.22523-12-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * benchtests/Makefile (bench-math): Add isnan, isinf, and isfinite. (CFLAGS-bench-isnan.c, CFLAGS-bench-isinf.c, CFLAGS-bench-isfinite.c): New rule. * benchtests/isnan-input: New file. * benchtests/isinf-input: New file. * benchtests/isfinite-input: New file. --- benchtests/Makefile | 5 ++++- benchtests/isfinite-inputs | 21 +++++++++++++++++++++ benchtests/isinf-inputs | 21 +++++++++++++++++++++ benchtests/isnan-inputs | 21 +++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 benchtests/isfinite-inputs create mode 100644 benchtests/isinf-inputs create mode 100644 benchtests/isnan-inputs -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/benchtests/Makefile b/benchtests/Makefile index cdc89488d6..42bf13b27f 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -24,7 +24,7 @@ include ../Makeconfig bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \ modf pow rint sin sincos sinh sqrt tan tanh fmin fmax fminf \ fmaxf powf trunc truncf expf exp2f logf log2f sincosf sinf \ - cosf + cosf isnan isinf isfinite bench-pthread := pthread_once thread_create @@ -88,6 +88,9 @@ CFLAGS-bench-fmax.c += -fno-builtin CFLAGS-bench-fmaxf.c += -fno-builtin CFLAGS-bench-trunc.c += -fno-builtin CFLAGS-bench-truncf.c += -fno-builtin +CFLAGS-bench-isnan.c += -fsignaling-nans +CFLAGS-bench-isinf.c += -fsignaling-nans +CFLAGS-bench-isfinite.c += -fsignaling-nans ifeq (${BENCHSET},) bench-malloc := malloc-thread malloc-simple diff --git a/benchtests/isfinite-inputs b/benchtests/isfinite-inputs new file mode 100644 index 0000000000..35a887c9df --- /dev/null +++ b/benchtests/isfinite-inputs @@ -0,0 +1,21 @@ +## includes: math.h +## args: double +## ret: int +0.9 +2.3 +3.7 +3.9 +4.0 +4.7 +5.9 +0x1.000000cf4a2a1p0 +0x1.0000010b239a8p0 +0x1.00000162a932ap0 +0x1.000002d452a11p0 +0x1.000005bc7d86cp0 +## name: INF +__builtin_inf () +-__builtin_inf () +## name: NAN +__builtin_nan ("") +__builtin_nans ("") diff --git a/benchtests/isinf-inputs b/benchtests/isinf-inputs new file mode 100644 index 0000000000..35a887c9df --- /dev/null +++ b/benchtests/isinf-inputs @@ -0,0 +1,21 @@ +## includes: math.h +## args: double +## ret: int +0.9 +2.3 +3.7 +3.9 +4.0 +4.7 +5.9 +0x1.000000cf4a2a1p0 +0x1.0000010b239a8p0 +0x1.00000162a932ap0 +0x1.000002d452a11p0 +0x1.000005bc7d86cp0 +## name: INF +__builtin_inf () +-__builtin_inf () +## name: NAN +__builtin_nan ("") +__builtin_nans ("") diff --git a/benchtests/isnan-inputs b/benchtests/isnan-inputs new file mode 100644 index 0000000000..35a887c9df --- /dev/null +++ b/benchtests/isnan-inputs @@ -0,0 +1,21 @@ +## includes: math.h +## args: double +## ret: int +0.9 +2.3 +3.7 +3.9 +4.0 +4.7 +5.9 +0x1.000000cf4a2a1p0 +0x1.0000010b239a8p0 +0x1.00000162a932ap0 +0x1.000002d452a11p0 +0x1.000005bc7d86cp0 +## name: INF +__builtin_inf () +-__builtin_inf () +## name: NAN +__builtin_nan ("") +__builtin_nans ("") From patchwork Fri Mar 29 13:35:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161434 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2051510jan; Fri, 29 Mar 2019 06:38:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmOMComsV/e6CEE5ai7JNYazBgCZn30QmID2kk3cIMqQ6jxaCzj/EJtKjR6PKm8fhuXnSY X-Received: by 2002:a63:c706:: with SMTP id n6mr12164858pgg.310.1553866705598; Fri, 29 Mar 2019 06:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866705; cv=none; d=google.com; s=arc-20160816; b=YQT7TL1DNZBdm9HDZNtqTG8Ti3TIQKT2IdFJ2zPhkAZrAaWZbu1QWw5nA5I5BGQOfm 7ot3EgvyDMNrbbZmp3EsrE3jyL7EgV2LiSu/9FRvc/hxSKKcJClkz5V8FwNhtqFD0xyv 1DUJNr0cArHhTNAQgijrt+4Ze3YmOfhkFQwOd6cQbm3bI9gWpOdK744FsahwaIIAZXgN lFW4MQS+ZBHWPlFfJ0wkMSEpqkpFAPiym1Y9q0u6XqUe+ADG9xmBSqZ8qyalJKAsdanl tokTECzwl46/q9+riwYorBZesLrNtM3NPHQkJpvqYVfGm+Vae9QfiPWqEnCMo5HDiKvc JrMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=mYTcdew2Ic29b/S82vjskdmY9ntp5KJcByrrKIqH06o=; b=lU8COHv/W0/p4RRK4TCUkIh3Xb1E3crJQCRLlmibS7GWLCkMBoOGtRyuOCBET4pkNt J24Pyx8sHDiVd+lwHk/7dAOhjgLat9SuJMcPsLDJhwe1wYo2ffU4u0eG1D+Log5XzA7g Zv18hDjPEld9+/0lE1ADiHSvNp6o+FUPhefbVGzvug2s30/TpiPdERMbysNwhjcIJb+F WjRuCI2EdXkh+Z9N9glpUZgiavNEsODwuC7seZYvQGPejuDLUD9yMRzdEucU5MnwK0t3 IKOFYaOfXaUCjs33BEpOZqRDTgREi6hBK028PjKMNizRrxSXKTIzO6m8UwwWpd6Hf8Ij 1k+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=BNfV38aG; dkim=pass header.i=@linaro.org header.s=google header.b=rILlrctt; spf=pass (google.com: domain of libc-alpha-return-101003-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101003-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y18si1901341pll.172.2019.03.29.06.38.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:38:25 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101003-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=BNfV38aG; dkim=pass header.i=@linaro.org header.s=google header.b=rILlrctt; spf=pass (google.com: domain of libc-alpha-return-101003-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101003-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=NKIhXT8r5T5u6mxcICC/8ntwlJMV89+ LjDfZ3GPJindJpuvlZvhY/y34c/8vnst9ZMq18dvYw/jSSkUGFV5Y/S45Lvn8Tro gIDhUxPvjy98wUK9OGhSsPiAUnEMnGMv7yPjoqYRkpqwIYS2DMvvrCpcAe4CYMOC sQZJCLo1wKBQ= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=T+wt992DcRKgkLo8vF8edkAgWYY=; b=BNfV3 8aGZeuPexrewfTSgzVzTYjtJ94V4a1HemX764bR22iF3wszqw+Wl5n4IXvJzM04L 9KoKbYrMYT/drS/HQl0EANTgPBYJrk4Dxal2/mxsFZwwD2MXY+hZmFsX/TOPCcvK UqJK3HQgg/zBO7Rk6/pil2j1oEW5ArvbC6168Q= Received: (qmail 120141 invoked by alias); 29 Mar 2019 13:36:01 -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 119617 invoked by uid 89); 29 Mar 2019 13:35:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=business, rights X-HELO: mail-ua1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=mYTcdew2Ic29b/S82vjskdmY9ntp5KJcByrrKIqH06o=; b=rILlrctt7uPlHkA66Lz2zoqiUf6bX1v1/wqMJw1i/u9Ls9M334RPiAf/j+EydLe2r8 ndd0nZfBhIe3ooaqNyNgMD7lu8nn1nSYI7wMjXdWKtIKG7qp+dNC+cqlow/CKVmG8h/K Oxh7fSxoTv6vDm9ieNXoU1EpponHMX/M8FmQoitR178VpOuvKzHVttleU8oN4m9SSP92 /olA6TD4vAZWvsvuO52rh7dp5SGPT9IjA080xyNDX2ody6gUvDchTEec3VIeqkokzidS hLbpbiilRJbzkyk/dth+8DYgZ/YyL58r/5eyPJIuKhIGoLP9BNSpmxBxYrmXwy9Ptmcn /c3g== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 12/28] math: Use wordsize-64 version for isnan Date: Fri, 29 Mar 2019 10:35:13 -0300 Message-Id: <20190329133529.22523-13-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> - math.h will use compiler builtin for gcc 4.4+ when built without -fsignaling-nans and the builtin is expanded inline for all supported architectures. As an example, there is no intra isnan call on libm for the architecture I checked (x86, arm, aarch64, and powerpc). - The resulting binary difference on 32 bits architecture is minimum for the non hotspot symbol. - It helps wordsize-64 architectures that use ldbl-opt. - It add some code simplification with reduction of duplicated implementations. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Move to ... * sysdeps/ieee754/dbl-64/s_isnan.c: ... here and format code. --- sysdeps/ieee754/dbl-64/s_isnan.c | 17 +++------ sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c | 40 -------------------- 2 files changed, 6 insertions(+), 51 deletions(-) delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c -- 2.17.1 diff --git a/sysdeps/ieee754/dbl-64/s_isnan.c b/sysdeps/ieee754/dbl-64/s_isnan.c index 82723eeb8a..1f1535dea3 100644 --- a/sysdeps/ieee754/dbl-64/s_isnan.c +++ b/sysdeps/ieee754/dbl-64/s_isnan.c @@ -10,10 +10,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $"; -#endif - /* * isnan(x) returns 1 is x is nan, else 0; * no branching! @@ -23,17 +19,16 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $"; #include #include #include +#include -#undef __isnan int __isnan (double x) { - int32_t hx, lx; - EXTRACT_WORDS (hx, lx, x); - hx &= 0x7fffffff; - hx |= (uint32_t) (lx | (-lx)) >> 31; - hx = 0x7ff00000 - hx; - return (int) (((uint32_t) hx) >> 31); + int64_t hx; + EXTRACT_WORDS64 (hx, x); + hx &= UINT64_C (0x7fffffffffffffff); + hx = UINT64_C (0x7ff0000000000000) - hx; + return (int)(((uint64_t)hx)>>63); } hidden_def (__isnan) weak_alias (__isnan, isnan) diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c deleted file mode 100644 index cd805d157b..0000000000 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c +++ /dev/null @@ -1,40 +0,0 @@ -/* @(#)s_isnan.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - * isnan(x) returns 1 is x is nan, else 0; - * no branching! - */ - -#include -#include -#include -#include -#include - -#undef __isnan -int __isnan(double x) -{ - int64_t hx; - EXTRACT_WORDS64(hx,x); - hx &= UINT64_C(0x7fffffffffffffff); - hx = UINT64_C(0x7ff0000000000000) - hx; - return (int)(((uint64_t)hx)>>63); -} -hidden_def (__isnan) -weak_alias (__isnan, isnan) -#ifdef NO_LONG_DOUBLE -# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -# endif -weak_alias (__isnan, isnanl) -#endif From patchwork Fri Mar 29 13:35:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161444 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2054021jan; Fri, 29 Mar 2019 06:40:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqynzsJ3hNmIt/e2VEyeqSgvSgsBa16oZv7sbnsdYW/BVKxXxyjV4qhhOQXQAwFyu0aUFmff X-Received: by 2002:a62:1690:: with SMTP id 138mr8204951pfw.28.1553866836578; Fri, 29 Mar 2019 06:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866836; cv=none; d=google.com; s=arc-20160816; b=Bz/z0vhMF/aZOxQnXSTicyV3/HZhza4jEfnyoDPo0EWMMWvhnNVh3s2y+dWO3GYZqz KSnoDpg3okSTasHdA0nRpuLnH5igNHaHa2hJed+lBX+8+krmZAI+QdQnjan0DT0ff3Iq MNSG2w8yy2SuJ/Hoz0+qDeUjyNtwLOITh+xrkDSWpuBAiohTI1T/gM0zdICi/VKvUmXq F9KZFDsfr70dEOyXvrxSWKPeIPM/xTmOm6f4VsBR09uPgV7lPGSrTWAPldAVazA0dyoW WxY9DOcW/keR9AxqDv7OSuSATfIC2lUqHHHuQmANG2onvKzqI7a+9hh/B6ndM2DHptgW dEkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=166YtZCF0/iVabKtGZHptVgbLcT5DEYE0b9e4gY7rFE=; b=0D4uKN4Jijpygx0bSJ4xSCffiE7xOvGOttGYzwr08FyJZ1ZkjnpZOVlMvq2n3CO/4S RYrd9rPMXhOkvOxi4aOjndnqzBzyqrj3DoZIWXTVfU2VFtYs0UqbzT0LfSB0SxaZzgUv iVv2sdQls7Eqvd41ElPp848FrSPf0gpOvMwIz3it7EngJjeUF4EFpTj1lCiJmAGoAYGE HbzE4DLBu9b/4EHfmqitAGfppZN4Cxo5iiypAneC04ofsFkRWKy5wmaSqqwmegf79UoK 5GoLBX9UIhCpp08RpgKz8SEk099E07qVwNY/cO9O8Y2DFv/BMOPWjZCu/mXJsPXNrgcr pi+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Rdncohmt; dkim=pass header.i=@linaro.org header.s=google header.b=DPw8ICLM; spf=pass (google.com: domain of libc-alpha-return-101013-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101013-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id f7si2030295pfa.50.2019.03.29.06.40.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:40:36 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101013-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Rdncohmt; dkim=pass header.i=@linaro.org header.s=google header.b=DPw8ICLM; spf=pass (google.com: domain of libc-alpha-return-101013-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101013-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=M9maDTygBOW7dLhfctJoABw53uE9CTZ Nge7iYTD0qsvHNl3fCBebUoR4QTpQox2cwLOeb8XVLY0rZaLPDj2Mx4l8DUe70bz q97PYu7oTA+MPL1a2D2EwFvqsrUN2iowOvYcsnKrQzYGRrfVPk1+zlvUHH7TqIln i8BXGvlQKBwE= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=IFNOj3iq1IsyFI41jkptj7ijqpE=; b=Rdnco hmtPuwN18A6a8+vBYohDIlcLMiWeTxRXv9LFLWnPydxCIde2UVhT9SRH63ImTDTs 7Hjw+1DdSEexsTvKVrqH4RNyPCBick5msk8YsQtgv0FhEyx1fUZuPsks7v0CI7b1 LpWt+kH5JeZHLi3CQmYyeO0rWNK0MJpZBGNlqM= Received: (qmail 123086 invoked by alias); 29 Mar 2019 13:36:32 -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 120980 invoked by uid 89); 29 Mar 2019 13:36:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=flushing, luis, Luis X-HELO: mail-ua1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=166YtZCF0/iVabKtGZHptVgbLcT5DEYE0b9e4gY7rFE=; b=DPw8ICLMOFyufyZUObzXn+HLlB0fhmHC5l6/FsFrNO3VRVs4dnNJVCHE/pSFu5vWN1 nWIb7UJj32uZFahLibXmKdHaBCBEV8yMtJJjd+XeRMymA9tnwfbvSi7R8NztAQFttjFW B/l4ctEKFSXel8RwmhoXjKEeog/6KfZOAM+xudusnXiBJsW02QIhGQ+xJK9X4mTeV1JD gAzJMCLBy5QZ4T8Nf/taXNKN6jWrdtqYkDnfxcEROBdxYfKHD0klz0U02RbqztfDUuOw mTNPSig4kqX5tKm6QYltveapapSUcyCERObhDr4HaOOJ9y4Dm7fvS0ZwfEuygLtsrI8E cyLg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 13/28] powerpc: Remove optimized isnan Date: Fri, 29 Mar 2019 10:35:14 -0300 Message-Id: <20190329133529.22523-14-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> The powerpc isnan optimizations are not really a gain: - GCC will call libm iff -fsignaling-nans is used. This usage pattern is usually not performance oriented and for such calls PLT overhead should dominate execution time. - The power5, power6, and power6x are just micro-optimization to improve the Load-Hit-Store hazards from floating-point to general register transfer, and current GCC already has support to minimize it by inserting either extra nops or group dispatch instructions. - The power7 uses ftdiv to optimize for some input patterns, but at cost of others. Comparing against generic C implementation built for powerpc-linux-gnu-power4 (which uses the hp-timing support on benchtests): - Generic sysdeps/ieee754 implementation: "isnan": { "": { "duration": 4.98415e+09, "iterations": 2.34516e+09, "max": 45.925, "min": 2.052, "mean": 2.12529 }, "INF": { "duration": 4.74057e+09, "iterations": 1.69761e+09, "max": 91.01, "min": 2.052, "mean": 2.79249 }, "NAN": { "duration": 4.74071e+09, "iterations": 1.68768e+09, "max": 282.343, "min": 2.052, "mean": 2.809 } } - power7 optimized one: $ ./testrun.sh benchtests/bench-isnan "isnan": { "": { "duration": 4.96842e+09, "iterations": 2.56297e+09, "max": 50.048, "min": 1.872, "mean": 1.93854 }, "INF": { "duration": 4.76648e+09, "iterations": 1.54213e+09, "max": 373.408, "min": 2.661, "mean": 3.09084 }, "NAN": { "duration": 4.76845e+09, "iterations": 1.54515e+09, "max": 51.016, "min": 2.736, "mean": 3.08607 } } So it basically optimizes marginally for normal numbers while increasing the latency for other kind of FP. - The generic implementation requires getting the floating point status, disable the invalid operation bit, and restore the floating-point status. Each operation is costly and requires flushing the FP pipeline. Using the same scenarion for the previous analysis: "isnan": { "": { "duration": 5.08284e+09, "iterations": 6.2898e+08, "max": 41.844, "min": 8.057, "mean": 8.08108 }, "INF": { "duration": 4.97904e+09, "iterations": 6.16176e+08, "max": 39.661, "min": 8.057, "mean": 8.08055 }, "NAN": { "duration": 4.98695e+09, "iterations": 5.95866e+08, "max": 29.728, "min": 8.345, "mean": 8.36925 } } - The power8 implementation is just the generic implementation using ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation). So generic implementation already generates best code for powerpc64le. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/s_isnan.c: Remove file. * sysdeps/powerpc/fpu/s_isnanf.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/x/powerpc32/power4/fpu/multiarch/Makefile (sysdeps_routines): Remove s_isnan-* objects. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S: Remove file * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c: Likewise. * sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdep_calls): Remove s_isnan-* objects. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S: Likewise. --- sysdeps/powerpc/fpu/s_isnan.c | 62 ------------- sysdeps/powerpc/fpu/s_isnanf.S | 1 - sysdeps/powerpc/powerpc32/fpu/s_isnan.S | 57 ------------ .../powerpc32/power4/fpu/multiarch/Makefile | 7 +- .../power4/fpu/multiarch/s_isnan-power5.S | 33 ------- .../power4/fpu/multiarch/s_isnan-power6.S | 33 ------- .../power4/fpu/multiarch/s_isnan-power7.S | 33 ------- .../power4/fpu/multiarch/s_isnan-ppc32.S | 32 ------- .../powerpc32/power4/fpu/multiarch/s_isnan.c | 56 ------------ .../power4/fpu/multiarch/s_isnanf-power5.S | 28 ------ .../power4/fpu/multiarch/s_isnanf-power6.S | 28 ------ .../powerpc32/power4/fpu/multiarch/s_isnanf.c | 39 -------- .../powerpc/powerpc32/power5/fpu/s_isnan.S | 61 ------------- .../powerpc/powerpc32/power5/fpu/s_isnanf.S | 45 ---------- .../powerpc/powerpc32/power6/fpu/s_isnan.S | 61 ------------- .../powerpc/powerpc32/power6/fpu/s_isnanf.S | 44 --------- .../powerpc/powerpc32/power7/fpu/s_isnan.S | 90 ------------------- .../powerpc/powerpc32/power7/fpu/s_isnanf.S | 1 - .../powerpc/powerpc64/fpu/multiarch/Makefile | 2 - .../powerpc64/fpu/multiarch/s_isnan-power5.S | 32 ------- .../powerpc64/fpu/multiarch/s_isnan-power6.S | 32 ------- .../powerpc64/fpu/multiarch/s_isnan-power6x.S | 32 ------- .../powerpc64/fpu/multiarch/s_isnan-power7.S | 32 ------- .../powerpc64/fpu/multiarch/s_isnan-power8.S | 32 ------- .../powerpc64/fpu/multiarch/s_isnan-ppc64.S | 36 -------- .../powerpc/powerpc64/fpu/multiarch/s_isnan.c | 71 --------------- .../powerpc64/fpu/multiarch/s_isnanf.c | 44 --------- sysdeps/powerpc/powerpc64/fpu/s_isnan.S | 56 ------------ .../powerpc/powerpc64/power5/fpu/s_isnan.S | 60 ------------- .../powerpc/powerpc64/power6/fpu/s_isnan.S | 59 ------------ .../powerpc/powerpc64/power6x/fpu/s_isnan.S | 58 ------------ .../powerpc/powerpc64/power7/fpu/s_isnan.S | 68 -------------- .../powerpc/powerpc64/power7/fpu/s_isnanf.S | 1 - .../powerpc/powerpc64/power8/fpu/s_isnan.S | 56 ------------ .../powerpc/powerpc64/power8/fpu/s_isnanf.S | 1 - 35 files changed, 2 insertions(+), 1381 deletions(-) delete mode 100644 sysdeps/powerpc/fpu/s_isnan.c delete mode 100644 sysdeps/powerpc/fpu/s_isnanf.S delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c delete mode 100644 sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/s_isnan.c b/sysdeps/powerpc/fpu/s_isnan.c deleted file mode 100644 index b62c4cbd0f..0000000000 --- a/sysdeps/powerpc/fpu/s_isnan.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Return 1 if argument is a NaN, else 0. - Copyright (C) 1997-2019 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 - . */ - -/* Ugly kludge to avoid declarations. */ -#define __isnanf __Xisnanf -#define isnanf Xisnanf -#define __GI___isnanf __GI___Xisnanf - -#include -#include -#include - -#undef __isnanf -#undef isnanf -#undef __GI___isnanf - - -/* The hidden_proto in include/math.h was obscured by the macro hackery. */ -__typeof (__isnan) __isnanf; -hidden_proto (__isnanf) - - -int -__isnan (double x) -{ - fenv_t savedstate; - int result; - savedstate = fegetenv_register (); - reset_fpscr_bit (FPSCR_VE); - result = !(x == x); - fesetenv_register (savedstate); - return result; -} -hidden_def (__isnan) -weak_alias (__isnan, isnan) - - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif diff --git a/sysdeps/powerpc/fpu/s_isnanf.S b/sysdeps/powerpc/fpu/s_isnanf.S deleted file mode 100644 index fc22f678a1..0000000000 --- a/sysdeps/powerpc/fpu/s_isnanf.S +++ /dev/null @@ -1 +0,0 @@ -/* __isnanf is in s_isnan.c */ diff --git a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/s_isnan.S deleted file mode 100644 index f28533d40a..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S +++ /dev/null @@ -1,57 +0,0 @@ -/* isnan(). PowerPC32 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .machine power4 -EALIGN (__isnan, 4, 0) - mffs fp0 - mtfsb0 4*cr6+lt /* reset_fpscr_bit (FPSCR_VE) */ - fcmpu cr7,fp1,fp1 - mtfsf 255,fp0 - li r3,0 - beqlr+ cr7 /* (x == x) then not a NAN */ - li r3,1 /* else must be a NAN */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -#ifndef __isnan -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) -#endif - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile index 7008e775b7..0b39461a1a 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile @@ -1,6 +1,5 @@ ifeq ($(subdir),math) -sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ - s_isnanf-power6 s_isnanf-power5 s_isinf-power7 \ +sysdep_routines += s_isinf-power7 \ s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \ s_finite-ppc32 s_finitef-ppc32 \ s_modf-power5+ s_modf-ppc32 \ @@ -8,9 +7,7 @@ sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \ s_llrint-ppc32 s_llround-power6 s_llround-power5+ \ - s_llround-ppc32 s_isnan-power7 \ - s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \ - s_isnanf-power6 s_isnanf-power5 s_isinf-power7 \ + s_llround-ppc32 s_isinf-power7 \ s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \ s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \ s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \ diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S deleted file mode 100644 index b4bb2bd4bf..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S +++ /dev/null @@ -1,33 +0,0 @@ -/* isnan(). PowerPC32/POWER5 version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __isnan __isnan_power5 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S deleted file mode 100644 index c8a429b1e6..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S +++ /dev/null @@ -1,33 +0,0 @@ -/* isnan(). PowerPC32/POWER6 version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __isnan __isnan_power6 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S deleted file mode 100644 index ae3fc0539b..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S +++ /dev/null @@ -1,33 +0,0 @@ -/* isnan(). PowerPC32/POWER7 version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __isnan __isnan_power7 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S deleted file mode 100644 index 4b204ae6cf..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a, b) -#undef compat_symbol -#define compat_symbol(a, b, c, d) - -#define __isnan __isnan_ppc32 -#undef hidden_def -#define hidden_def(name) - strong_alias (__isnan_ppc32, __GI___isnan) - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c deleted file mode 100644 index 8a7c31f998..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Multiple versions of isnan. - Copyright (C) 2013-2019 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 - . */ - -#define __isnan __redirect___isnan -#define __isnanf __redirect___isnanf -#define __isnanl __redirect___isnanl -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__isnan) __isnan_ppc32 attribute_hidden; -extern __typeof (__isnan) __isnan_power5 attribute_hidden; -extern __typeof (__isnan) __isnan_power6 attribute_hidden; -extern __typeof (__isnan) __isnan_power7 attribute_hidden; -#undef __isnan -#undef __isnanf -#undef __isnanl - -libc_ifunc_redirected (__redirect___isnan, __isnan, - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __isnan_power7 - : (hwcap & PPC_FEATURE_ARCH_2_05) - ? __isnan_power6 - : (hwcap & PPC_FEATURE_POWER5) - ? __isnan_power5 - : __isnan_ppc32); - -weak_alias (__isnan, isnan) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S deleted file mode 100644 index c456d82999..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S +++ /dev/null @@ -1,28 +0,0 @@ -/* isnanf(). PowerPC32/POWER5 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) - -#define __isnanf __isnanf_power5 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S deleted file mode 100644 index 0133cf218f..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S +++ /dev/null @@ -1,28 +0,0 @@ -/* isnanf(). PowerPC32/POWER6 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) - -#define __isnanf __isnanf_power6 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c deleted file mode 100644 index acb84dbc61..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Multiple versions of isnanf. - Copyright (C) 2013-2019 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 - . */ - -#include -#include -#include "init-arch.h" - -/* Both ppc32 and power7 isnan(double) work for float. */ -extern __typeof (__isnanf) __isnan_ppc32 attribute_hidden; -extern __typeof (__isnanf) __isnanf_power5 attribute_hidden; -extern __typeof (__isnanf) __isnanf_power6 attribute_hidden; -extern __typeof (__isnanf) __isnan_power7 attribute_hidden; - -libc_ifunc_hidden (__isnanf, __isnanf, - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __isnan_power7 - : (hwcap & PPC_FEATURE_ARCH_2_05) - ? __isnanf_power6 - : (hwcap & PPC_FEATURE_POWER5) - ? __isnanf_power5 - : __isnan_ppc32); - -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S deleted file mode 100644 index 1326973bfc..0000000000 --- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S +++ /dev/null @@ -1,61 +0,0 @@ -/* isnan(). PowerPC32 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .machine power5 -EALIGN (__isnan, 4, 0) - stwu r1,-32(r1) - cfi_adjust_cfa_offset (32) - ori r1,r1,0 - stfd fp1,24(r1) /* copy FPR to GPR */ - ori r1,r1,0 - lwz r4,24+HIWORD(r1) - lwz r5,24+LOWORD(r1) - lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */ - clrlwi r4,r4,1 /* x = fabs(x) */ - cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */ - cmpwi cr6,r5,0 - li r3,0 /* then return 0 */ - addi r1,r1,32 - cfi_adjust_cfa_offset (-32) - bltlr+ cr7 - bgt- cr7,L(NaN) - beqlr+ cr6 -L(NaN): - li r3,1 /* else return 1 */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S deleted file mode 100644 index 1cc495f3a8..0000000000 --- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S +++ /dev/null @@ -1,45 +0,0 @@ -/* isnan(). PowerPC32 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnanf(x) */ - .machine power5 -EALIGN (__isnanf, 4, 0) - stwu r1,-32(r1) - cfi_adjust_cfa_offset (32) - stfs fp1,28(r1) /* copy FPR to GPR */ - nop - nop - lwz r4,28(r1) - lis r0,0x7f80 /* const long r0 0x7f800000 */ - clrlwi r4,r4,1 /* x = fabs(x) */ - cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */ - li r3,0 /* then return 0 */ - addi r1,r1,32 - cfi_adjust_cfa_offset (-32) - blelr+ cr7 -L(NaN): - li r3,1 /* else return 1 */ - blr - END (__isnanf) - -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S deleted file mode 100644 index d283682a71..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S +++ /dev/null @@ -1,61 +0,0 @@ -/* isnan(). PowerPC32 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .machine power6 -EALIGN (__isnan, 4, 0) - stwu r1,-32(r1) - cfi_adjust_cfa_offset (32) - ori r1,r1,0 - stfd fp1,24(r1) /* copy FPR to GPR */ - ori r1,r1,0 - lwz r4,24+HIWORD(r1) - lwz r5,24+LOWORD(r1) - lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */ - clrlwi r4,r4,1 /* x = fabs(x) */ - cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */ - cmpwi cr6,r5,0 - li r3,0 /* then return 0 */ - addi r1,r1,32 - cfi_adjust_cfa_offset (-32) - bltlr+ cr7 - bgt- cr7,L(NaN) - beqlr+ cr6 -L(NaN): - li r3,1 /* else return 1 */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S deleted file mode 100644 index 6e61471cf0..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S +++ /dev/null @@ -1,44 +0,0 @@ -/* isnanf(). PowerPC32 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnanf(x) */ - .machine power6 -EALIGN (__isnanf, 4, 0) - stwu r1,-32(r1) - cfi_adjust_cfa_offset (32) - ori r1,r1,0 - stfs fp1,24(r1) /* copy FPR to GPR */ - ori r1,r1,0 - lwz r4,24(r1) - lis r0,0x7f80 /* const long r0 0x7f800000 */ - clrlwi r4,r4,1 /* x = fabs(x) */ - cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */ - li r3,0 /* then return 0 */ - addi r1,r1,32 - cfi_adjust_cfa_offset (-32) - blelr+ cr7 -L(NaN): - li r3,1 /* else return 1 */ - blr - END (__isnanf) - -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S deleted file mode 100644 index 524a4a6a32..0000000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S +++ /dev/null @@ -1,90 +0,0 @@ -/* isnan(). PowerPC32/POWER7 version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .section .rodata.cst8,"aM",@progbits,8 - .align 3 -.LC0: /* 1.0 */ - .quad 0x3ff0000000000000 - - .section ".text" - .type __isnan, @function - .machine power7 -ENTRY (__isnan) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfd fp0,.LC0-got_label@l(r9) - - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfd fp0,.LC0@l(r9) -#endif - ftdiv cr7,fp1,fp0 - li r3,0 - bflr 30 /* If not NaN or Inf, finish. */ - - /* We have -INF/+INF/NaN or a denormal. */ - - stwu r1,-16(r1) /* Allocate stack space. */ - stfd fp1,8(r1) /* Transfer FP to GPR's. */ - ori 2,2,0 /* Force a new dispatch group. */ - lwz r4,8+HIWORD(r1) /* Load the upper half of the FP value. */ - lwz r5,8+LOWORD(r1) /* Load the lower half of the FP value. */ - addi r1,r1,16 /* Reset the stack pointer. */ - lis r0,0x7ff0 /* Load the upper portion for an INF/NaN. */ - clrlwi r4,r4,1 /* r4 = abs(r4). */ - cmpw cr7,r4,r0 /* if (abs(r4) <= inf). */ - cmpwi cr6,r5,0 /* r5 == 0x00000000? */ - bltlr cr7 /* LT means we have a denormal. */ - bgt cr7,L(NaN) /* GT means we have a NaN. */ - beqlr cr6 /* EQ means we have +/-INF. */ -L(NaN): - li r3,1 /* x == NaN? */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S deleted file mode 100644 index b48c85e0d3..0000000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_isnan.S. */ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 36d5e65ee1..a0b5939abe 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -6,8 +6,6 @@ sysdep_calls := s_finite-power8 s_finite-power7 s_finite-ppc64 \ s_finitef-ppc64 \ s_isinf-power8 s_isinf-ppc64 \ s_isinff-ppc64 s_isinf-power7 \ - s_isnan-power8 s_isnan-power7 s_isnan-power6x s_isnan-power6 \ - s_isnan-power5 s_isnan-ppc64 \ s_modf-power5+ s_modf-ppc64 \ s_modff-power5+ s_modff-ppc64 diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S deleted file mode 100644 index 949c51ed12..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER5 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __isnan __isnan_power5 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S deleted file mode 100644 index e946d78c75..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER6 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __isnan __isnan_power6 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S deleted file mode 100644 index 00016225eb..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER6X version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __isnan __isnan_power6x - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S deleted file mode 100644 index f32b1feaca..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER7 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __isnan __isnan_power7 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S deleted file mode 100644 index 4f292f146c..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER7 version. - Copyright (C) 2014-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __isnan __isnan_power8 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S deleted file mode 100644 index 6c508aea16..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S +++ /dev/null @@ -1,36 +0,0 @@ -/* isnan(). PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - - -#define __isnan __isnan_ppc64 -#ifdef SHARED - #undef hidden_def - #define hidden_def(name) \ - .globl __GI___isnan ; .set __GI___isnan,__isnan_ppc64 -#endif - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c deleted file mode 100644 index 5aa44eab12..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Multiple versions of isnan. - Copyright (C) 2013-2019 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 - . */ - -#define __isnan __redirect___isnan - -/* The following definitions, although not related to the 'double' - version of 'isnan', are required to guarantee macro expansions - (e.g.: from __isnanf to __redirect_isnanf) in include/math.h, thus - compensating for the unintended macro expansions in - math/bits/mathcalls-helper-functions.h. */ -#define __isnanf __redirect___isnanf -#define __isnanl __redirect___isnanl -#define __isnanf128 __redirect___isnanf128 - -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__isnan) __isnan_ppc64 attribute_hidden; -extern __typeof (__isnan) __isnan_power5 attribute_hidden; -extern __typeof (__isnan) __isnan_power6 attribute_hidden; -extern __typeof (__isnan) __isnan_power6x attribute_hidden; -extern __typeof (__isnan) __isnan_power7 attribute_hidden; -extern __typeof (__isnan) __isnan_power8 attribute_hidden; -#undef __isnan -#undef __isnanf -#undef __isnanl -#undef __isnanf128 - -libc_ifunc_redirected (__redirect___isnan, __isnan, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __isnan_power8 - : (hwcap & PPC_FEATURE_ARCH_2_06) - ? __isnan_power7 - : (hwcap & PPC_FEATURE_POWER6_EXT) - ? __isnan_power6x - : (hwcap & PPC_FEATURE_ARCH_2_05) - ? __isnan_power6 - : (hwcap & PPC_FEATURE_POWER5) - ? __isnan_power5 - : __isnan_ppc64); - -weak_alias (__isnan, isnan) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c deleted file mode 100644 index 5d789ce196..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Multiple versions of isnan. - Copyright (C) 2013-2019 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 - . */ - -#include -#include "init-arch.h" - -/* The double-precision implementation also works for the single one. */ -extern __typeof (__isnanf) __isnan_ppc64 attribute_hidden; -extern __typeof (__isnanf) __isnan_power5 attribute_hidden; -extern __typeof (__isnanf) __isnan_power6 attribute_hidden; -extern __typeof (__isnanf) __isnan_power6x attribute_hidden; -extern __typeof (__isnanf) __isnan_power7 attribute_hidden; -extern __typeof (__isnanf) __isnan_power8 attribute_hidden; - -libc_ifunc_hidden (__isnanf, __isnanf, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __isnan_power8 - : (hwcap & PPC_FEATURE_ARCH_2_06) - ? __isnan_power7 - : (hwcap & PPC_FEATURE_POWER6_EXT) - ? __isnan_power6x - : (hwcap & PPC_FEATURE_ARCH_2_05) - ? __isnan_power6 - : (hwcap & PPC_FEATURE_POWER5) - ? __isnan_power5 - : __isnan_ppc64); - -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/fpu/s_isnan.S deleted file mode 100644 index ff52c974f8..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_isnan.S +++ /dev/null @@ -1,56 +0,0 @@ -/* isnan(). PowerPC64 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .machine power4 -ENTRY_TOCLESS (__isnan, 4) - CALL_MCOUNT 0 - mffs fp0 - mtfsb0 4*cr6+lt /* reset_fpscr_bit (FPSCR_VE) */ - fcmpu cr7,fp1,fp1 - mtfsf 255,fp0 - li r3,0 - beqlr+ cr7 /* (x == x) then not a NAN */ - li r3,1 /* else must be a NAN */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - diff --git a/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S deleted file mode 100644 index d0c7d81942..0000000000 --- a/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S +++ /dev/null @@ -1,60 +0,0 @@ -/* isnan(). PowerPC64 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .machine power5 -ENTRY_TOCLESS (__isnan, 4) - CALL_MCOUNT 0 - stfd fp1,-8(r1) /* copy FPR to GPR */ - lis r0,0x7ff0 - nop /* insure the following is in a different */ - nop /* dispatch group */ - ld r4,-8(r1) - sldi r0,r0,32 /* const long r0 0x7ff00000 00000000 */ - clrldi r4,r4,1 /* x = fabs(x) */ - cmpd cr7,r4,r0 /* if (fabs(x) <= inf) */ - li r3,0 /* then return 0 */ - blelr+ cr7 - li r3,1 /* else return 1 */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - diff --git a/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S deleted file mode 100644 index be1c2c4d04..0000000000 --- a/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S +++ /dev/null @@ -1,59 +0,0 @@ -/* isnan(). PowerPC64 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .machine power6 -ENTRY_TOCLESS (__isnan, 4) - CALL_MCOUNT 0 - stfd fp1,-8(r1) /* copy FPR to GPR */ - ori r1,r1,0 - ld r4,-8(r1) - lis r0,0x7ff0 - sldi r0,r0,32 /* const long r0 0x7ff00000 00000000 */ - clrldi r4,r4,1 /* x = fabs(x) */ - cmpd cr7,r4,r0 /* if (fabs(x) <= inf) */ - li r3,0 /* then return 0 */ - blelr+ cr7 - li r3,1 /* else return 1 */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S deleted file mode 100644 index b32a87a025..0000000000 --- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S +++ /dev/null @@ -1,58 +0,0 @@ -/* isnan(). PowerPC64 version. - Copyright (C) 2008-2019 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .machine power6 -ENTRY_TOCLESS (__isnan, 4) - CALL_MCOUNT 0 - mftgpr r4,fp1 /* copy FPR to GPR */ - lis r0,0x7ff0 - ori r1,r1,0 - clrldi r4,r4,1 /* x = fabs(x) */ - sldi r0,r0,32 /* const long r0 0x7ff00000 00000000 */ - cmpd cr7,r4,r0 /* if (fabs(x) <= inf) */ - li r3,0 /* then return 0 */ - blelr+ cr7 - li r3,1 /* else return 1 */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif - diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S deleted file mode 100644 index f7df57fe6a..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S +++ /dev/null @@ -1,68 +0,0 @@ -/* isnan(). PowerPC64/POWER7 version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include -#include - -/* int __isnan(x) */ - .section ".toc","aw" -.LC0: /* 1.0 */ - .tc FD_ONE[TC],0x3ff0000000000000 - .section ".text" - .type __isnan, @function - .machine power7 -ENTRY (__isnan, 4) - CALL_MCOUNT 0 - lfd fp0,.LC0@toc(r2) - ftdiv cr7,fp1,fp0 - li r3,0 - bflr 30 /* If not NaN, finish. */ - - stfd fp1,-16(r1) /* Transfer FP to GPR's. */ - ori 2,2,0 /* Force a new dispatch group. */ - ld r4,-16(r1) /* Load FP into GPR. */ - lis r0,0x7ff0 - sldi r0,r0,32 /* const long r0 0x7ff00000 00000000. */ - clrldi r4,r4,1 /* x = fabs(x) */ - cmpd cr7,r4,r0 /* if (fabs(x) <= inf) */ - blelr cr7 /* LE means not NaN. */ - li r3,1 /* else return 1 */ - blr - END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S deleted file mode 100644 index b48c85e0d3..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_isnan.S. */ diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S deleted file mode 100644 index b8ee9c7db4..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S +++ /dev/null @@ -1,56 +0,0 @@ -/* isnan(). PowerPC64/POWER8 version. - Copyright (C) 2014-2019 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 - . */ - -#include -#include - -#define MFVSRD_R3_V1 .long 0x7c230066 /* mfvsrd r3,vs1 */ - -/* int [r3] __isnan([f1] x) */ - -ENTRY_TOCLESS (__isnan, 4) - CALL_MCOUNT 0 - MFVSRD_R3_V1 - lis r9,0x7ff0 - clrldi r3,r3,1 /* r3 = r3 & 0x8000000000000000 */ - rldicr r9,r9,32,31 /* r9 = (r9 << 32) & 0xffffffff */ - subf r3,r3,r9 - rldicl r3,r3,1,63 - blr -END (__isnan) - -hidden_def (__isnan) -weak_alias (__isnan, isnan) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isnan, __isnanf) -hidden_def (__isnanf) -weak_alias (__isnanf, isnanf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isnan, __isnanl) -weak_alias (__isnan, isnanl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); -compat_symbol (libc, isnan, isnanl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S deleted file mode 100644 index b48c85e0d3..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_isnan.S. */ From patchwork Fri Mar 29 13:35:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161435 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2051790jan; Fri, 29 Mar 2019 06:38:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfDmq0Yd3tgXiuIhEBY8ZLRKkp8diGM/y4fYPzhP837xXiIKx+zE/hgMEJa29JPXvKI+A0 X-Received: by 2002:a17:902:b618:: with SMTP id b24mr46317591pls.73.1553866717004; Fri, 29 Mar 2019 06:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866717; cv=none; d=google.com; s=arc-20160816; b=OdOh+eaFutp7XR7ef3wuGHaIDDuBOd48MeIYYL6WkaezhjCV43ukNzIeJ8rH9Q8r3T KUIV17WHWb+BHb3qq0JVuuphR41NSyVwAQ6vjPDqBiYKCWywNUKuvInaYhRUfeWbVm/y G27nd2D8kTN9oucFYTLzM3mpVsYV7b9F1iw6US4yIwtIjqFs3e07N/Z05bXdnllfXUX3 pnaoV8P4ijHtpSsJpHK98qCBu/ldmZXGrWd2yy2zndg7S7lso3DYgYUTUWdjvhmxEMq0 X6tG7Ozd4BDWRK5pzjUjjmOghrjT4kCsDN4jHCruzQ/6pK5al8ZvTEkG0KYYE7gJdbw3 29aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=VjU+mKSmIL4/yertS7YsX/urTvrgyiD9oMpMq4KX6D0=; b=X9vra5gfFhV6SBo07tsn3LkbAg4FOKHH/iMsXcoEt0VCHgBil/kvBSdK2UPOHtj/6S rbolVGksLBKn7ahA/ezELvnTNQrQ1eQrkkOLgIOTQIzR1N3tzsqowVO2NMhI5T/PuLkU OXxeaq9OfpDG7ciIwHSoFfzamNyiT5LtLo/ozZD6miLsB/03hVFNxf5eXeEvqROTqYEJ oZOU5PvdWOpeX9WbUWoeTGqbEvaXczc275SL4e91o+4PPjJ3Y4YHV1e/BJ8vIu7vkBFN K7KDr6O4IOVInUWVDkDIUMfuSYQ9wUyXQDwxLgSfrQ9cNXJ13OKu6vUEjgy3pDVoRhmn bddA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="K/RqTuct"; dkim=pass header.i=@linaro.org header.s=google header.b=RShaAOEo; spf=pass (google.com: domain of libc-alpha-return-101004-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101004-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g5si1896491pgk.402.2019.03.29.06.38.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:38:36 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101004-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="K/RqTuct"; dkim=pass header.i=@linaro.org header.s=google header.b=RShaAOEo; spf=pass (google.com: domain of libc-alpha-return-101004-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101004-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=F0H9T+3NoaXtG0wenoi1vfJF2pXQZ/+ WNEklhha9lteKXG0+SKUTc7co1ut4+g+U6Z4oag/xW2fn+gkuSEm+2CjwL+2o6RO a4dhqwlqFLo9rej9T0WD47aoQxYxHf+IzjyfPnBAoUZxgqXqIgCC6irhpTSiHU7F vJq8n0cbc0/c= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Ea3NaLeyhMMmlFUfHAvahipzPnY=; b=K/RqT uctdlVJ5qGNVcEkKhatNJcqkOeJ2DJQ9FQR7QgXM9yo/Ot8rohKE6btcH/7dx0Rw qFM/Qb4c8kGEVvIbgIfKATPXrBtZCShxweoqRSFnxMdK8+qtAH2qMlH3ymcxzwfr 0FNPW+KS61c8/9ThtEsMFPCWUdJ8df+j1umUcM= Received: (qmail 120193 invoked by alias); 29 Mar 2019 13:36:02 -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 119706 invoked by uid 89); 29 Mar 2019 13:35:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=jt, ulrich, 1, 34, Ulrich X-HELO: mail-vs1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=VjU+mKSmIL4/yertS7YsX/urTvrgyiD9oMpMq4KX6D0=; b=RShaAOEokzrWSWHD++NBzYhauXSvu+FHid34yoSapYI5eGjFeMxGVZxwJ8XxbZXd7d HP6ubJLF/vCXMNcRGB11bYuc+JGf00IzkmpA7BcK6FUO2Gviw9T9v4GNz4ppZ5uJb7Y/ t1SjjUVGXbMRoFFFcz6xLGumZEyYz7jc0AFDyxm5ITA+yk7CtJOFSlaO/JpYpYabz7VZ FiFV+UtXf991DDZmyfnyZHm1ICVI5BXv0UeA5jW6CM626b71TLBBmzE8ATiQzLCALs3J Xh44dDnWj8ePvP/kgF316EXgqwyNeQrMdo5SfH6x2bWXF3PBEMfxz8IilkP7O4CZlt2a n2lg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 14/28] math: Use wordsize-64 version for isinf Date: Fri, 29 Mar 2019 10:35:15 -0300 Message-Id: <20190329133529.22523-15-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> - math.h will use compiler builtin for gcc 4.4+ when built without -fsignaling-nans and the builtin is expanded inline for all supported architectures. As an example, there is no intra isnan call on libm for the architecture I checked (x86, arm, aarch64, and powerpc). - The resulting binary difference on 32 bits architecture is minimum for the non hotspot symbol. - It helps wordsize-64 architectures that use ldbl-opt. - It add some code simplification with reduction of duplicated implementations. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: Move to ... * sysdeps/ieee754/dbl-64/s_isinf.c: ... here and format code. --- sysdeps/ieee754/dbl-64/s_isinf.c | 15 ++++----- sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c | 34 -------------------- 2 files changed, 6 insertions(+), 43 deletions(-) delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c -- 2.17.1 diff --git a/sysdeps/ieee754/dbl-64/s_isinf.c b/sysdeps/ieee754/dbl-64/s_isinf.c index 93eb65c147..e5300fd2a5 100644 --- a/sysdeps/ieee754/dbl-64/s_isinf.c +++ b/sysdeps/ieee754/dbl-64/s_isinf.c @@ -4,10 +4,6 @@ * Public domain. */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $"; -#endif - /* * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0; * no branching! @@ -21,11 +17,12 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $"; int __isinf (double x) { - int32_t hx, lx; - EXTRACT_WORDS (hx, lx, x); - lx |= (hx & 0x7fffffff) ^ 0x7ff00000; - lx |= -lx; - return ~(lx >> 31) & (hx >> 30); + int64_t ix; + EXTRACT_WORDS64 (ix,x); + int64_t t = ix & UINT64_C (0x7fffffffffffffff); + t ^= UINT64_C (0x7ff0000000000000); + t |= -t; + return ~(t >> 63) & (ix >> 62); } hidden_def (__isinf) weak_alias (__isinf, isinf) diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c deleted file mode 100644 index 2b427a8b4c..0000000000 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Written by J.T. Conklin . - * Changed to return -1 for -Inf by Ulrich Drepper . - * Public domain. - */ - -/* - * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0; - * no branching! - */ - -#include -#include -#include -#include - -int -__isinf (double x) -{ - int64_t ix; - EXTRACT_WORDS64(ix,x); - int64_t t = ix & UINT64_C(0x7fffffffffffffff); - t ^= UINT64_C(0x7ff0000000000000); - t |= -t; - return ~(t >> 63) & (ix >> 62); -} -hidden_def (__isinf) -weak_alias (__isinf, isinf) -#ifdef NO_LONG_DOUBLE -# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) -compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0); -# endif -weak_alias (__isinf, isinfl) -#endif From patchwork Fri Mar 29 13:35:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161438 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2052432jan; Fri, 29 Mar 2019 06:39:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwANfS0+wnguj8Uvtb3F458xnrVE71c6dbZRjmeO348WkBDOHY4TfekPby2arQJP6aGBIsm X-Received: by 2002:a63:d250:: with SMTP id t16mr12908874pgi.288.1553866754690; Fri, 29 Mar 2019 06:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866754; cv=none; d=google.com; s=arc-20160816; b=XAckOWdLWxSfNDRdxt6Mj+Lbw/N4zIGatCsysNMQLPay8dgpxtRicqFqmy22JcNHft tF9cla2BOAUY7eqPVsOL0AQ4llbBCmy3NicPQUjC8B/TPmikDB0OvaYmO+oTlR76vC/4 zavS6NS9t9MMT7xcHaJ4uD6Q9MtTTEP/MAD0TA78Y+v+ZpAJ7w06dwm9iKMJl2fjM82z QeqcNEntd7jMuIPJGVUnPgrsgccTKksvreuLnNuiR0beYlcoJkdqe8HjYKG68mla/Exx zE3/ukBdvHs+goU0WPpdv5bqigaonguHrHDMspXeATQ9SOIF4ac5cdGU3g31t9jmqn/G /0UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=Xq15JCzvP8Uq9J3xC29ESgjYKuQCaMEMs3GiRaeU2aA=; b=x4bA86mwHBxHDgFAQubIyfvCnqYwLqjfg/qiaDEZiY8lQKvemUmDpjpmmviaIxRJFT AshW4xk5U9e9T68CuQhIZej32TBLYHOgcZWgfnSpE4KKfkF1CngyUNX2IyTw0tyl1hIQ 1s9vVr8nMloT7IyyRkkLNhsp2f8EnFMM25xzmqBPR+JXHjcdFbhpy5wW/9E176qBToun gftFcGHDUA/5+fQ1JetkmxuEr7ulrKSi7zVps/cTMwJOmMhsxR6kGPbrqpMlhARq2p18 fqO50adkQa9Ka+DWUmQvCzpbNAs7GrhVYXYDXfP04xUMLo7VuBeeAXujjuDSUXmJ1n7V Q5Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=bfz41Sb2; dkim=pass header.i=@linaro.org header.s=google header.b=nFuDpJKd; spf=pass (google.com: domain of libc-alpha-return-101007-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101007-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 37si1955642plc.233.2019.03.29.06.39.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:39:14 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101007-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=bfz41Sb2; dkim=pass header.i=@linaro.org header.s=google header.b=nFuDpJKd; spf=pass (google.com: domain of libc-alpha-return-101007-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101007-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=rg81iGWk4iulr+VG/S8O3mr7diM7IUO aAYnh6RCbDRl920sbJ+V7IunvfjbWXdRIChbV93tCBZMxqormMZ+5IOTVB0zCOrg 167pi/DDyh8P0hsCeJ+p4JmGIdofa7cBw3pC0trOquucvlsWWOIM6XHCG/4Xe6TP 40QvUG7OQzHw= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Az9oG706/cyVRbYPvHA6s1vQJzI=; b=bfz41 Sb2KCP/CAuUZORT6ycEQaufMwd9t6f0/96/CFr8cKuPnU95ho+6iVeRb+4LJWD22 lSOyJJWnvQ2ygpMAZWGg3zZJigPqulygKAFRESM3GMa09gz/LKOi5wdhIb4M6a2l f0GxxBmpN322cWGLhCsbHKFkSsmaL2OLr7BHHQ= Received: (qmail 121693 invoked by alias); 29 Mar 2019 13:36:18 -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 120330 invoked by uid 89); 29 Mar 2019 13:36:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=luis, Luis X-HELO: mail-vs1-f49.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Xq15JCzvP8Uq9J3xC29ESgjYKuQCaMEMs3GiRaeU2aA=; b=nFuDpJKd94tOmdpWGA7KvFqBO76r8mVi4hAsLcVGwMwbbv+c9mec4436rs4v9YJRHS uyIao7nC3MqMjrV47dQ+rLMFilWlfFVwWE/h6QnVWX1nb/DGX1G68qWtY4PMwYZwyRJW 7CVl3n7IZAKkDp1sAioXbt0Ry0Wz5UUcWKabK6TbWBbtAdqxB1j45AQwHhB9Oz3I2fOb B/VCe0sk6Lds8/XIR/rSWTzETx8tIVvpuRJBjFgO8S20MC1io2aC4x8GOW3dcKoITtDs LRg+RWeOHdD+tOE4q5OK+C/8thB95jzlP0YcVK4L8/Cu37W4CPAlxX5effmA06we1HM8 FPvg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 15/28] powerpc: Remove optimized isinf Date: Fri, 29 Mar 2019 10:35:16 -0300 Message-Id: <20190329133529.22523-16-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> The powerpc isinf optimizations onyl adds complexity: - GCC will call libm iff -fsignaling-nans is used. This usage pattern is usually not performance oriented and for such calls PLT overhead should dominate execution time. - The power7 uses ftdiv to optimize for some input pattern and branch implementation for INF and denormal that does: return (ix & UINT64_C (0x7fffffffffffffff)) == UINT64_C (0x7ff0000000000000) Although it does show slight better latency than generic algorithm, it is only for power7 and requires it to override it for power8. - The power8 implementation is just the generic implementation using ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation). So generic implementation is already the best option for powerpc64le. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile (sysdeps_routines, libm-sysdep_routines): Remove s_isinf* objects. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile usysdep_call): Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S: Likewise. --- .../powerpc32/power4/fpu/multiarch/Makefile | 6 +- .../power4/fpu/multiarch/s_isinf-power7.S | 33 ------- .../power4/fpu/multiarch/s_isinf-ppc32.c | 33 ------- .../powerpc32/power4/fpu/multiarch/s_isinf.c | 50 ----------- .../power4/fpu/multiarch/s_isinff-ppc32.c | 31 ------- .../powerpc32/power4/fpu/multiarch/s_isinff.c | 35 -------- .../powerpc/powerpc32/power7/fpu/s_isinf.S | 85 ------------------- .../powerpc/powerpc32/power7/fpu/s_isinff.S | 1 - .../powerpc/powerpc64/fpu/multiarch/Makefile | 2 - .../powerpc64/fpu/multiarch/s_isinf-power7.S | 32 ------- .../powerpc64/fpu/multiarch/s_isinf-power8.S | 32 ------- .../powerpc64/fpu/multiarch/s_isinf-ppc64.c | 33 ------- .../powerpc/powerpc64/fpu/multiarch/s_isinf.c | 62 -------------- .../powerpc64/fpu/multiarch/s_isinff-ppc64.c | 31 ------- .../powerpc64/fpu/multiarch/s_isinff.c | 38 --------- .../powerpc/powerpc64/power7/fpu/s_isinf.S | 69 --------------- .../powerpc/powerpc64/power7/fpu/s_isinff.S | 1 - .../powerpc/powerpc64/power8/fpu/s_isinf.S | 61 ------------- .../powerpc/powerpc64/power8/fpu/s_isinff.S | 1 - 19 files changed, 2 insertions(+), 634 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile index 0b39461a1a..c7b9d48094 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile @@ -1,14 +1,12 @@ ifeq ($(subdir),math) -sysdep_routines += s_isinf-power7 \ - s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \ +sysdep_routines += s_finite-power7 \ s_finite-ppc32 s_finitef-ppc32 \ s_modf-power5+ s_modf-ppc32 \ s_modff-power5+ s_modff-ppc32 libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \ s_llrint-ppc32 s_llround-power6 s_llround-power5+ \ - s_llround-ppc32 s_isinf-power7 \ - s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \ + s_llround-ppc32 s_finite-power7 \ s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \ s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \ s_floor-power5+ s_floor-ppc32 s_floorf-power5+ \ diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S deleted file mode 100644 index 0e6e61352d..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S +++ /dev/null @@ -1,33 +0,0 @@ -/* isinf(). PowerPC32/POWER7 version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __isinf __isinf_power7 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c deleted file mode 100644 index 09e51c9891..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c +++ /dev/null @@ -1,33 +0,0 @@ -/* isinf(). PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a, b) -#undef strong_alias -#define strong_alias(a, b) - -#define __isinf __isinf_ppc32 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__isinf_ppc32, __GI___isinf, __isinf_ppc32); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c deleted file mode 100644 index c115c7fef1..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Multiple versions of isinf. - Copyright (C) 2013-2019 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 - . */ - -#define __isinf __redirect___isinf -#define __isinff __redirect___isinff -#define __isinfl __redirect___isinfl -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__isinf) __isinf_ppc32 attribute_hidden; -extern __typeof (__isinf) __isinf_power7 attribute_hidden; -#undef __isinf -#undef __isinff -#undef __isinfl - -libc_ifunc_redirected (__redirect___isinf, __isinf, - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __isinf_power7 - : __isinf_ppc32); - -weak_alias (__isinf, isinf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isinf, __isinfl) -weak_alias (__isinf, isinfl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0); -compat_symbol (libc, isinf, isinfl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c deleted file mode 100644 index 8299fda5fa..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c +++ /dev/null @@ -1,31 +0,0 @@ -/* isinff(). PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a, b) - -#define __isinff __isinff_ppc32 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__isinff_ppc32, __GI___isinff, __isinff_ppc32); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c deleted file mode 100644 index 92f078a0db..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Multiple versions of isinf. - Copyright (C) 2013-2019 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 - . */ - -#define __isinff __redirect___isinff -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__isinff) __isinff_ppc32 attribute_hidden; -/* The power7 isinf(double) works for float. */ -extern __typeof (__isinff) __isinf_power7 attribute_hidden; -#undef __isinff - -libc_ifunc_redirected (__redirect___isinff, __isinff, - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __isinf_power7 - : __isinff_ppc32); - -weak_alias (__isinff, isinff) diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S deleted file mode 100644 index 9cd45eb428..0000000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S +++ /dev/null @@ -1,85 +0,0 @@ -/* isinf(). PowerPC32/POWER7 version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include -#include - -/* int __isinf(x) */ - .section .rodata.cst8,"aM",@progbits,8 - .align 3 -.LC0: /* 1.0 */ - .quad 0x3ff0000000000000 - - .section ".text" - .type __isinf, @function - .machine power7 -ENTRY (__isinf) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfd fp0,.LC0-got_label@l(r9) - - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfd fp0,.LC0@l(r9) -#endif - ftdiv cr7,fp1,fp0 - li r3,0 - bflr 29 /* If not INF, return. */ - - /* Either we have +INF or -INF. */ - - stwu r1,-16(r1) /* Allocate stack space. */ - stfd fp1,8(r1) /* Transfer FP to GPR's. */ - ori 2,2,0 /* Force a new dispatch group. */ - lhz r4,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value - (biased exponent and sign bit). */ - addi r1,r1,16 /* Reset the stack pointer. */ - cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */ - li r3,1 - beqlr cr7 /* EQ means INF, otherwise -INF. */ - li r3,-1 - blr - END (__isinf) - -hidden_def (__isinf) -weak_alias (__isinf, isinf) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isinf, __isinff) -hidden_def (__isinff) -weak_alias (__isinff, isinff) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isinf, __isinfl) -weak_alias (__isinf, isinfl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0); -compat_symbol (libc, isinf, isinfl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S deleted file mode 100644 index be759e091e..0000000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_isinf.S. */ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index a0b5939abe..3a2051d97b 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -4,8 +4,6 @@ ifeq ($(subdir),math) # prefixed with m_. sysdep_calls := s_finite-power8 s_finite-power7 s_finite-ppc64 \ s_finitef-ppc64 \ - s_isinf-power8 s_isinf-ppc64 \ - s_isinff-ppc64 s_isinf-power7 \ s_modf-power5+ s_modf-ppc64 \ s_modff-power5+ s_modff-ppc64 diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S deleted file mode 100644 index 28aeba9e66..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isinf(). PowerPC64/POWER7 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __isinf __isinf_power7 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S deleted file mode 100644 index e9ccdabc5b..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isinf(). PowerPC64/POWER8 version. - Copyright (C) 2014-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __isinf __isinf_power8 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c deleted file mode 100644 index b919394512..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c +++ /dev/null @@ -1,33 +0,0 @@ -/* isinf(). PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a, b) -#undef strong_alias -#define strong_alias(a, b) - -#define __isinf __isinf_ppc64 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__isinf_ppc64, __GI___isinf, __isinf_ppc64); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c deleted file mode 100644 index f5b9044473..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Multiple versions of isinf. - Copyright (C) 2013-2019 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 - . */ - -#define __isinf __redirect___isinf - -/* The following definitions, although not related to the 'double' - version of 'isinf', are required to guarantee macro expansions - (e.g.: from __isinff to __redirect_isinff) in include/math.h, thus - compensating for the unintended macro expansions in - math/bits/mathcalls-helper-functions.h. */ -#define __isinff __redirect___isinff -#define __isinfl __redirect___isinfl -#define __isinff128 __redirect___isinff128 - -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__isinf) __isinf_ppc64 attribute_hidden; -extern __typeof (__isinf) __isinf_power7 attribute_hidden; -extern __typeof (__isinf) __isinf_power8 attribute_hidden; -#undef __isinf -#undef __isinff -#undef __isinfl -#undef __isinff128 - -libc_ifunc_redirected (__redirect___isinf, __isinf, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __isinf_power8 - : (hwcap & PPC_FEATURE_ARCH_2_06) - ? __isinf_power7 - : __isinf_ppc64); - -weak_alias (__isinf, isinf) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isinf, __isinfl) -weak_alias (__isinf, isinfl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0); -compat_symbol (libc, isinf, isinfl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c deleted file mode 100644 index ac5274b4c1..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c +++ /dev/null @@ -1,31 +0,0 @@ -/* isinff(). PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a, b) - -#define __isinff __isinff_ppc64 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__isinff_ppc64, __GI___isinff, __isinff_ppc64); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c deleted file mode 100644 index 16feaee3b8..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Multiple versions of isinf. - Copyright (C) 2013-2019 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 - . */ - -#define __isinff __redirect___isinff -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__isinff) __isinff_ppc64 attribute_hidden; -/* The double-precision version also works for single-precision. */ -extern __typeof (__isinff) __isinf_power7 attribute_hidden; -extern __typeof (__isinff) __isinf_power8 attribute_hidden; -#undef __isinff - -libc_ifunc_redirected (__redirect___isinff, __isinff, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __isinf_power8 - : (hwcap & PPC_FEATURE_ARCH_2_06) - ? __isinf_power7 - : __isinff_ppc64); - -weak_alias (__isinff, isinff) diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S deleted file mode 100644 index aed9d74d35..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S +++ /dev/null @@ -1,69 +0,0 @@ -/* isinf(). PowerPC64/POWER7 version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include -#include - -/* int __isinf(x) */ - .section ".toc","aw" -.LC0: /* 1.0 */ - .tc FD_ONE[TC],0x3ff0000000000000 - .section ".text" - .type __isinf, @function - .machine power7 -ENTRY (__isinf, 4) - CALL_MCOUNT 0 - lfd fp0,.LC0@toc(r2) - ftdiv cr7,fp1,fp0 - li r3,0 - bflr 29 /* If not INF, return. */ - - /* Either we have -INF/+INF or a denormal. */ - - stfd fp1,-16(r1) /* Transfer FP to GPR's. */ - ori 2,2,0 /* Force a new dispatch group. */ - lhz r4,-16+HISHORT(r1) /* Fetch the upper 16 bits of the FP value - (biased exponent and sign bit). */ - cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */ - li r3,1 - beqlr cr7 /* EQ means INF, otherwise -INF. */ - li r3,-1 - blr - END (__isinf) - -hidden_def (__isinf) -weak_alias (__isinf, isinf) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isinf, __isinff) -hidden_def (__isinff) -weak_alias (__isinff, isinff) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isinf, __isinfl) -weak_alias (__isinf, isinfl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0); -compat_symbol (libc, isinf, isinfl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S deleted file mode 100644 index be759e091e..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_isinf.S. */ diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S deleted file mode 100644 index 1fb2851a84..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S +++ /dev/null @@ -1,61 +0,0 @@ -/* isinf(). PowerPC64/POWER8 version. - Copyright (C) 2014-2019 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 - . */ - -#include -#include - -#define MFVSRD_R3_V1 .long 0x7c230066 /* mfvsrd r3,vs1 */ - -/* int [r3] __isinf([fp1] x) */ - -ENTRY_TOCLESS (__isinf, 4) - CALL_MCOUNT 0 - MFVSRD_R3_V1 - lis r9,0x7ff0 /* r9 = 0x7ff0 */ - rldicl r10,r3,0,1 /* r10 = r3 & (0x8000000000000000) */ - sldi r9,r9,32 /* r9 = r9 << 52 */ - cmpd cr7,r10,r9 /* fp1 & 0x7ff0000000000000 ? */ - beq cr7,L(inf) - li r3,0 /* Not inf */ - blr -L(inf): - sradi r3,r3,63 /* r3 = r3 >> 63 */ - ori r3,r3,1 /* r3 = r3 | 0x1 */ - blr -END (__isinf) - -hidden_def (__isinf) -weak_alias (__isinf, isinf) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__isinf, __isinff) -hidden_def (__isinff) -weak_alias (__isinff, isinff) - -#ifdef NO_LONG_DOUBLE -strong_alias (__isinf, __isinfl) -weak_alias (__isinf, isinfl) -#endif - -#if !IS_IN (libm) -# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) -compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0); -compat_symbol (libc, isinf, isinfl, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S deleted file mode 100644 index be759e091e..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_isinf.S. */ From patchwork Fri Mar 29 13:35:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161436 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2051997jan; Fri, 29 Mar 2019 06:38:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbEit/2/L4Kcl1tegqb9qy/b6xivlmD2sYVbRrSYhhFQZy6mXAGYaK6izWJe0D4SShtKKN X-Received: by 2002:a17:902:1102:: with SMTP id d2mr46630061pla.329.1553866728847; Fri, 29 Mar 2019 06:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866728; cv=none; d=google.com; s=arc-20160816; b=yoj1d2u6yuPDOhYJlSj/yinWVnFJunsg8y0EqSeBumsIMP+TGQQH+ycRDYMutq7IsO m8G7AGPfq94MZyJXuYVoY9iocapyXya+0q5h+vk1rQLBvwdHYaPevugLHbQYdRdmZUun 63pEEkJMV+Vpxlx0N4hPOBYK6lYHCDjYtpAuiPwvccX6SyXYgL3Rauu/pS6M8fwi464x UjGbZlcmL9JixTVoWrmbwjGoYAX+TFqk9AF93PCzgpm0N+spW6Fd7dg92Nz7+Qj57Zi7 Q5+GYYAjj0EXJ0VP3LdnZq5Pb5xy3tRQlXKM/YSKbIMjN/lFFDWowWwHzQkS0MZEo0jO +tUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=ZEkYwtszPa4+qOt5HcIDNp8sjxw2NpsJc0S5o4LA7uc=; b=CP2k+XlLuFk9uXfCffhpBZEQaOQ90/E3lGjOHVZWk/asl9rUskxUWBn3UsVX86Xrfx eaws9pAN5SQ3M3DHSvyGEH8+zz6+2AxGJp1WTo9onDrMsiOP+U57f5LB1vAlIM6wLyW3 EhoqP63C+pFjxOASNcZZE3mkqYREiOQCTVSuAqR+D9Akvswql8ueaClqq4+xLJqK35ZG Ux4pMEvi7AJHjvhwixFiXDEGGxa+9vluVD0xCUdN+LTlVZlvHEDYL77Mt2x0iOfXjmtY VoIzCZ3G7xHc5yJPsroJEWxb9P4x0onIhigLhgXiGG6KsWSZ64K3IDS616+JgbePOHHu mzfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=gR2iA3Qw; dkim=pass header.i=@linaro.org header.s=google header.b=HXD7LsDd; spf=pass (google.com: domain of libc-alpha-return-101005-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101005-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id w3si1938376plp.35.2019.03.29.06.38.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:38:48 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101005-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=gR2iA3Qw; dkim=pass header.i=@linaro.org header.s=google header.b=HXD7LsDd; spf=pass (google.com: domain of libc-alpha-return-101005-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101005-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=jnN9MJ/RvOl1QTYQ/p/MKCqPo+CvOS9 OleGx1LD1BX8R9wgUVCSHOdRFXO4YE75Dzi5kYubS2FXTAY4cma3JoICWsSzM0PI vtoj73isaEXMVG7Xu22y5tjLCFuAAi6FeLzriWpw3EO36u1qUe+ZjktwUqLxx3mI 7By9YUcdgLaw= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=G4pImbN4+cTVG6vtVKX4ZUJJbnI=; b=gR2iA 3QwoKC4dVmxNb0gyT7Nf/WIXZQ25M4NuUI3V1B0EOInhOkBUQRTjeS+8GISjIU7O bMMv/I1hTrpriu0RSTNuJkAcAmfFWp2NwJcTzhYs/hHBlqG7vsz2M3WT+t5Lg8/3 XFDLl4xtWmIeU1Tohy3Qyq8Z/OX/wvSVJTV0P4= Received: (qmail 120741 invoked by alias); 29 Mar 2019 13:36:07 -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 119957 invoked by uid 89); 29 Mar 2019 13:35:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=2318, 1815 X-HELO: mail-vs1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=ZEkYwtszPa4+qOt5HcIDNp8sjxw2NpsJc0S5o4LA7uc=; b=HXD7LsDdshmxfZnm4ebtJ8OURx5yFEL9VMQOqenGsP/v6hrXx4VfIMCbA7LS2EghO/ 8e/FrU2OZnrxI5hKSNy+myvxHc3e2h6xCzHl2Z0aKNmmdWC3Rtkb0AGaLViaWwi0QkFG moHlkuemLgROyUq9cXp9qenMdAQEkWt2XYyIOcq50GutyR8KGbkqC46Nu5EiK+QtDLWo Au6BS9YMvy18hNtrYaUMip1UFANghoSuXVL1U3Ja9x+0+jSya+pm8ZpmwAaOC/quSyfJ EPSJ9ZjPSN8lmO+cQAhZQpZv+mLtRd+/i7G4/WQIMf65Xu16IldNfOW6FdBF1oTnkhKf zOig== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 16/28] math: Use wordsize-64 version for finite Date: Fri, 29 Mar 2019 10:35:17 -0300 Message-Id: <20190329133529.22523-17-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> - math.h will use compiler builtin for gcc 4.4+ when built without -fsignaling-nans and the builtin is expanded inline for all supported architectures. As an example, there is no intra finite call on libm for the architecture I checked (x86, arm, aarch64, and powerpc). - The resulting binary difference on 32 bits architecture is minimum for the non hotspot symbol. - It helps wordsize-64 architectures that use ldbl-opt. - It add some code simplification with reduction of duplicated implementations. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Move to ... * sysdeps/ieee754/dbl-64/s_finite.c: ... here and format code. --- sysdeps/ieee754/dbl-64/s_finite.c | 22 +++------- sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c | 43 ------------------- 2 files changed, 7 insertions(+), 58 deletions(-) delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c -- 2.17.1 diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c index da1519b1d0..98a40fbff6 100644 --- a/sysdeps/ieee754/dbl-64/s_finite.c +++ b/sysdeps/ieee754/dbl-64/s_finite.c @@ -1,4 +1,3 @@ -/* @(#)s_finite.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,10 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $"; -#endif - /* * finite(x) returns 1 is x is finite, else 0; * no branching! @@ -23,18 +18,15 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $"; #include #include #include +#include -#undef __finite - -#ifndef FINITE -# define FINITE __finite -#endif - -int FINITE(double x) +int +__finite (double x) { - int32_t hx; - GET_HIGH_WORD (hx, x); - return (int) ((uint32_t) ((hx & 0x7ff00000) - 0x7ff00000) >> 31); + int64_t lx; + EXTRACT_WORDS64 (lx,x); + return (int)((uint64_t)((lx & INT64_C(0x7ff0000000000000)) + - INT64_C (0x7ff0000000000000)) >> 63); } hidden_def (__finite) weak_alias (__finite, finite) diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c deleted file mode 100644 index 40676924fe..0000000000 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - * finite(x) returns 1 is x is finite, else 0; - * no branching! - */ - -#include -#include -#include -#include -#include - -#undef __finite -int -__finite(double x) -{ - int64_t lx; - EXTRACT_WORDS64(lx,x); - return (int)((uint64_t)((lx&INT64_C(0x7ff0000000000000))-INT64_C(0x7ff0000000000000))>>63); -} -hidden_def (__finite) -weak_alias (__finite, finite) -#ifdef NO_LONG_DOUBLE -# if LDBL_CLASSIFY_COMPAT -# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23) -compat_symbol (libc, __finite, __finitel, GLIBC_2_0); -# endif -# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_23) -compat_symbol (libm, __finite, __finitel, GLIBC_2_1); -# endif -# endif -weak_alias (__finite, finitel) -#endif From patchwork Fri Mar 29 13:35:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161440 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2052965jan; Fri, 29 Mar 2019 06:39:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXgviQTznlWZjYufRn4jrRBBS+G/OMGTxOXdhoP9Py4eGCiGAGNmyo8czzUAE09sgFHE6H X-Received: by 2002:a65:50c2:: with SMTP id s2mr37922929pgp.112.1553866782895; Fri, 29 Mar 2019 06:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866782; cv=none; d=google.com; s=arc-20160816; b=X+GoLqixPB6xEh/ct2wznaCRDWRA3S+iTEJpMuaHlNVNmH4KYFj8R3RhfcTwlymMc5 kS2hMtmc9R2Uzup1D+dv5kxlyZk6avH63UtSI2ZsdKbNAGEb5q6AajTny79nRV1aAmIY E50w/VX934A4hfQHzppL2nFqZimryBIimceZQv5q/zTtyWPf1tDuIePMtD/vIRJK4hvU /pxEX8vrn1P7RcU5L8ktyszwSfP9Y2uK+IueIl0/0DJecRo5pkcCiRfNWAyIomiMV/2a N2q2mLzMYzFM7GmB9jzggKxORqd+nBU7Vtydmp5lwH3OC2KQzSNb4D7zNMAN+0bQPBUM Ooww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=ZmnnJ5xRrt5DZunnyYGSFZmYMqA/Dwgtce2mFNL1lZI=; b=G7YbX0o5cizAFJIhA+aZee/fyVxmFBDHKsqquCe0+VerAtRclkDrsuvr6RiK8TLpGf LNbingqiQHkFeqlAeCQ4o8SuEunUbl1zaCbtXe+/YUVgzMDtVbBI1sQGF8oFWQyzkzT2 yYt2NShjsMPZrwOiGFAomn4RGRaPnA0rrzdVwUZIhMoi3Sw+RiA/+AiYZlzse7CpdqUI 8fSdlhfGiRiGlwtl4fdfYkuzqHMDDmIGcnycGT4ad24oG5PGkR22L50oAlnUYJNwzYGX DHga9jc6qbAkz0/vdC/uL66y6rcMfru0gKsNdtginO4ILb+/B71kOApmKT+oVdH/yzxA +znQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=CuAT8Gho; dkim=pass header.i=@linaro.org header.s=google header.b=yBDolsbL; spf=pass (google.com: domain of libc-alpha-return-101009-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101009-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id v21si1823103pfe.119.2019.03.29.06.39.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:39:42 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101009-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=CuAT8Gho; dkim=pass header.i=@linaro.org header.s=google header.b=yBDolsbL; spf=pass (google.com: domain of libc-alpha-return-101009-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101009-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Eog8X1eg5YQzf0v5R8w2HXoyZ9GAvq2 qchU0t3T3skUAeJ4i2xE11nCjapgGC5lDsAFKjt+s5w4gUEi1m8h6gyRsJlQ7/bs ibXdqv9rr0nKe5P62GqP60IR32cuA6VvBCjkcZOTiyjM5Brhhxo0Z4GZ4hf/V9UQ Fc5+9o4qtz0o= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=9QLlfj0qeMTI94qXl5Ar4LifBJM=; b=CuAT8 GhoDkLZ2rwCiZ04cvlneH2OAMA/E+lylkVfXhAtz2EEDCSs4yhygbfG7KDbnpguy CxS9aYUONgLuAbyxqMIyKCdxXlqfLhcv6/9NQVw0lniFyZQaD8+OlJZwE4ic+95/ JZekyF2DiO9nzY6tH11fLzjhCSaT83mCnQmomk= Received: (qmail 121976 invoked by alias); 29 Mar 2019 13:36:21 -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 120598 invoked by uid 89); 29 Mar 2019 13:36:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=luis, Luis X-HELO: mail-vs1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=ZmnnJ5xRrt5DZunnyYGSFZmYMqA/Dwgtce2mFNL1lZI=; b=yBDolsbLZ5OEvIy/U+UIOB3/7l3jZVTK4hLQ7hjJJ34km8drM/HSNpZaeHe9lP2dSB fk9IU//nKpCfA5ctlD6xDRBI3cE0rL3mIAPCZ4UeVNHBG3OhC+HgIQiGrk88Ic2EpGV+ jt4XyiX39m3cwQPb+QzpJhYFdUSmQnjpzU5rNzeYoxqBpgZNLtIkLIZQld1s48+1XhTM V5rd789crMcJNkYO4GMJe0BobggdsiF4fuE821lY4ePY/dfVieDONWPJhOjNzZmJIe4A TR3H6DsPMF/4upiXB08EpUhzs0f4KGGoiYbB3Jxt+swTM6BBc2TYMpcV9vU62E8QSe3u WMkg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 17/28] powerpc: Remove optimized finite Date: Fri, 29 Mar 2019 10:35:18 -0300 Message-Id: <20190329133529.22523-18-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> The powerpc finite optimization do not show much gain: - GCC will call libm iff -fsignaling-nans is used. This usage pattern is usually not performance oriented and for such calls PLT overhead should dominate execution time. - The power7 uses ftdiv to optimize for some input patterns, but at cost of others. Comparing against generic C implementation built for powerpc64-linux-gnu-power7 (--with-cpu=power7): - Generic sysdeps/ieee754 implementation: "isfinite": { "": { "duration": 5.0082e+09, "iterations": 2.45299e+09, "max": 43.824, "min": 2.008, "mean": 2.04167 }, "INF": { "duration": 4.66554e+09, "iterations": 2.28288e+09, "max": 35.73, "min": 2.008, "mean": 2.04371 }, "NAN": { "duration": 4.66274e+09, "iterations": 2.28716e+09, "max": 34.161, "min": 2.009, "mean": 2.03866 } } - power7 optimized one: "isfinite": { "": { "duration": 4.99111e+09, "iterations": 2.65566e+09, "max": 25.015, "min": 1.716, "mean": 1.87942 }, "INF": { "duration": 4.6783e+09, "iterations": 2.0999e+09, "max": 35.264, "min": 1.868, "mean": 2.22787 }, "NAN": { "duration": 4.67915e+09, "iterations": 2.08678e+09, "max": 38.099, "min": 1.869, "mean": 2.24228 } } So it basically optimizes marginally for normal numbers while increasing the latency for other kind of FP. - The power8 implementation is just the generic implementation using ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation). So generic implementation is the best option for powerpc64le. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile (sysdeps_routines, libm-sysdep_routines): Remove s_finite* objects. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile usysdep_call): Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S: Likewise. --- .../powerpc32/power4/fpu/multiarch/Makefile | 7 +- .../power4/fpu/multiarch/s_finite-power7.S | 33 ------- .../power4/fpu/multiarch/s_finite-ppc32.c | 33 ------- .../powerpc32/power4/fpu/multiarch/s_finite.c | 57 ------------ .../power4/fpu/multiarch/s_finitef-ppc32.c | 31 ------- .../power4/fpu/multiarch/s_finitef.c | 34 ------- .../powerpc/powerpc32/power7/fpu/s_finite.S | 93 ------------------- .../powerpc/powerpc32/power7/fpu/s_finitef.S | 1 - .../powerpc/powerpc64/fpu/multiarch/Makefile | 4 +- .../powerpc64/fpu/multiarch/s_finite-power7.S | 32 ------- .../powerpc64/fpu/multiarch/s_finite-power8.S | 32 ------- .../powerpc64/fpu/multiarch/s_finite-ppc64.c | 34 ------- .../powerpc64/fpu/multiarch/s_finite.c | 69 -------------- .../powerpc64/fpu/multiarch/s_finitef-ppc64.c | 32 ------- .../powerpc64/fpu/multiarch/s_finitef.c | 37 -------- .../powerpc/powerpc64/power7/fpu/s_finite.S | 70 -------------- .../powerpc/powerpc64/power7/fpu/s_finitef.S | 1 - .../powerpc/powerpc64/power8/fpu/s_finite.S | 56 ----------- .../powerpc/powerpc64/power8/fpu/s_finitef.S | 1 - 19 files changed, 3 insertions(+), 654 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile index c7b9d48094..51b13fe33a 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile @@ -1,13 +1,10 @@ ifeq ($(subdir),math) -sysdep_routines += s_finite-power7 \ - s_finite-ppc32 s_finitef-ppc32 \ - s_modf-power5+ s_modf-ppc32 \ +sysdep_routines += s_modf-power5+ s_modf-ppc32 \ s_modff-power5+ s_modff-ppc32 libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \ s_llrint-ppc32 s_llround-power6 s_llround-power5+ \ - s_llround-ppc32 s_finite-power7 \ - s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \ + s_llround-ppc32 s_ceil-power5+ \ s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \ s_floor-power5+ s_floor-ppc32 s_floorf-power5+ \ s_floorf-ppc32 s_round-power5+ s_round-ppc32 \ diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S deleted file mode 100644 index 0cde9f1cd1..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S +++ /dev/null @@ -1,33 +0,0 @@ -/* finite(). PowerPC32/POWER7 version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __finite __finite_power7 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c deleted file mode 100644 index c03a26e00f..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c +++ /dev/null @@ -1,33 +0,0 @@ -/* finite(). PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a, b) -#undef strong_alias -#define strong_alias(a, b) - -#define FINITE __finite_ppc32 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__finite_ppc32, __GI___finite, __finite_ppc32); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c deleted file mode 100644 index 677b71baf3..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Multiple versions of finite. - Copyright (C) 2013-2019 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 - . */ - -#define __finite __redirect___finite -#define __finitef __redirect___finitef -#define __finitel __redirect___finitel -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__finite) __finite_ppc32 attribute_hidden; -extern __typeof (__finite) __finite_power7 attribute_hidden; -#undef __finite -#undef __finitef -#undef __finitel - -libc_ifunc_redirected (__redirect___finite, __finite, - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __finite_power7 - : __finite_ppc32); - -weak_alias (__finite, finite) - -#ifdef NO_LONG_DOUBLE -strong_alias (__finite, __finitel) -weak_alias (__finite, finitel) -#endif - -#if IS_IN (libm) -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0) -compat_symbol (libm, finite, finitel, GLIBC_2_0); -# endif -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1) -compat_symbol (libm, __finite, __finitel, GLIBC_2_1); -# endif -#else -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __finite, __finitel, GLIBC_2_0); -compat_symbol (libc, finite, finitel, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c deleted file mode 100644 index e43c7a54bc..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c +++ /dev/null @@ -1,31 +0,0 @@ -/* finitef(). PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a, b) - -#define FINITEF __finitef_ppc32 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__finitef_ppc32, __GI___finitef, __finitef_ppc32); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c deleted file mode 100644 index da4780551e..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Multiple versions of finitef. - Copyright (C) 2013-2019 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 - . */ - -#define __finitef __redirect___finitef -#include -#include -#include "init-arch.h" - -extern __typeof (__finitef) __finitef_ppc32 attribute_hidden; -/* The power7 finite(double) works for float. */ -extern __typeof (__finitef) __finite_power7 attribute_hidden; -#undef __finitef - -libc_ifunc_redirected (__redirect___finitef, __finitef, - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __finite_power7 - : __finitef_ppc32); - -weak_alias (__finitef, finitef) diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S deleted file mode 100644 index 07fa8ae7b7..0000000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S +++ /dev/null @@ -1,93 +0,0 @@ -/* finite(). PowerPC32/POWER7 version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include -#include - -/* int __finite(x) */ - .section .rodata.cst8,"aM",@progbits,8 - .align 3 -.LC0: /* 1.0 */ - .quad 0x3ff0000000000000 - - .section ".text" - .type __finite, @function - .machine power7 -ENTRY (__finite) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - lfd fp0,.LC0-got_label@l(r9) - - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfd fp0,.LC0@l(r9) -#endif - ftdiv cr7,fp1,fp0 - li r3,1 - bflr 30 - - /* We have -INF/+INF/NaN or a denormal. */ - - stwu r1,-16(r1) /* Allocate stack space. */ - stfd fp1,8(r1) /* Transfer FP to GPR's. */ - - ori 2,2,0 /* Force a new dispatch group. */ - lhz r0,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value - (biased exponent and sign bit). */ - clrlwi r0,r0,17 /* r0 = abs(r0). */ - addi r1,r1,16 /* Reset the stack pointer. */ - cmpwi cr7,r0,0x7ff0 /* r4 == 0x7ff0?. */ - bltlr cr7 /* LT means we have a denormal. */ - li r3,0 - blr - END (__finite) - -hidden_def (__finite) -weak_alias (__finite, finite) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__finite, __finitef) -hidden_def (__finitef) -weak_alias (__finitef, finitef) - -#ifdef NO_LONG_DOUBLE -strong_alias (__finite, __finitel) -weak_alias (__finite, finitel) -#endif - -#if IS_IN (libm) -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0) -compat_symbol (libm, finite, finitel, GLIBC_2_0) -# endif -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1) -compat_symbol (libm, __finite, __finitel, GLIBC_2_1) -# endif -#else -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __finite, __finitel, GLIBC_2_0); -compat_symbol (libc, finite, finitel, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S deleted file mode 100644 index 54bd94176d..0000000000 --- a/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_finite.S. */ diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 3a2051d97b..4aa7fd6295 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -2,9 +2,7 @@ ifeq ($(subdir),math) # These functions are built both for libc and libm because they're required # by printf. While the libc objects have the prefix s_, the libm ones are # prefixed with m_. -sysdep_calls := s_finite-power8 s_finite-power7 s_finite-ppc64 \ - s_finitef-ppc64 \ - s_modf-power5+ s_modf-ppc64 \ +sysdep_calls := s_modf-power5+ s_modf-ppc64 \ s_modff-power5+ s_modff-ppc64 sysdep_routines += $(sysdep_calls) diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S deleted file mode 100644 index c360c3a8db..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER7 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __finite __finite_power7 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S deleted file mode 100644 index 8fa57e222e..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S +++ /dev/null @@ -1,32 +0,0 @@ -/* isnan(). PowerPC64/POWER7 version. - Copyright (C) 2014-2019 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 - . */ - -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, symbol, ver) - -#define __finite __finite_power8 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c deleted file mode 100644 index 59cc8ba168..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c +++ /dev/null @@ -1,34 +0,0 @@ -/* finite(). PowerPC64 default version. - Copyright (C) 2013-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a, b) -#undef strong_alias -#define strong_alias(a, b) - -#define FINITE __finite_ppc64 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__finite_ppc64, __GI___finite, __finite_ppc64); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c deleted file mode 100644 index 4f88a221cc..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Multiple versions of finite. - Copyright (C) 2013-2019 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 - . */ - -#define __finite __redirect___finite - -/* The following definitions, although not related to the 'double' - version of 'finite', are required to guarantee macro expansions - (e.g.: from __finitef to __redirect_finitef) in include/math.h, thus - compensating for the unintended macro expansions in - math/bits/mathcalls-helper-functions.h. */ -#define __finitef __redirect___finitef -#define __finitel __redirect___finitel -#define __finitef128 __redirect___finitef128 - -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__finite) __finite_ppc64 attribute_hidden; -extern __typeof (__finite) __finite_power7 attribute_hidden; -extern __typeof (__finite) __finite_power8 attribute_hidden; -#undef __finite -#undef __finitef -#undef __finitel -#undef __finitef128 - -libc_ifunc_redirected (__redirect___finite, __finite, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __finite_power8 - : (hwcap & PPC_FEATURE_ARCH_2_06) - ? __finite_power7 - : __finite_ppc64); - -weak_alias (__finite, finite) - -#ifdef NO_LONG_DOUBLE -strong_alias (__finite, __finitel) -weak_alias (__finite, finitel) -#endif - -#if IS_IN (libm) -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0) -compat_symbol (libm, finite, finitel, GLIBC_2_0); -# endif -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1) -compat_symbol (libm, __finite, __finitel, GLIBC_2_1); -# endif -#else -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __finite, __finitel, GLIBC_2_0); -compat_symbol (libc, finite, finitel, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c deleted file mode 100644 index 77af76d3ef..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c +++ /dev/null @@ -1,32 +0,0 @@ -/* finitef(). PowerPC64 default version. - Copyright (C) 2013-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a, b) - -#define FINITEF __finitef_ppc64 -#ifdef SHARED -# undef hidden_def -# define hidden_def(a) \ - __hidden_ver1 (__finitef_ppc64, __GI___finitef, __finitef_ppc64); -#endif - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c deleted file mode 100644 index cde669e5e3..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Multiple versions of finitef. - Copyright (C) 2013-2019 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 - . */ - -#define __finitef __redirect___finitef -#include -#include -#include "init-arch.h" - -extern __typeof (__finitef) __finitef_ppc64 attribute_hidden; -/* The double-precision version also works for single-precision. */ -extern __typeof (__finitef) __finite_power7 attribute_hidden; -extern __typeof (__finitef) __finite_power8 attribute_hidden; -#undef __finitef - -libc_ifunc_redirected (__redirect___finitef, __finitef, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __finite_power8 - : (hwcap & PPC_FEATURE_ARCH_2_06) - ? __finite_power7 - : __finitef_ppc64); - -weak_alias (__finitef, finitef) diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S deleted file mode 100644 index 5b5746c9a5..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S +++ /dev/null @@ -1,70 +0,0 @@ -/* finite(). PowerPC64/POWER7 version. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - Contributed by Luis Machado . - 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 - . */ - -#include -#include - -/* int __finite(x) */ - .section ".toc","aw" -.LC0: /* 1.0 */ - .tc FD_ONE[TC],0x3ff0000000000000 - .section ".text" - .type __finite, @function - .machine power7 -ENTRY (__finite, 4) - CALL_MCOUNT 0 - lfd fp0,.LC0@toc(r2) - ftdiv cr7,fp1,fp0 - li r3,1 - bflr 30 - - /* If we are here, we either have +/-INF, - NaN or denormal. */ - - stfd fp1,-16(r1) /* Transfer FP to GPR's. */ - ori 2,2,0 /* Force a new dispatch group. */ - lhz r4,-16+HISHORT(r1) /* Fetch the upper 16 bits of the FP value - (biased exponent and sign bit). */ - clrlwi r4,r4,17 /* r4 = abs(r4). */ - cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */ - bltlr cr7 /* LT means finite, other non-finite. */ - li r3,0 - blr - END (__finite) - -hidden_def (__finite) -weak_alias (__finite, finite) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__finite, __finitef) -hidden_def (__finitef) -weak_alias (__finitef, finitef) - -#if IS_IN (libm) -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0) -compat_symbol (libm, __finite, __finitel, GLIBC_2_0) -compat_symbol (libm, finite, finitel, GLIBC_2_0) -# endif -#else -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __finite, __finitel, GLIBC_2_0); -compat_symbol (libc, finite, finitel, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S deleted file mode 100644 index 54bd94176d..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_finite.S. */ diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S deleted file mode 100644 index f5316e898f..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S +++ /dev/null @@ -1,56 +0,0 @@ -/* isfinite(). PowerPC64/POWER8 version. - Copyright (C) 2014-2019 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 - . */ - -#include -#include - -#define MFVSRD_R3_V1 .long 0x7c230066 /* mfvsrd r3,vs1 */ - -/* int [r3] __finite ([fp1] x) */ - -ENTRY_TOCLESS (__finite, 4) - CALL_MCOUNT 0 - MFVSRD_R3_V1 - lis r9,0x8010 - clrldi r3,r3,1 /* r3 = r3 & 0x8000000000000000 */ - rldicr r9,r9,32,31 /* r9 = (r9 << 32) & 0xffffffff */ - add r3,r3,r9 - rldicl r3,r3,1,63 - blr -END (__finite) - -hidden_def (__finite) -weak_alias (__finite, finite) - -/* It turns out that the 'double' version will also always work for - single-precision. */ -strong_alias (__finite, __finitef) -hidden_def (__finitef) -weak_alias (__finitef, finitef) - -#if IS_IN (libm) -# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0) -compat_symbol (libm, __finite, __finitel, GLIBC_2_0) -compat_symbol (libm, finite, finitel, GLIBC_2_0) -# endif -#else -# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) -compat_symbol (libc, __finite, __finitel, GLIBC_2_0); -compat_symbol (libc, finite, finitel, GLIBC_2_0); -# endif -#endif diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S deleted file mode 100644 index 54bd94176d..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S +++ /dev/null @@ -1 +0,0 @@ -/* This function uses the same code as s_finite.S. */ From patchwork Fri Mar 29 13:35:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161439 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2052697jan; Fri, 29 Mar 2019 06:39:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPa4SOGt8XqAzbpz7//Fa3m3zJZ7lK15I+/rRc4m6d3wU1WG4eoV0IlxWJdDnoQpHnr3V2 X-Received: by 2002:aa7:885a:: with SMTP id k26mr46749261pfo.70.1553866769031; Fri, 29 Mar 2019 06:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866769; cv=none; d=google.com; s=arc-20160816; b=IB9ES7LiRnXpRCpFJcOk+TtMKdNQGIQNDrE0yYOV93ArHIWJuVo6CkkoZwtmKWJzwF nS4B9FUpd2V2Pi6J4cpZQ/w/JQ4SAajA7XihXAmQWbtg0GSt0zX5+J5LSdCaE8nRejYo 2V3UmlhuBPXURhtVmUR44Ae65UZyqz1Nkd13SxwGv/Ntjjdm4/H0PRMxMr7HwkWx/LHW O/ttnR7Iswla3mxph4GgsISHoZ7wqvkyeh2raAUvIpHkMZR/dobG1R1bfAAb5WlRp9tf pONYN8kRWB9rXHzmDXB/9wi+gBAZ4kUUElfVLhaaUfgKNVYMIF776h8fvfbf0FXtBHxB ppZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=m1+p1IiaJ584VJs5eKxAx+lkh3AWKI0H5I+g7UXcb1U=; b=mp7XKF1wKUvOkN0F2qJgy4LApGAUMJeBejEgq9CzPEoY7ie9TpB4lSJFdF/dSq4Mgj NBSqyW2D0gC486XGNYfxoRUltN/pZHjcXJGgT/ruV5vEgE0t+YxAGXwZ661ObtA4pAhy YWO6CqJmAMf8uBTFfygrXB8VE4SVO3yD0AjTJDCEn9Hzp1b32xjzNx/tCXfWCP+a23CB a/4+68OyuWkG4x8hV3C56Z8hvXG46CLpIMbjDjdptrsLvgovXr837lJ5xygq8M5LrWdh MY9VVgjx451VE4rd9akUoalULCBUW+3mz/GAusOwNeqtnA1o5kzmcoYM6CGfKlHKtjPU 2cDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=VC8cXUGm; dkim=pass header.i=@linaro.org header.s=google header.b=aYoxac61; spf=pass (google.com: domain of libc-alpha-return-101008-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101008-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id b4si1875275pgq.50.2019.03.29.06.39.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:39:29 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101008-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=VC8cXUGm; dkim=pass header.i=@linaro.org header.s=google header.b=aYoxac61; spf=pass (google.com: domain of libc-alpha-return-101008-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101008-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Ushad2j5EX9UrbZGXOMegsUSHVla04Q S4tonEwXz4iTpshn6YVg6pl6vlfYZC1tHCa4iZ0Z4CJ30ix39AI/2OILJpbaPzVC osx8VCyeV6kuYhpbss5Drpm4OqruygqGw02WsEBmObYsgJ4lEpACXpvbQdqP/nhL cQrd4ePK0XTo= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Yp9jRKBN4KkaSDCXZCQ9O4G0rP0=; b=VC8cX UGmIMAWMBIuWGJDFrv0OkX+i9NKnpbDWmMfw/QKylDm8A3kB9DL7U49yjrThETmj CVCTZiBslCD2FxDo1O7Bnr+QwE7XX0reTiJR5ZbWcWZ8Uk/1zd8uWZB1+njfPVPa Xhcq7+fZqvuNPzh4sc883j0Wvyyrb8kEUxVvk8= Received: (qmail 121907 invoked by alias); 29 Mar 2019 13:36:20 -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 120541 invoked by uid 89); 29 Mar 2019 13:36:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=m1+p1IiaJ584VJs5eKxAx+lkh3AWKI0H5I+g7UXcb1U=; b=aYoxac61PTCkgdxvBoHo3DiGMk1p16tx1R8eZgFUvoAQbFqBSgO+EyymB2JIjK1dcM 2IDAuCJtXi0N0DlxDhMurmpn8j5ex2PoaNxOU53LHv0h6pv6VGc8E75aYBYuhZsPF0/u plhHQVuE2S89uHUBtIEWHEQVPffDUQdgO7wBcpQUyKd7LBOm1ZjIBzsQ2pKP4OlmLncH FxjNzMSq+YJLxqYiaNMIKaC48MbM4dc3cZMiP8k/5XZk/sh3n9zG7KxPcKSnvpNmqRMd ve3piyh4+3l6izJWtM61n6AibRRZoE+URFVdsLawVBmX+IMs47y1+NFq5PYQKH8H0y5K 8D7w== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 18/28] powerpc: refactor powerpc64 lrint/lrintf/llrint/llrintf Date: Fri, 29 Mar 2019 10:35:19 -0300 Message-Id: <20190329133529.22523-19-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc llrint{f} implementations on the generic sysdeps/powerpc/fpu/s_llrint{f}. The IFUNC support is also moved only to powerpc64 only, since for powerpc64le generic implementation resulting in optimized code. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_llrint-power8, s_llrint-power6x, and s_llrint-ppc64. (CFLAGS-s_llrint-power8.c, CFLAGS-s_llrint-power6x.c): New rule. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c: New file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c: ... here. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c: New file. * sysdeps/powerpc/powerpc64/fpu/Makefile: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_llrint-* objects. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llrint.c: New file. * sysdeps/powerpc/powerpc64/fpu/s_llrintf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lrint.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lrintf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lrint.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise. --- .../powerpc64/be/fpu/multiarch/Makefile | 7 ++- .../be/fpu/multiarch/s_llrint-power6x.c | 2 + .../be/fpu/multiarch/s_llrint-power8.c | 2 + .../be/fpu/multiarch/s_llrint-ppc64.c | 2 + .../{ => be}/fpu/multiarch/s_llrint.c | 0 .../{ => be}/fpu/multiarch/s_llrintf.c | 0 .../{ => be}/fpu/multiarch/s_lrint.c | 0 sysdeps/powerpc/powerpc64/fpu/Makefile | 5 ++ .../powerpc/powerpc64/fpu/multiarch/Makefile | 3 +- .../fpu/multiarch/s_llrint-power6x.S | 30 ---------- .../powerpc64/fpu/multiarch/s_llrint-power8.S | 30 ---------- .../powerpc64/fpu/multiarch/s_llrint-ppc64.S | 30 ---------- sysdeps/powerpc/powerpc64/fpu/s_llrint.S | 45 --------------- sysdeps/powerpc/powerpc64/fpu/s_llrint.c | 55 +++++++++++++++++++ sysdeps/powerpc/powerpc64/fpu/s_llrintf.S | 1 - sysdeps/powerpc/powerpc64/fpu/s_llrintf.c | 1 + sysdeps/powerpc/powerpc64/fpu/s_lrint.S | 1 - sysdeps/powerpc/powerpc64/fpu/s_lrint.c | 1 + sysdeps/powerpc/powerpc64/fpu/s_lrintf.c | 1 + .../powerpc/powerpc64/power6x/fpu/s_llrint.S | 42 -------------- .../powerpc/powerpc64/power8/fpu/s_llrint.S | 43 --------------- 21 files changed, 76 insertions(+), 225 deletions(-) create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llrint.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llrintf.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_lrint.c (100%) create mode 100644 sysdeps/powerpc/powerpc64/fpu/Makefile delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrint.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrint.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrintf.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrintf.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrint.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrint.c create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrintf.c delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index 53e600f5f6..febda6dbb3 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -14,7 +14,10 @@ libm-sysdep_routines += s_ceil-power5+ \ s_trunc-power5+ \ s_trunc-ppc64 \ s_truncf-power5+ \ - s_truncf-ppc64 + s_truncf-ppc64 \ + s_llrint-power8 \ + s_llrint-power6x \ + s_llrint-ppc64 CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ @@ -24,4 +27,6 @@ CFLAGS-s_round-power5+.c = -mcpu=power5+ CFLAGS-s_roundf-power5+.c = -mcpu=power5+ CFLAGS-s_trunc-power5+.c = -mcpu=power5+ CFLAGS-s_truncf-power5+.c = -mcpu=power5+ +CFLAGS-s_llrint-power8.c += -mcpu=power8 +CFLAGS-s_llrint-power6x.c += -mcpu=power6x endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c new file mode 100644 index 0000000000..ee139b4045 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c @@ -0,0 +1,2 @@ +#define __llrint __llrint_power6x +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c new file mode 100644 index 0000000000..0f5cbff69a --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c @@ -0,0 +1,2 @@ +#define __llrint __llrint_power8 +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c new file mode 100644 index 0000000000..40f212716b --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c @@ -0,0 +1,2 @@ +#define __llrint __llrint_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c diff --git a/sysdeps/powerpc/powerpc64/fpu/Makefile b/sysdeps/powerpc/powerpc64/fpu/Makefile new file mode 100644 index 0000000000..6988a1d396 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/Makefile @@ -0,0 +1,5 @@ +ifeq ($(subdir),math) +# lrintf and llrintf are aliased to llrint, so suppress compiler builtins to +# avoid mismatched signatures. +CFLAGS-s_llrint.c += -fno-builtin-lrintf -fno-builtin-llrintf +endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 4aa7fd6295..fec878bb9d 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -8,12 +8,11 @@ sysdep_calls := s_modf-power5+ s_modf-ppc64 \ sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_llround-power6x \ s_llround-power5+ s_llround-ppc64 \ - s_llrint-power6x s_llrint-ppc64 \ s_logb-power7 s_logbf-power7 \ s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ s_logbl-ppc64 e_hypot-ppc64 \ e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \ - s_llrint-power8 s_llround-power8 s_llroundf-ppc64 \ + s_llround-power8 s_llroundf-ppc64 \ e_expf-power8 e_expf-ppc64 \ $(sysdep_calls:s_%=m_%) diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S deleted file mode 100644 index 19f9dd2d80..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Round double to long int. PowerPC64/POWER6X default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llrint __llrint_power6x - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S deleted file mode 100644 index 93310e8662..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Round double to long int. PowerPC64/POWER6X default version. - Copyright (C) 2014-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llrint __llrint_power8 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S deleted file mode 100644 index 2811def336..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Round double to long int. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llrint __llrint_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S deleted file mode 100644 index 2e0d4dfdd0..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S +++ /dev/null @@ -1,45 +0,0 @@ -/* Round double to long int. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include -#include - -/* long long int[r3] __llrint (double x[fp1]) */ -ENTRY_TOCLESS (__llrint) - CALL_MCOUNT 0 - fctid fp13,fp1 - stfd fp13,-16(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - ld r3,-16(r1) - blr - END (__llrint) - -strong_alias (__llrint, __lrint) -libm_alias_double (__llrint, llrint) -libm_alias_double (__lrint, lrint) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llrint, __llrintf) -libm_alias_float (__llrint, llrint) -strong_alias (__lrint, __lrintf) -libm_alias_float (__lrint, lrint) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.c b/sysdeps/powerpc/powerpc64/fpu/s_llrint.c new file mode 100644 index 0000000000..968b70b79d --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_llrint.c @@ -0,0 +1,55 @@ +/* Round to nearest integer. PowerPC64 version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#define lrint __redirect_lrint +#define lrintf __redirect_lrintf +#define llrintf __redirect_llrintf +#define __lrint __redirect___lrint +#define __lrintf __redirect___lrintf +#define __llrintf __redirect___llrintf +#include +#undef lrint +#undef lrintf +#undef llrintf +#undef __lrint +#undef __lrintf +#undef __llrintf +#include +#include + +long long int +__llrint (double x) +{ + long int ret; + __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x)); + return ret; +} +#ifndef __llrint +strong_alias (__llrint, __lrint) +libm_alias_double (__llrint, llrint) +libm_alias_double (__lrint, lrint) + +/* The double version also works for single-precision as both float and + double parameters are passed in 64bit FPRs and both versions are expected + to return [long] long type. */ +strong_alias (__llrint, __llrintf) +libm_alias_float (__llrint, llrint) +strong_alias (__lrint, __lrintf) +libm_alias_float (__lrint, lrint) +#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S deleted file mode 100644 index ba7752311d..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S +++ /dev/null @@ -1 +0,0 @@ -/* __llrintf is in s_llrint.S. */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c new file mode 100644 index 0000000000..fd8ce33620 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c @@ -0,0 +1 @@ +/* llrintf is implemented at s_llrint.c */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrint.S b/sysdeps/powerpc/powerpc64/fpu/s_lrint.S deleted file mode 100644 index d3c2fff581..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_lrint.S +++ /dev/null @@ -1 +0,0 @@ -/* __lrint is in s_llrint.c */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrint.c b/sysdeps/powerpc/powerpc64/fpu/s_lrint.c new file mode 100644 index 0000000000..4e48d8ca00 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_lrint.c @@ -0,0 +1 @@ +/* lrint is implemented at s_llrint.c */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c b/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c new file mode 100644 index 0000000000..3f0c570a91 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c @@ -0,0 +1 @@ +/* lrintf is implemented at s_llrint.c */ diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S deleted file mode 100644 index edf3974c77..0000000000 --- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S +++ /dev/null @@ -1,42 +0,0 @@ -/* Round double to long int. POWER6x PowerPC64 version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include -#include - - .machine "power6" -/* long long int[r3] __llrint (double x[fp1]) */ -ENTRY_TOCLESS (__llrint) - CALL_MCOUNT 0 - fctid fp13,fp1 - mftgpr r3,fp13 - blr - END (__llrint) - -strong_alias (__llrint, __lrint) -libm_alias_double (__llrint, llrint) -libm_alias_double (__lrint, lrint) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llrint, __llrintf) -libm_alias_float (__llrint, llrint) -strong_alias (__lrint, __lrintf) -libm_alias_float (__lrint, lrint) diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S deleted file mode 100644 index dbd3ab89d6..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S +++ /dev/null @@ -1,43 +0,0 @@ -/* Round double to long int. POWER8 PowerPC64 version. - Copyright (C) 2014-2019 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 - . */ - -#include -#include -#include -#include - -#define MFVSRD_R3_V1 .long 0x7c230066 /* mfvsrd r3,vs1 */ - -/* long long int[r3] __llrint (double x[fp1]) */ -ENTRY_TOCLESS (__llrint) - CALL_MCOUNT 0 - fctid fp1,fp1 - MFVSRD_R3_V1 - blr -END (__llrint) - -strong_alias (__llrint, __lrint) -libm_alias_double (__llrint, llrint) -libm_alias_double (__lrint, lrint) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llrint, __llrintf) -libm_alias_float (__llrint, llrint) -strong_alias (__lrint, __lrintf) -libm_alias_float (__lrint, lrint) From patchwork Fri Mar 29 13:35:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161441 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2053218jan; Fri, 29 Mar 2019 06:39:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7RVn5oVVPL6/UCfEbnR9rRXTRfWQOOosRhB2itj2whRveFHRpp8bQQeSI7Lnd+aLbrsww X-Received: by 2002:a17:902:20eb:: with SMTP id v40mr48870764plg.20.1553866795922; Fri, 29 Mar 2019 06:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866795; cv=none; d=google.com; s=arc-20160816; b=LCKrGZcEPNNtyW2XCkr6unR01wC5URHelg9UisRYe8i5q7ku7UrbzfXBvDFUWV8Zm2 YPNsZbBDRwuZ9bX+nBVpoYljWLf6tduTwHvFXC8K0/wahXIYN+6jhq9S+UFLYPlBMsRX pOaESFBBNOS2dBABp3e8DyVAH+G+Yy+Qw1Ee3CDR6ikLi5ZKtXlg25/0Gc6VE5GshuI5 WkCJa4CRUyte5FuNaE+hSu3WzEMFbrZ810HXlPMAR8u+jieO6iTGUSTd4m+IekVHHkIo 92vWWkCMdcBu0F2xm2/+ev9tG9A/WYF4LBBHXyFJwhLsYroFzbamI+5EGBg7jVPcrdVc 68ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=ikw/7vsk/35JMvyCVZ+eW/P8Joj4OExcy9oJo4tde9Y=; b=YQJAvlHpiFX+rwXttd1EzFjzp+WTADRfEExd1TwoNeL00BKgq3DNG+G7cQh2kb1thM wfe7x+98k10NdFBB2hpPYUgA4S4yrXfWh/Khpv1lxjV1pcsOpPWSYvCFNuhF0viaGKdD YkoXAzgyBtLR1jSuvuZMSa57YVBcsWwWtI0z0Fh5lyW+ZNYGrdkpVg7Lq3ALJtiU/dA/ A+4qjoZa2tQxjxQyE5lyscTuLsDvQoMKWg7Y1LxFLv0zfH6QrFgjZj2i92b+eWfNdVIV o5T2Hq1r8Homv4AZZhK/2Ug1G5f7FoPex++nzPQZzewzkojAu5Q9guwv5pc8a07NDKui z60g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="yYwF/mHW"; dkim=pass header.i=@linaro.org header.s=google header.b=KQiseuD5; spf=pass (google.com: domain of libc-alpha-return-101010-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101010-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id w7si1912278pll.397.2019.03.29.06.39.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:39:55 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101010-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="yYwF/mHW"; dkim=pass header.i=@linaro.org header.s=google header.b=KQiseuD5; spf=pass (google.com: domain of libc-alpha-return-101010-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101010-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=d3/FZ/elDLkZcfVd8CA78uO2cW3B0QP 5vz2bVfE3koFypHlJ0qkhu0bEjSUm7/awXoy/5yInLrUsHL937RnystLdGWz8ot3 i/oV/udxStsWPy0yLYE8/lqTEGa3nOUeuvE/yb68zVUKBXb8dSZnoVHqM24kz9jW r82WzlTNG2TI= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Mig3TBrARxXwa2Gc9c1CudC8i18=; b=yYwF/ mHWd7brDcamA3JImHpqNxP3lK85Ef9TUKzp9jCeYOaFcfePVN/lh9EGPOvgZ1vEr bS3aKMhkDjw6LGaoBtD0AHk4uY5AaoYHLwP844DZeMxeorcuX8QofZwNzfQHtVTc eukpYOGcI/LOqigKw/0M/EkbcVufgvbgrfwA2I= Received: (qmail 122093 invoked by alias); 29 Mar 2019 13:36:22 -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 120715 invoked by uid 89); 29 Mar 2019 13:36:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=ikw/7vsk/35JMvyCVZ+eW/P8Joj4OExcy9oJo4tde9Y=; b=KQiseuD5Fudpeld3u5ywwqZ3kul+q61rwESpIAU3/QJIs/ys60sFym8lgxm2P9lUvW 2EzI34Pc3sYv3o4HfyZeaKMZx2WQpvghMCdGuRdtXHclaGDq8kYAHomlmdiuaVbtmLJH vZBH7uT85eN/pQTI0yEreFkpup3/A72MqTsXv9cvaBwWyyuAfvf/45I1WCwYd48uhPuH ZeZFb7985XsdxrFc28IAKgjooRs/1fmIW+/uYUSvYT2plIc4zFqaxLaHmLvM0UZgtoaK TP136isF9EaT0Njt6A4Mham4iqrt0zvsP5zLWeFq7k/YDlx4Z0KU+tYeyz3I98xyoPNJ XUag== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 19/28] powerpc: Refactor powerpc32 lrint/lrintf/llrint/llrintf Date: Fri, 29 Mar 2019 10:35:20 -0300 Message-Id: <20190329133529.22523-20-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc llrint{f} implementations on the generic sysdeps/powerpc/powerpc32/fpu/s_llrint{f}. The only missing optimization is the power6x one which I could not make GCC generates mftgpr for 32 bits output. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/s_lrintf.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/s_lrintf.c: Move to ... * sysdeps/powerpc/fpu/s_lrintf.c: ... here. * sysdeps/powerpc/powerpc32/fpu/Makefile [$(subdir) == math] (CFLAGS-s_lrint.c): New rule. * sysdeps/powerpc/powerpc32/fpu/s_llrint.c (__llrint): Add power4 optimization. * sysdeps/powerpc/powerpc32/fpu/s_llrintf.c (__llrintf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_lrint.c: New file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile (CFLAGS-s_llrintf-power6.c, CFLAGS-s_llrintf-ppc32.c, CFLAGS-s_llrint-power6.c, CFLAGS-s_llrint-ppc32.c, CFLAGS-s_lrint-ppc32.c): New rule. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c: New file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c: Likewise. --- sysdeps/powerpc/fpu/s_lrintf.S | 1 - .../powerpc/{powerpc64 => }/fpu/s_lrintf.c | 0 sysdeps/powerpc/powerpc32/fpu/Makefile | 6 +++ sysdeps/powerpc/powerpc32/fpu/s_llrint.c | 9 +++++ sysdeps/powerpc/powerpc32/fpu/s_llrintf.c | 7 ++++ sysdeps/powerpc/powerpc32/fpu/s_lrint.S | 40 ------------------- sysdeps/powerpc/powerpc32/fpu/s_lrint.c | 40 +++++++++++++++++++ .../powerpc32/power4/fpu/multiarch/Makefile | 5 +++ .../power4/fpu/multiarch/s_llrint-power6.S | 31 -------------- .../power4/fpu/multiarch/s_llrint-power6.c | 2 + .../power4/fpu/multiarch/s_llrint-ppc32.S | 31 -------------- .../power4/fpu/multiarch/s_llrint-ppc32.c | 2 + .../power4/fpu/multiarch/s_llrintf-power6.S | 26 ------------ .../power4/fpu/multiarch/s_llrintf-power6.c | 2 + .../power4/fpu/multiarch/s_llrintf-ppc32.S | 26 ------------ .../power4/fpu/multiarch/s_llrintf-ppc32.c | 2 + .../power4/fpu/multiarch/s_lrint-ppc32.S | 31 -------------- .../power4/fpu/multiarch/s_lrint-ppc32.c | 2 + .../powerpc/powerpc32/power4/fpu/s_llrint.S | 39 ------------------ .../powerpc/powerpc32/power4/fpu/s_llrintf.S | 39 ------------------ .../powerpc/powerpc32/power6/fpu/s_llrint.S | 39 ------------------ .../powerpc/powerpc32/power6/fpu/s_llrintf.S | 39 ------------------ 22 files changed, 77 insertions(+), 342 deletions(-) delete mode 100644 sysdeps/powerpc/fpu/s_lrintf.S rename sysdeps/powerpc/{powerpc64 => }/fpu/s_lrintf.c (100%) delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lrint.S create mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lrint.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/s_lrintf.S b/sysdeps/powerpc/fpu/s_lrintf.S deleted file mode 100644 index e24766535f..0000000000 --- a/sysdeps/powerpc/fpu/s_lrintf.S +++ /dev/null @@ -1 +0,0 @@ -/* __lrintf is in s_lrint.c */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c b/sysdeps/powerpc/fpu/s_lrintf.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/s_lrintf.c rename to sysdeps/powerpc/fpu/s_lrintf.c diff --git a/sysdeps/powerpc/powerpc32/fpu/Makefile b/sysdeps/powerpc/powerpc32/fpu/Makefile index e05073970d..c79b192f60 100644 --- a/sysdeps/powerpc/powerpc32/fpu/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/Makefile @@ -1,3 +1,9 @@ +ifeq ($(subdir),math) +# lrint is aliased to lrintf, so suppress compiler builtins to +# avoid mismatched signatures. +CFLAGS-s_lrint.c += -fno-builtin-lrintf +endif + ifeq ($(subdir),misc) sysdep_routines += fprsave fprrest endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c index 7e91d606c2..42558efd46 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c +++ b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c @@ -26,6 +26,12 @@ long long int __llrint (double x) { +#ifdef _ARCH_PWR4 + /* Assume powerpc64 instructions availability. */ + long long int ret; + __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x)); + return ret; +#else double rx = rint (x); if (HAVE_PPC_FCTIDZ || rx != x) return (long long int) rx; @@ -53,5 +59,8 @@ __llrint (double x) else return (long long int) (long int) rx << 32; } +#endif } +#ifndef __llrint libm_alias_double (__llrint, llrint) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c b/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c index 021a86fada..b75655e2c1 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c +++ b/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c @@ -24,6 +24,12 @@ long long int __llrintf (float x) { +#ifdef _ARCH_PWR4 + /* Assume powerpc64 instructions availability. */ + long long int ret; + __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x)); + return ret; +#else float rx = rintf (x); if (HAVE_PPC_FCTIDZ || rx != x) return (long long int) rx; @@ -43,5 +49,6 @@ __llrintf (float x) mant <<= exponent - 23; return (long long int) ((i0 & 0x80000000) != 0 ? -mant : mant); } +#endif } libm_alias_float (__llrint, llrint) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/s_lrint.S deleted file mode 100644 index fdad180116..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S +++ /dev/null @@ -1,40 +0,0 @@ -/* Round double to long int. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include -#include - -/* long int[r3] __lrint (double x[fp1]) */ -ENTRY (__lrint) - stwu r1,-16(r1) - fctiw fp13,fp1 - stfd fp13,8(r1) - nop /* Ensure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__lrint) - -libm_alias_double (__lrint, lrint) - -strong_alias (__lrint, __lrintf) -libm_alias_float (__lrint, lrint) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lrint.c b/sysdeps/powerpc/powerpc32/fpu/s_lrint.c new file mode 100644 index 0000000000..21bdc5c063 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_lrint.c @@ -0,0 +1,40 @@ +/* Round to nearest integer. PowerPC32 version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#define lrintf __redirect_lrintf +#define __lrintf __redirect___lrintf +#include +#undef lrintf +#undef __lrintf +#include +#include +#include + +long int +__lrint (double x) +{ + long long int ret; + __asm__ ("fctiw %0, %1" : "=d" (ret) : "d" (x)); + return ret; +} +#ifndef __lrint +libm_alias_double (__lrint, lrint) +strong_alias (__lrint, __lrintf) +libm_alias_float (__lrint, lrint) +#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile index 51b13fe33a..d33d403a1b 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile @@ -18,6 +18,11 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \ s_logbf-power7 s_logbf-ppc32 e_hypot-power7 \ e_hypot-ppc32 e_hypotf-power7 e_hypotf-ppc32 +CFLAGS-s_llrintf-power6.c += -mcpu=power6 +CFLAGS-s_llrintf-ppc32.c += -mcpu=power4 +CFLAGS-s_llrint-power6.c += -mcpu=power6 +CFLAGS-s_llrint-ppc32.c += -mcpu=power4 +CFLAGS-s_lrint-ppc32.c += -mcpu=power4 CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ CFLAGS-s_modf-power5+.c = -mcpu=power5+ diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S deleted file mode 100644 index 253a12bf72..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S +++ /dev/null @@ -1,31 +0,0 @@ -/* Round double to long int. PowerPC32/Power6. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llrint __llrint_power6 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c new file mode 100644 index 0000000000..328e11844f --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c @@ -0,0 +1,2 @@ +#define __llrint __llrint_power6 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S deleted file mode 100644 index e7bf6760c1..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S +++ /dev/null @@ -1,31 +0,0 @@ -/* llrint function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llrint __llrint_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c new file mode 100644 index 0000000000..8f192ab990 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c @@ -0,0 +1,2 @@ +#define __llrint __llrint_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S deleted file mode 100644 index c6b7769457..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S +++ /dev/null @@ -1,26 +0,0 @@ -/* Round float to long int. PowerPC32/POWER6 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) - -#define __llrintf __llrintf_power6 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c new file mode 100644 index 0000000000..5b1a5a8cf0 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c @@ -0,0 +1,2 @@ +#define __llrintf __llrintf_power6 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S deleted file mode 100644 index c592b31aff..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S +++ /dev/null @@ -1,26 +0,0 @@ -/* llrintf function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) - -#define __llrintf __llrintf_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c new file mode 100644 index 0000000000..061962b84d --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c @@ -0,0 +1,2 @@ +#define __llrintf __llrintf_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S deleted file mode 100644 index 617a9a7b8d..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S +++ /dev/null @@ -1,31 +0,0 @@ -/* Round double to long int. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __lrint __lrint_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c new file mode 100644 index 0000000000..ce2764b61b --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c @@ -0,0 +1,2 @@ +#define __lrint __lrint_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S deleted file mode 100644 index 3fdb5c3fe3..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S +++ /dev/null @@ -1,39 +0,0 @@ -/* Round double to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - -/* long long int[r3, r4] __llrint (double x[fp1]) */ -ENTRY (__llrint) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8+HIWORD(r1) - lwz r4,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__llrint) - -libm_alias_double (__llrint, llrint) diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S deleted file mode 100644 index 3a6364241e..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S +++ /dev/null @@ -1,39 +0,0 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - -/* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8+HIWORD(r1) - lwz r4,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__llrintf) - -libm_alias_float (__llrint, llrint) - diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S deleted file mode 100644 index e8134f7451..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S +++ /dev/null @@ -1,39 +0,0 @@ -/* Round double to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - -/* long long int[r3, r4] __llrint (double x[fp1]) */ -ENTRY (__llrint) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) -/* Insure the following load is in a different dispatch group by - inserting "group ending nop". */ - ori r1,r1,0 - lwz r3,8+HIWORD(r1) - lwz r4,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__llrint) - -libm_alias_double (__llrint, llrint) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S deleted file mode 100644 index b4d013f7a3..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S +++ /dev/null @@ -1,39 +0,0 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - -/* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) -/* Insure the following load is in a different dispatch group by - inserting "group ending nop". */ - ori r1,r1,0 - lwz r3,8+HIWORD(r1) - lwz r4,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__llrintf) - -libm_alias_float (__llrint, llrint) - From patchwork Fri Mar 29 13:35:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161446 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2054547jan; Fri, 29 Mar 2019 06:41:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdrt1q11OZpXo3ySo8lSd5kpA41umezm7oBUE676B+nAyrORm6rv+to9ltTJFGYyFAzVnf X-Received: by 2002:a17:902:8d8b:: with SMTP id v11mr49751642plo.241.1553866869076; Fri, 29 Mar 2019 06:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866869; cv=none; d=google.com; s=arc-20160816; b=Y5I2bhaTj80SsEtdVWflaUXkbWGp1048EGtes6X2LIVcvdwrZE/ALc9HefRlF9GlS6 oEOEbeYPClUvuB+8HuicaxOWaVfV0xTuB5CeD2F4nF/2CeS4YPoYjH/4lNL+Ywx44Lcd 6FO4Y6e6i31fLXSEcYEvASc5IuVmfJQq7QsidenatbjmyzwEy+sGjjaBbBazUzxsATng BGyskE3BfT/nCVxugF/xsfqJZOgNEhB623TWCPtPgxrjd9oh2chcFHO0JVRqUGeOoqp6 6xjpOo6KjEkxO/OBmKFI/tjBypcIoRvoQqi1MWjaJ48p/6sdZIxhMMUnF4+drNXqaGCz tGOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=L+6PefbU8uGC0zihQ4ocv8xLP5LQu7khzOcyOsRWGHo=; b=y9VRWzMs0ixvjt1j/mpm1rxOQHlNIe0NEohANhCE8XO1Ge1G7V2afmWpKKUrtr9d/C PrYAn4ziK/LIJfKx2gSalte8pnxG1GdQ/XSFY0qTXtOJlq2LL1+tnBqFm9djBgsi3o/7 WLyG8YTfHofvsMAFLxfKvCDRNC0V99SOYWbrad8IZ4oQb0RIB+yfl0xmz9y/+ceR5o3A vSeqruGUPiZOkqAtTRPnQIyBa2K07lpZVPaQxjRm3jNVrtHBKSq1id8ZjZSPGe2HIk1z 2ez61jSNKdIeggST5vuvToozGvNrftbbFi8MpMp2rJYHfXYPwugtjD/cSNChkhIquJp7 nHfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="YqW/GwXn"; dkim=pass header.i=@linaro.org header.s=google header.b=lW2DLdLI; spf=pass (google.com: domain of libc-alpha-return-101015-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101015-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 33si2006107pls.161.2019.03.29.06.41.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101015-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="YqW/GwXn"; dkim=pass header.i=@linaro.org header.s=google header.b=lW2DLdLI; spf=pass (google.com: domain of libc-alpha-return-101015-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101015-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=R5V7hxg1dRQN878bSL1IQrZnMS8n70K E61URfx84ELBohZrCwwozWqKjNpwQn3U45WBe1nFWw3sR6ptOgIhk18n6kWvT0wY puJjE5eSqw+uVgHwzIbSNakfFWUNmtkaEhfZED+bwGYwxX7fCanlpYkUTP35gQk5 3lXkPUrm0gMA= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=cOkKtbyRhwDAH+molisIiITLvmI=; b=YqW/G wXnXm1z+zitWdv4TJph4MFp0N/HgbiMjGe9qkCUEqw+8p95yuc2pvkST2C5ih/Ph /D0MObjY62+KS814cbD5tDAo34hoFuhMBAXED8opeT7EY3LTpwoJpdk2pmw1p6jH ggQ1DawLkUQefmCrk5EVJWrH/OMy9JX1ECN6rk= Received: (qmail 123347 invoked by alias); 29 Mar 2019 13:36:35 -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 121269 invoked by uid 89); 29 Mar 2019 13:36:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=L+6PefbU8uGC0zihQ4ocv8xLP5LQu7khzOcyOsRWGHo=; b=lW2DLdLIKgiiaWFHRKXbbs4NLbSok5D/tE6L7aLiCrVMoOGst1oKFTTyX9YPyhxkqi 8dciyDr5B6Y1vlDoUcszwpr4dsRHSX55D5q36hu3yNqz1eoRmKOTwlHEwTJ1Qhe4MGXr Woka1ajfKUxQF13VXYu1K8YY91re60WEed/JWbBCW9IBf80Sp7bK+6KUIcQoaRg7n7US xe9gvOzWPaqjB4eai+wOukmvEX49b5fhEe9YYVRTh+VQQ2TGqpRXkZKfNqTH8xqUYvca 9u/rAKnVS7ISjDly8kVzJd9PrHVSyz5qAG70xNxigX6dK/Vqiy2glxe2/198GKQh+31Q YMSQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 20/28] powerpc: Refactor powerpc64 lround/lroundf/llround/llroundf Date: Fri, 29 Mar 2019 10:35:21 -0300 Message-Id: <20190329133529.22523-21-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc {l}lround{f} implementations on the generic sysdeps/powerpc/fpu/s_{l}lround{f}.c. The IFUNC support is also moved only to powerpc64 only, since for powerpc64le generic implementation resulting in optimized code. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_llround-power8, s_llround-power6x, s_llround-power5+, s_llround-ppc64, and s_llroundf-ppc64. (CFLAGS-s_llround-power8.c, CFLAGS-s_llround-power6x.c, CFLAGS-s_llround-power5+.c): New rule. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power5+.c: New file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power6x.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power8.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lround.c: ... here. * sysdeps/powerpc/powerpc64/fpu/Makefile [$(subdir) == math] (CFLAGS-s_llround.c): New rule. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_llround-* objects. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lround.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lroundf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llround.c: New file. * sysdeps/powerpc/powerpc64/fpu/s_llroundf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lround.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lroundf.c: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_llroundf.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_llroundf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_llroundf.S: Likewise. --- .../powerpc64/be/fpu/multiarch/Makefile | 12 ++- .../be/fpu/multiarch/s_llround-power5+.c | 2 + .../be/fpu/multiarch/s_llround-power6x.c | 2 + .../be/fpu/multiarch/s_llround-power8.c | 2 + .../be/fpu/multiarch/s_llround-ppc64.c | 2 + .../{ => be}/fpu/multiarch/s_llround.c | 0 .../be/fpu/multiarch/s_llroundf-ppc64.c | 2 + .../{ => be}/fpu/multiarch/s_llroundf.c | 0 .../{ => be}/fpu/multiarch/s_lround.c | 0 sysdeps/powerpc/powerpc64/fpu/Makefile | 2 + .../powerpc/powerpc64/fpu/multiarch/Makefile | 5 +- .../fpu/multiarch/s_llround-power5+.S | 31 ------- .../fpu/multiarch/s_llround-power6x.S | 31 ------- .../fpu/multiarch/s_llround-power8.S | 30 ------- .../powerpc64/fpu/multiarch/s_llround-ppc64.S | 27 ------ .../fpu/multiarch/s_llroundf-ppc64.S | 31 ------- sysdeps/powerpc/powerpc64/fpu/s_llround.S | 86 ------------------ sysdeps/powerpc/powerpc64/fpu/s_llround.c | 83 +++++++++++++++++ sysdeps/powerpc/powerpc64/fpu/s_llroundf.S | 89 ------------------- sysdeps/powerpc/powerpc64/fpu/s_llroundf.c | 83 +++++++++++++++++ sysdeps/powerpc/powerpc64/fpu/s_lround.S | 1 - sysdeps/powerpc/powerpc64/fpu/s_lround.c | 1 + sysdeps/powerpc/powerpc64/fpu/s_lroundf.S | 1 - sysdeps/powerpc/powerpc64/fpu/s_lroundf.c | 1 + .../powerpc/powerpc64/power5+/fpu/s_llround.S | 56 ------------ .../powerpc64/power5+/fpu/s_llroundf.S | 1 - .../powerpc/powerpc64/power6x/fpu/s_llround.S | 52 ----------- .../powerpc64/power6x/fpu/s_llroundf.S | 1 - .../powerpc/powerpc64/power8/fpu/s_llround.S | 46 ---------- .../powerpc/powerpc64/power8/fpu/s_llroundf.S | 1 - 30 files changed, 190 insertions(+), 491 deletions(-) create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power5+.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power6x.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power8.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llround.c (100%) create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llroundf.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_lround.c (100%) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llround.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llround.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llroundf.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llroundf.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lround.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lround.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lroundf.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lroundf.c delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_llroundf.S delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_llroundf.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_llroundf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index febda6dbb3..9917cd15d5 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -17,7 +17,12 @@ libm-sysdep_routines += s_ceil-power5+ \ s_truncf-ppc64 \ s_llrint-power8 \ s_llrint-power6x \ - s_llrint-ppc64 + s_llrint-ppc64 \ + s_llround-power8 \ + s_llround-power6x \ + s_llround-power5+ \ + s_llround-ppc64 \ + s_llroundf-ppc64 CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ @@ -27,6 +32,7 @@ CFLAGS-s_round-power5+.c = -mcpu=power5+ CFLAGS-s_roundf-power5+.c = -mcpu=power5+ CFLAGS-s_trunc-power5+.c = -mcpu=power5+ CFLAGS-s_truncf-power5+.c = -mcpu=power5+ -CFLAGS-s_llrint-power8.c += -mcpu=power8 -CFLAGS-s_llrint-power6x.c += -mcpu=power6x +CFLAGS-s_llround-power8.c += -mcpu=power8 +CFLAGS-s_llround-power6x.c += -mcpu=power6x +CFLAGS-s_llround-power5+.c += -mcpu=power5+ endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power5+.c new file mode 100644 index 0000000000..182132b825 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power5+.c @@ -0,0 +1,2 @@ +#define __llround __llround_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power6x.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power6x.c new file mode 100644 index 0000000000..542319d56b --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power6x.c @@ -0,0 +1,2 @@ +#define __llround __llround_power6x +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power8.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power8.c new file mode 100644 index 0000000000..5d2b3b8d44 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power8.c @@ -0,0 +1,2 @@ +#define __llround __llround_power8 +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-ppc64.c new file mode 100644 index 0000000000..8793bd7814 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-ppc64.c @@ -0,0 +1,2 @@ +#define __llround __llround_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround.c diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf-ppc64.c new file mode 100644 index 0000000000..dba4c654db --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf-ppc64.c @@ -0,0 +1,2 @@ +#define __llroundf __llroundf_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lround.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lround.c diff --git a/sysdeps/powerpc/powerpc64/fpu/Makefile b/sysdeps/powerpc/powerpc64/fpu/Makefile index 6988a1d396..05075c2a75 100644 --- a/sysdeps/powerpc/powerpc64/fpu/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/Makefile @@ -2,4 +2,6 @@ ifeq ($(subdir),math) # lrintf and llrintf are aliased to llrint, so suppress compiler builtins to # avoid mismatched signatures. CFLAGS-s_llrint.c += -fno-builtin-lrintf -fno-builtin-llrintf +# Same as before but for lroundf and llroundf +CFLAGS-s_llround.c += -fno-builtin-lroundf -fno-builtin-llroundf endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index fec878bb9d..48cf8dca3b 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -6,13 +6,10 @@ sysdep_calls := s_modf-power5+ s_modf-ppc64 \ s_modff-power5+ s_modff-ppc64 sysdep_routines += $(sysdep_calls) -libm-sysdep_routines += s_llround-power6x \ - s_llround-power5+ s_llround-ppc64 \ - s_logb-power7 s_logbf-power7 \ +libm-sysdep_routines += s_logb-power7 s_logbf-power7 \ s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ s_logbl-ppc64 e_hypot-ppc64 \ e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \ - s_llround-power8 s_llroundf-ppc64 \ e_expf-power8 e_expf-ppc64 \ $(sysdep_calls:s_%=m_%) diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S deleted file mode 100644 index 59ec9d8dec..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S +++ /dev/null @@ -1,31 +0,0 @@ -/* llround(). PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llround __llround_power5plus -#define __lround __lround_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S deleted file mode 100644 index 127c1e9959..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S +++ /dev/null @@ -1,31 +0,0 @@ -/* llround(). PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __llround __llround_power6x -#define __lround __lround_power6x - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S deleted file mode 100644 index 4e36482f0a..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S +++ /dev/null @@ -1,30 +0,0 @@ -/* llround(). PowerPC64 default version. - Copyright (C) 2014-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __llround __llround_power8 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S deleted file mode 100644 index fe01c33002..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S +++ /dev/null @@ -1,27 +0,0 @@ -/* llround(). PowerPC64 default version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llround __llround_ppc64 -#define __lround __lround_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S deleted file mode 100644 index c62bb92e13..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S +++ /dev/null @@ -1,31 +0,0 @@ -/* llroundf(). PowerPC64 default version. - Copyright (C) 2017-2019 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 - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llroundf __llroundf_ppc64 -#define __lroundf __lroundf_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/fpu/s_llround.S deleted file mode 100644 index 7180779921..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_llround.S +++ /dev/null @@ -1,86 +0,0 @@ -/* llround function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include - - .section ".toc","aw" -.LC0: /* 2^52 */ - .tc FD_43300000_0[TC],0x4330000000000000 -.LC1: /* 0.5 */ - .tc FD_3fe00000_0[TC],0x3fe0000000000000 - .section ".text" - -/* long long [r3] llround (double x [fp1]) - IEEE 1003.1 llround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "round to Nearest" mode. Instead we set - "round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. - - It is necessary to detect when x is (+-)0x1.fffffffffffffp-2 - because adding +-0.5 in this case will cause an erroneous shift, - carry and round. We simply return 0 if 0.5 > x > -0.5. Likewise - if x is and odd number between +-(2^52 and 2^53-1) a shift and - carry will erroneously round if biased with +-0.5. Therefore if x - is greater/less than +-2^52 we don't need to bias the number with - +-0.5. */ - -ENTRY (__llround) - CALL_MCOUNT 0 - lfd fp9,.LC0@toc(2) /* Load 2^52 into fpr9. */ - lfd fp10,.LC1@toc(2)/* Load 0.5 into fpr10. */ - fabs fp2,fp1 /* Get the absolute value of x. */ - fsub fp12,fp10,fp10 /* Compute 0.0 into fp12. */ - fcmpu cr6,fp2,fp10 /* if |x| < 0.5 */ - fcmpu cr7,fp2,fp9 /* if |x| >= 2^52 */ - fcmpu cr1,fp1,fp12 /* x is negative? x < 0.0 */ - blt- cr6,.Lretzero /* 0.5 > x < -0.5 so just return 0. */ - bge- cr7,.Lnobias /* 2^52 > x < -2^52 just convert with no bias. */ - /* Test whether an integer to avoid spurious "inexact". */ - fadd fp3,fp2,fp9 - fsub fp3,fp3,fp9 - fcmpu cr5,fp2,fp3 - beq cr5,.Lnobias - fadd fp3,fp2,fp10 /* |x|+=0.5 bias to prepare to round. */ - bge cr1,.Lconvert /* x is positive so don't negate x. */ - fnabs fp3,fp3 /* -(|x|+=0.5) */ -.Lconvert: - fctidz fp4,fp3 /* Convert to Integer double word round toward 0. */ - stfd fp4,-16(r1) - nop - nop - nop - ld r3,-16(r1) /* Load return as integer. */ -.Lout: - blr -.Lretzero: /* 0.5 > x > -0.5 */ - li r3,0 /* return 0. */ - b .Lout -.Lnobias: - fmr fp3,fp1 - b .Lconvert - END (__llround) - -strong_alias (__llround, __lround) -libm_alias_double (__llround, llround) -libm_alias_double (__lround, lround) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llround.c b/sysdeps/powerpc/powerpc64/fpu/s_llround.c new file mode 100644 index 0000000000..6aa8fea195 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_llround.c @@ -0,0 +1,83 @@ +/* Round to nearest integer. PowerPC64 version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#define lround __redirect_lround +#define __lround __redirect___lround +#include +#undef lround +#undef __lround +#include +#include + +long long int +__llround (double x) +{ +#ifdef _ARCH_PWR5X + double r = __builtin_round (x); + /* Prevent gcc from calling llround directly when compiled with + -fno-math-errno by inserting a barrier. */ + math_opt_barrier (r); + return r; +#else + /* IEEE 1003.1 llround function. IEEE specifies "round to the nearest + integer value, rounding halfway cases away from zero, regardless of + the current rounding mode." However PowerPC Architecture defines + "round to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". + So we can't use the PowerPC "round to Nearest" mode. Instead we set + "round toward Zero" mode and round by adding +-0.5 before rounding + to the integer value. + + It is necessary to detect when x is (+-)0x1.fffffffffffffp-2 + because adding +-0.5 in this case will cause an erroneous shift, + carry and round. We simply return 0 if 0.5 > x > -0.5. Likewise + if x is and odd number between +-(2^52 and 2^53-1) a shift and + carry will erroneously round if biased with +-0.5. Therefore if x + is greater/less than +-2^52 we don't need to bias the number with + +-0.5. */ + + double ax = fabs (x); + + if (ax < 0.5) + return 0; + + if (ax < 0x1p+52) + { + /* Test whether an integer to avoid spurious "inexact". */ + double t = ax + 0x1p+52; + t = t - 0x1p+52; + if (ax != t) + { + ax = ax + 0.5; + if (x < 0.0) + ax = -fabs (ax); + x = ax; + } + } + + long int ret; + __asm__ ("fctidz %0, %1" : "=d" (ret) : "d" (x)); + return ret; +#endif +} +#ifndef __llround +strong_alias (__llround, __lround) +libm_alias_double (__llround, llround) +libm_alias_double (__lround, lround) +#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S deleted file mode 100644 index b8afebc7dc..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S +++ /dev/null @@ -1,89 +0,0 @@ -/* llroundf function. PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include - - .section ".toc","aw" -.LC0: /* 2^23 */ - .tc FD_41600000_0[TC],0x4160000000000000 -.LC1: /* 0.5 */ - .tc FD_3fe00000_0[TC],0x3fe0000000000000 -.LC2: /* 2^52 */ - .tc FD_43300000_0[TC],0x4330000000000000 - .section ".text" - -/* long long [r3] llroundf (float x [fp1]) - IEEE 1003.1 llroundf function. IEEE specifies "roundf to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "roundf to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "round to Nearest" mode. Instead we set - "round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. - - It is necessary to detect when x is (+-)0x1.fffffffffffffp-2 - because adding +-0.5 in this case will cause an erroneous shift, - carry and round. We simply return 0 if 0.5 > x > -0.5. Likewise - if x is and odd number between +-(2^23 and 2^24-1) a shift and - carry will erroneously round if biased with +-0.5. Therefore if x - is greater/less than +-2^23 we don't need to bias the number with - +-0.5. */ - -ENTRY (__llroundf) - CALL_MCOUNT 0 - lfd fp9,.LC0@toc(2) /* Load 2^23 into fpr9. */ - lfd fp10,.LC1@toc(2)/* Load 0.5 into fpr10. */ - lfd fp11,.LC2@toc(2) /* Load 2^52 into fpr11. */ - fabs fp2,fp1 /* Get the absolute value of x. */ - fsub fp12,fp10,fp10 /* Compute 0.0 into fp12. */ - fcmpu cr6,fp2,fp10 /* if |x| < 0.5 */ - fcmpu cr7,fp2,fp9 /* if |x| >= 2^23 */ - fcmpu cr1,fp1,fp12 /* x is negative? x < 0.0 */ - blt- cr6,.Lretzero /* 0.5 > x < -0.5 so just return 0. */ - bge- cr7,.Lnobias /* 2^23 > x < -2^23 just convert with no bias. */ - /* Test whether an integer to avoid spurious "inexact". */ - fadd fp3,fp2,fp11 - fsub fp3,fp3,fp11 - fcmpu cr5,fp2,fp3 - beq cr5,.Lnobias - fadd fp3,fp2,fp10 /* |x|+=0.5 bias to prepare to round. */ - bge cr1,.Lconvert /* x is positive so don't negate x. */ - fnabs fp3,fp3 /* -(|x|+=0.5) */ -.Lconvert: - fctidz fp4,fp3 /* Convert to Integer double word round toward 0. */ - stfd fp4,-16(r1) - nop - nop - nop - ld r3,-16(r1) /* Load return as integer. */ -.Lout: - blr -.Lretzero: /* 0.5 > x > -0.5 */ - li r3,0 /* return 0. */ - b .Lout -.Lnobias: - fmr fp3,fp1 - b .Lconvert - END (__llroundf) - -strong_alias (__llroundf, __lroundf) -libm_alias_float (__llround, llround) -libm_alias_float (__lround, lround) - diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.c b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.c new file mode 100644 index 0000000000..160c00ed6f --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.c @@ -0,0 +1,83 @@ +/* Round to nearest integer. PowerPC64 version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#define lroundf __redirect_llround +#define __lroundf __redirect___lround +#include +#undef lroundf +#undef __lroundf +#include +#include + +long long int +__llroundf (float x) +{ +#ifdef _ARCH_PWR5X + double r = __builtin_round (x); + /* Prevent gcc from calling llround directly when compiled with + -fno-math-errno by inserting a barrier. */ + math_opt_barrier (r); + return r; +#else + /* IEEE 1003.1 llroundf function. IEEE specifies "roundf to the nearest + integer value, rounding halfway cases away from zero, regardless of + the current rounding mode." However PowerPC Architecture defines + "roundf to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". + So we can't use the PowerPC "round to Nearest" mode. Instead we set + "round toward Zero" mode and round by adding +-0.5 before rounding + to the integer value. + + It is necessary to detect when x is (+-)0x1.fffffffffffffp-2 + because adding +-0.5 in this case will cause an erroneous shift, + carry and round. We simply return 0 if 0.5 > x > -0.5. Likewise + if x is and odd number between +-(2^23 and 2^24-1) a shift and + carry will erroneously round if biased with +-0.5. Therefore if x + is greater/less than +-2^23 we don't need to bias the number with + +-0.5. */ + + float ax = fabsf (x); + + if (ax < 0.5f) + return 0; + + if (ax < 0x1p+23f) + { + /* Test whether an integer to avoid spurious "inexact". */ + float t = ax + 0x1p+23f; + t = t - 0x1p+23f; + if (ax != t) + { + ax = ax + 0.5f; + if (x < 0.0f) + ax = -fabs (ax); + x = ax; + } + } + + long int ret; + __asm__ ("fctidz %0, %1" : "=d" (ret) : "d" (x)); + return ret; +#endif +} +#ifndef __llroundf +strong_alias (__llroundf, __lroundf) +libm_alias_float (__llround, lround) +libm_alias_float (__llround, llround) +#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lround.S b/sysdeps/powerpc/powerpc64/fpu/s_lround.S deleted file mode 100644 index 4306c405c4..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_lround.S +++ /dev/null @@ -1 +0,0 @@ -/* __lround is in s_llround.S */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lround.c b/sysdeps/powerpc/powerpc64/fpu/s_lround.c new file mode 100644 index 0000000000..bec5026777 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_lround.c @@ -0,0 +1 @@ +/* lround is implemented at s_llround.c as an alias to lround. */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lroundf.S b/sysdeps/powerpc/powerpc64/fpu/s_lroundf.S deleted file mode 100644 index 6b2a4e37a6..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_lroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __lroundf is in s_llroundf.S */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lroundf.c b/sysdeps/powerpc/powerpc64/fpu/s_lroundf.c new file mode 100644 index 0000000000..30400277f8 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_lroundf.c @@ -0,0 +1 @@ +/* __lroundf is in s_llroundf.c */ diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S deleted file mode 100644 index 7a37808bb0..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S +++ /dev/null @@ -1,56 +0,0 @@ -/* llround function. POWER5+, PowerPC64 version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include -#include - -/* long long [r3] llround (float x [fp1]) - IEEE 1003.1 llround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we pre-round using the V2.02 Floating Round to Integer Nearest - instruction before we use Floating Convert to Integer Word with - round to zero instruction. */ - - .machine "power5" -ENTRY_TOCLESS (__llround, 4) - CALL_MCOUNT 0 - frin fp2, fp1 /* Round to nearest +-0.5. */ - fctidz fp3, fp2 /* Convert To Integer DW round toward 0. */ - stfd fp3, -16(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - ld r3, -16(r1) - blr - END (__llround) - -strong_alias (__llround, __lround) -libm_alias_double (__llround, llround) -libm_alias_double (__lround, lround) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llround, __llroundf) -libm_alias_float (__llround, llround) -strong_alias (__lround, __lroundf) -libm_alias_float (__lround, lround) diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_llroundf.S deleted file mode 100644 index 9ea6bd105b..0000000000 --- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __lroundf is in s_llround.S. */ diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S deleted file mode 100644 index ad9010ab37..0000000000 --- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S +++ /dev/null @@ -1,52 +0,0 @@ -/* llround function. POWER6x PowerPC64 version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include -#include - -/* long long [r3] llround (float x [fp1]) - IEEE 1003.1 llround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we pre-round using the V2.02 Floating Round to Integer Nearest - instruction before we use Floating Convert to Integer Word with - round to zero instruction. */ - - .machine "power6" -ENTRY_TOCLESS (__llround) - CALL_MCOUNT 0 - frin fp2,fp1 /* Round to nearest +-0.5. */ - fctidz fp3,fp2 /* Convert To Integer DW round toward 0. */ - mftgpr r3,fp3 /* Transfer integer to R3. */ - blr - END (__llround) - -strong_alias (__llround, __lround) -libm_alias_double (__llround, llround) -libm_alias_double (__lround, lround) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llround, __llroundf) -libm_alias_float (__llround, llround) -strong_alias (__lround, __lroundf) -libm_alias_float (__lround, lround) diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llroundf.S deleted file mode 100644 index 9ea6bd105b..0000000000 --- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __lroundf is in s_llround.S. */ diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S deleted file mode 100644 index 12081204e2..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S +++ /dev/null @@ -1,46 +0,0 @@ -/* llround function. POWER8 PowerPC64 version. - Copyright (C) 2014-2019 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 - . */ - -#include -#include -#include -#include -#include - -#define MFVSRD_R3_V1 .long 0x7c230066 /* mfvsrd r3,vs1 */ - -/* long long [r3] llround (float x [fp1]) */ - -ENTRY_TOCLESS (__llround) - CALL_MCOUNT 0 - frin fp1,fp1 /* Round to nearest +-0.5. */ - fctidz fp1,fp1 /* Convert To Integer DW round toward 0. */ - MFVSRD_R3_V1 - blr -END (__llround) - -strong_alias (__llround, __lround) -libm_alias_double (__llround, llround) -libm_alias_double (__lround, lround) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llround, __llroundf) -libm_alias_float (__llround, llround) -strong_alias (__lround, __lroundf) -libm_alias_float (__lround, lround) diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llroundf.S deleted file mode 100644 index 9ea6bd105b..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __lroundf is in s_llround.S. */ From patchwork Fri Mar 29 13:35:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161449 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2055251jan; Fri, 29 Mar 2019 06:41:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzGRMowquUTbex+R+/5MwIrPiiiIUw92zGZuYrTzUFUCs1HQaFxayX2t0pyEJceaSr3e+F X-Received: by 2002:a17:902:8bca:: with SMTP id r10mr38814762plo.67.1553866911389; Fri, 29 Mar 2019 06:41:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866911; cv=none; d=google.com; s=arc-20160816; b=mcy6MbYRnOAWZXZEDHx8x3L1DQdjyufVoKQaAw4OUBvJ1w+aT1twfUmnEQS+e2CqtI cJASCIqg4zfpc0E/JokvQTxdVt2ciOsAE6xMBIWrPQL0ZtAfDtDAmKwAPWR6sTqE5d0L ERViVUb0dNVgYrzy0UDkcc8KEj6qo7RAMuX3piB5yq1r9k07C6u0Hqv5j4BRkNtlpZfT LjgfwJOFyvy1iCbfcNJw9fly4fgke8v+XicvV4DaxvFW3FGeEkIoMk1H+TueqWSk6qYj Ra1Wnt7MiHcJ7ypPAsYwuqLHgSOO9fsjAVJHRNGo2AeAru4ssNSoe9DtBaiBvmAneJ6m VjbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=y7hDoDPm7xa4KUIeRhgc0uJ+6/iWhVuzW4W4DS9A3H0=; b=oP5M+xoEbE/skX4YGHYq/cWzVN6LEvsicxFjJrM9gC46GWrrKNxa8TQz+W3HMf/ACS Ov8zngWqcuwFy6vzsKZ9qT2KbhputNSZGX2bet5Y6sDe32hgBkuVWdCtICe1ixqsmtSy qpucNS8w/QvUtiAGY76BWMl/fvaeKMUBQltKVQTYEUOqImL03xofueD2wYretIMdxK5F Tm6/NgjYzf7+/rmBsXZvCAhLaUU4itTwNkuug69UzpdG7Si0cPtI42sLf6qmLf3Yo2v8 Ym/PsWmF59OmASniDGJxytZZrivMYcMW4xJ+NJ5UXi6NUuettqvr2KzL3m8L2Dj0na5U YB+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=WLNRhYz9; dkim=pass header.i=@linaro.org header.s=google header.b=jsc1gl0x; spf=pass (google.com: domain of libc-alpha-return-101018-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101018-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q61si2038696plb.308.2019.03.29.06.41.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:41:51 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101018-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=WLNRhYz9; dkim=pass header.i=@linaro.org header.s=google header.b=jsc1gl0x; spf=pass (google.com: domain of libc-alpha-return-101018-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101018-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Ioq4gyd2AgshNeKVtzo+fqefD8ZKeS6 QQDaqyrkyhFNd6IIHFLg6Av38pXQNhD+rPHEQ5dPuhjDrZl123ny3HtIlKjAgE5C CBVDFW/KgPEzzqC7Qo2Can9lclgedU0dgioFaXZ0BOjMW0ZDU9aPXDUxjRADgSMk CoKvaew2wXyE= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=FdBl6bl8b0lEDcqFW7/wX2FOlkA=; b=WLNRh Yz9Q3FrS9k8PI55YQv6aq7YOBtfLLXMmVdtySMG0+qRraYoWVo5lfa3ixMWvtqES K0YFiWMxfjnf06EfUz7pFobVZ6h8euW6taZ2oBSjdWk1GxNL38f6zAFm8v/UL22N 3gEjYcMPCQuWiBJE09s1xEJ6GIgMe6az3+gl4c= Received: (qmail 123692 invoked by alias); 29 Mar 2019 13:36:39 -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 121370 invoked by uid 89); 29 Mar 2019 13:36:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f68.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=y7hDoDPm7xa4KUIeRhgc0uJ+6/iWhVuzW4W4DS9A3H0=; b=jsc1gl0xWuCosxurNeEbrFKHd4YWUvaPIok8788ALO14KqsI7GJN94m6cQyKqbwSu2 ipQtsCszHNYSlPOBVPJkiNjvLwOKQYMgO2KxsM85Dj/wtsTuVvWW3VhtECJNm3fWmhBC CVFekYetb4wact1hpIIZDGRyTUfU2iOQHb9jkNxMU/vTJnly8aL7Mj6FfijRcq8St4EW CcuoZayEnu2Y+Jf+9cD76vhSGuAOVUQ1+GPeR5p2O5oTfO9cWxj7fcfMtpTBkxWv4rRk xKEXdZhjiM/w5RJY3G1hr8iS5KFjxMLcDuNQnu4xYXN/i5LVZ8Loa/OxZVYlFBKEv8U4 JvGg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 21/28] powerpc: Refactor powerpc32 lround/lroundf/llround/llroundf Date: Fri, 29 Mar 2019 10:35:22 -0300 Message-Id: <20190329133529.22523-22-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc llround{f} implementations on the generic sysdeps/powerpc/powerpc32/fpu/s_llround{f}. The only missing optimization is the power6x one which I could not make GCC generates mftgpr for 32 bits output. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/powerpc32/fpu/Makefile [$(subdir) == math] (CFLAGS-s_lround.c): New rule. * sysdeps/powerpc/powerpc32/fpu/s_llround.c (__llround): Add power5+ and fctidz optimization. * sysdeps/powerpc/powerpc32/fpu/s_lround.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_lround.c: New file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile (CFLAGS-s_llround-power6.c, CFLAGS-s_llround-power5+.c, CFLAGS-s_llround-ppc32.c, CFLAGS-s_lround-ppc32.c, CFLAGS-s_lround-power5+.c): New rule. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.c: New file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.S: Remove file. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S: Likewise. * sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S: Likewise. * sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S: Likewise. --- sysdeps/powerpc/powerpc32/fpu/Makefile | 1 + sysdeps/powerpc/powerpc32/fpu/s_llround.c | 51 +++++++- sysdeps/powerpc/powerpc32/fpu/s_lround.S | 123 ------------------ sysdeps/powerpc/powerpc32/fpu/s_lround.c | 77 +++++++++++ .../powerpc32/power4/fpu/multiarch/Makefile | 5 + .../power4/fpu/multiarch/s_llround-power5+.S | 31 ----- .../power4/fpu/multiarch/s_llround-power5+.c | 2 + .../power4/fpu/multiarch/s_llround-power6.S | 31 ----- .../power4/fpu/multiarch/s_llround-power6.c | 2 + .../power4/fpu/multiarch/s_llround-ppc32.S | 31 ----- .../power4/fpu/multiarch/s_llround-ppc32.c | 2 + .../power4/fpu/multiarch/s_lround-power5+.S | 33 ----- .../power4/fpu/multiarch/s_lround-power5+.c | 2 + .../power4/fpu/multiarch/s_lround-ppc32.S | 31 ----- .../power4/fpu/multiarch/s_lround-ppc32.c | 2 + .../powerpc/powerpc32/power4/fpu/s_llround.S | 105 --------------- .../powerpc/powerpc32/power4/fpu/s_llroundf.S | 1 - .../powerpc/powerpc32/power5+/fpu/s_llround.S | 53 -------- .../powerpc32/power5+/fpu/s_llroundf.S | 1 - .../powerpc/powerpc32/power5+/fpu/s_lround.S | 51 -------- .../powerpc/powerpc32/power6/fpu/s_llround.S | 53 -------- .../powerpc/powerpc32/power6/fpu/s_llroundf.S | 1 - 22 files changed, 142 insertions(+), 547 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lround.S create mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lround.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.S create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/powerpc32/fpu/Makefile b/sysdeps/powerpc/powerpc32/fpu/Makefile index c79b192f60..b8b6bb0fa2 100644 --- a/sysdeps/powerpc/powerpc32/fpu/Makefile +++ b/sysdeps/powerpc/powerpc32/fpu/Makefile @@ -2,6 +2,7 @@ ifeq ($(subdir),math) # lrint is aliased to lrintf, so suppress compiler builtins to # avoid mismatched signatures. CFLAGS-s_lrint.c += -fno-builtin-lrintf +CFLAGS-s_lround.c += -fno-builtin-lroundf endif ifeq ($(subdir),misc) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llround.c b/sysdeps/powerpc/powerpc32/fpu/s_llround.c index 14d10e1e63..dc9f41b8e7 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_llround.c +++ b/sysdeps/powerpc/powerpc32/fpu/s_llround.c @@ -18,10 +18,10 @@ #include #include -#include #include #include #include +#include /* Round to the nearest integer, with values exactly on a 0.5 boundary rounded away from zero, regardless of the current rounding mode. @@ -31,9 +31,53 @@ long long int __llround (double x) { +#ifdef _ARCH_PWR5X + x = round (x); + /* The barrier prevents compiler from optimizing it to llround when + compiled with -fno-math-errno */ + math_opt_barrier (x); + return x; +#else long long xr; if (HAVE_PPC_FCTIDZ) - xr = (long long) x; + { + /* IEEE 1003.1 lround function. IEEE specifies "round to the nearest + integer value, rounding halfway cases away from zero, regardless of + the current rounding mode." However PowerPC Architecture defines + "round to Nearest" as "Choose the best approximation. In case of a + tie, choose the one that is even (least significant bit o).". + So we can't use the PowerPC "round to Nearest" mode. Instead we set + "round toward Zero" mode and round by adding +-0.5 before rounding + to the integer value. + + It is necessary to detect when x is (+-)0x1.fffffffffffffp-2 + because adding +-0.5 in this case will cause an erroneous shift, + carry and round. We simply return 0 if 0.5 > x > -0.5. Likewise + if x is and odd number between +-(2^52 and 2^53-1) a shift and + carry will erroneously round if biased with +-0.5. Therefore if x + is greater/less than +-2^52 we don't need to bias the number with + +-0.5. */ + double ax = fabs (x); + + if (ax < 0.5) + return 0; + + if (ax < 0x1p+52) + { + /* Test whether an integer to avoid spurious "inexact". */ + double t = ax + 0x1p+52; + t = t - 0x1p+52; + if (ax != t) + { + ax = ax + 0.5; + if (x < 0.0) + ax = -fabs (ax); + x = ax; + } + } + + return x; + } else { /* Avoid incorrect exceptions from libgcc conversions (as of GCC @@ -80,5 +124,8 @@ __llround (double x) xr -= (long long) ((unsigned long long) xr - 1) < 0; } return xr; +#endif } +#ifndef __llround libm_alias_double (__llround, llround) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/s_lround.S deleted file mode 100644 index 2d9540ceed..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/s_lround.S +++ /dev/null @@ -1,123 +0,0 @@ -/* lround function. PowerPC32 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include -#include - - .section .rodata.cst4,"aM",@progbits,4 - .align 2 -.LC0: /* 0.5 */ - .long 0x3f000000 -.LC1: /* 2^52. */ - .long 0x59800000 - .section .rodata.cst8,"aM",@progbits,8 - .align 3 -.LC2: /* 0x7fffffff.8p0. */ - .long 0x41dfffff - .long 0xffe00000 -.LC3: /* -0x80000000.8p0. */ - .long 0xc1e00000 - .long 0x00100000 - .section ".text" - -/* long [r3] lround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "round to Nearest" mode. Instead we set - "round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. It is necessary to detect when x is - (+-)0x1.fffffffffffffp-2 because adding +-0.5 in this case will - cause an erroneous shift, carry and round. We simply return 0 if - 0.5 > x > -0.5. */ - -ENTRY (__lround) - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r10,r9,.LC0-got_label@ha - lfs fp10,.LC0-got_label@l(r10) - addis r10,r9,.LC1-got_label@ha - lfs fp11,.LC1-got_label@l(r10) - addis r10,r9,.LC2-got_label@ha - lfd fp9,.LC2-got_label@l(r10) - addis r10,r9,.LC3-got_label@ha - lfd fp8,.LC3-got_label@l(r10) - mtlr r11 - cfi_same_value (lr) -#else - lis r9,.LC0@ha - lfs fp10,.LC0@l(r9) - lis r9,.LC1@ha - lfs fp11,.LC1@l(r9) - lis r9,.LC2@ha - lfd fp9,.LC2@l(r9) - lis r9,.LC3@ha - lfd fp8,.LC3@l(r9) -#endif - fabs fp2, fp1 /* Get the absolute value of x. */ - fsub fp12,fp10,fp10 /* Compute 0.0. */ - fcmpu cr6, fp2, fp10 /* if |x| < 0.5 */ - fcmpu cr5, fp1, fp9 /* if x >= 0x7fffffff.8p0 */ - fcmpu cr1, fp1, fp8 /* if x <= -0x80000000.8p0 */ - fcmpu cr7, fp1, fp12 /* x is negative? x < 0.0 */ - blt- cr6,.Lretzero - bge- cr5,.Loflow - ble- cr1,.Loflow - /* Test whether an integer to avoid spurious "inexact". */ - fadd fp3,fp2,fp11 - fsub fp3,fp3,fp11 - fcmpu cr5, fp2, fp3 - beq cr5,.Lnobias - fadd fp3,fp2,fp10 /* |x|+=0.5 bias to prepare to round. */ - bge cr7,.Lconvert /* x is positive so don't negate x. */ - fnabs fp3,fp3 /* -(|x|+=0.5) */ -.Lconvert: - fctiwz fp4,fp3 /* Convert to Integer word lround toward 0. */ - stfd fp4,8(r1) - nop /* Ensure the following load is in a different dispatch */ - nop /* group to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8+LOWORD(r1) /* Load return as integer. */ -.Lout: - addi r1,r1,16 - blr -.Lretzero: /* when 0.5 > x > -0.5 */ - li r3,0 /* return 0. */ - b .Lout -.Lnobias: - fmr fp3,fp1 - b .Lconvert -.Loflow: - fmr fp3,fp11 - bge cr7,.Lconvert - fnabs fp3,fp3 - b .Lconvert - END (__lround) - -libm_alias_double (__lround, lround) - -strong_alias (__lround, __lroundf) -libm_alias_float (__lround, lround) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lround.c b/sysdeps/powerpc/powerpc32/fpu/s_lround.c new file mode 100644 index 0000000000..28c06d25d2 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_lround.c @@ -0,0 +1,77 @@ +/* lround function. PowerPC32 version. + Copyright (C) 2004-2019 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 + . */ + +#define lroundf __redirect_lroundf +#define __lroundf __redirect___lroundf +#include +#undef lroundf +#undef __lroundf +#include +#include + +long int +__lround (double x) +{ +#ifdef _ARCH_PWR5X + x = round (x); +#else + /* Ieee 1003.1 lround function. ieee specifies "round to the nearest + integer value, rounding halfway cases away from zero, regardless of + the current rounding mode." however powerpc architecture defines + "round to nearest" as "choose the best approximation. in case of a + tie, choose the one that is even (least significant bit o).". + so we can't use the powerpc "round to nearest" mode. instead we set + "round toward zero" mode and round by adding +-0.5 before rounding + to the integer value. it is necessary to detect when x is + (+-)0x1.fffffffffffffp-2 because adding +-0.5 in this case will + cause an erroneous shift, carry and round. we simply return 0 if + 0.5 > x > -0.5. */ + + double ax = fabs (x); + + if (ax < 0.5) + return 0; + + if (x >= 0x7fffffff.8p0 || x <= -0x80000000.8p0) + x = (x < 0.0) ? -0x1p+52 : 0x1p+52; + else + { + /* Test whether an integer to avoid spurious "inexact". */ + double t = ax + 0x1p+52; + t = t - 0x1p+52; + if (ax != t) + { + ax = ax + 0.5; + if (x < 0.0) + ax = -fabs (ax); + x = ax; + } + } +#endif + /* Force evaluation of values larger than long int, so invalid + exceptions are raise. */ + long long int ret; + asm ("fctiwz %0, %1" : "=d" (ret) : "d" (x)); + return ret; +} +#ifndef __lround +libm_alias_double (__lround, lround) + +strong_alias (__lround, __lroundf) +libm_alias_float (__lround, lround) +#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile index d33d403a1b..60f2c95532 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile @@ -23,6 +23,11 @@ CFLAGS-s_llrintf-ppc32.c += -mcpu=power4 CFLAGS-s_llrint-power6.c += -mcpu=power6 CFLAGS-s_llrint-ppc32.c += -mcpu=power4 CFLAGS-s_lrint-ppc32.c += -mcpu=power4 +CFLAGS-s_llround-power6.c += -mcpu=power6 +CFLAGS-s_llround-power5+.c += -mcpu=power5+ +CFLAGS-s_llround-ppc32.c += -mcpu=power4 +CFLAGS-s_lround-ppc32.c += -mcpu=power4 +CFLAGS-s_lround-power5+.c += -mcpu=power5+ CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ CFLAGS-s_modf-power5+.c = -mcpu=power5+ diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.S deleted file mode 100644 index 80fc5b0f6c..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.S +++ /dev/null @@ -1,31 +0,0 @@ -/* lround function. PowerPC32/POWER5+ version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llround __llround_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.c new file mode 100644 index 0000000000..794fad71c2 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.c @@ -0,0 +1,2 @@ +#define __llround __llround_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.S deleted file mode 100644 index d6d9a0a4cb..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.S +++ /dev/null @@ -1,31 +0,0 @@ -/* lround function. PowerPC32/POWER6 version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llround __llround_power6 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.c new file mode 100644 index 0000000000..2b588c4c54 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.c @@ -0,0 +1,2 @@ +#define __llround __llround_power6 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.S deleted file mode 100644 index 085fbc6de4..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.S +++ /dev/null @@ -1,31 +0,0 @@ -/* llround function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llround __llround_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.c new file mode 100644 index 0000000000..3b5ff344bd --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.c @@ -0,0 +1,2 @@ +#define __llround __llround_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.S deleted file mode 100644 index 350315e38b..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.S +++ /dev/null @@ -1,33 +0,0 @@ -/* lround function. POWER5+, PowerPC32 version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef hidden_def -#define hidden_def(name) -#undef weak_alias -#define weak_alias(name, alias) -#undef strong_alias -#define strong_alias(name, alias) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - -#define __lround __lround_power5plus - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.c new file mode 100644 index 0000000000..d6a17c4bca --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.c @@ -0,0 +1,2 @@ +#define __lround __lround_power5plus +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.S deleted file mode 100644 index 245a682720..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.S +++ /dev/null @@ -1,31 +0,0 @@ -/* lround function. PowerPC32 default version. - Copyright (C) 2013-2019 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 - . */ - -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __lround __lround_ppc32 - -#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.c new file mode 100644 index 0000000000..5355e1f712 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.c @@ -0,0 +1,2 @@ +#define __lround __lround_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S deleted file mode 100644 index 3d6ba34180..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S +++ /dev/null @@ -1,105 +0,0 @@ -/* llround function. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2019 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 - . */ - -#include -#include -#include -#include - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 - .LC0: .long (52+127)<<23 /* 0x1p+52 */ - .long (-1+127)<<23 /* 0.5 */ - - .section ".text" - -/* long [r3] lround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we can't use the PowerPC "round to Nearest" mode. Instead we set - "round toward Zero" mode and round by adding +-0.5 before rounding - to the integer value. - - It is necessary to detect when x is (+-)0x1.fffffffffffffp-2 - because adding +-0.5 in this case will cause an erroneous shift, - carry and round. We simply return 0 if 0.5 > x > -0.5. Likewise - if x is and odd number between +-(2^52 and 2^53-1) a shift and - carry will erroneously round if biased with +-0.5. Therefore if x - is greater/less than +-2^52 we don't need to bias the number with - +-0.5. */ - -ENTRY (__llround) - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) -#ifdef SHARED - mflr r11 - cfi_register(lr,r11) - SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,.LC0-got_label@ha - addi r9,r9,.LC0-got_label@l - mtlr r11 - cfi_same_value (lr) - lfs fp9,0(r9) - lfs fp10,4(r9) -#else - lis r9,.LC0@ha - lfs fp9,.LC0@l(r9) /* Load 2^52 into fpr9. */ - lfs fp10,.LC0@l+4(r9) /* Load 0.5 into fpr10. */ -#endif - fabs fp2,fp1 /* Get the absolute value of x. */ - fsub fp12,fp10,fp10 /* Compute 0.0 into fpr12. */ - fcmpu cr6,fp2,fp10 /* if |x| < 0.5 */ - fcmpu cr7,fp2,fp9 /* if |x| >= 2^52 */ - fcmpu cr1,fp1,fp12 /* x is negative? x < 0.0 */ - blt- cr6,.Lretzero /* 0.5 > x < -0.5 so just return 0. */ - bge- cr7,.Lnobias /* 2^52 > x < -2^52 just convert with no bias. */ - /* Test whether an integer to avoid spurious "inexact". */ - fadd fp3,fp2,fp9 - fsub fp3,fp3,fp9 - fcmpu cr5,fp2,fp3 - beq cr5,.Lnobias - fadd fp3,fp2,fp10 /* |x|+=0.5 bias to prepare to round. */ - bge cr1,.Lconvert /* x is positive so don't negate x. */ - fnabs fp3,fp3 /* -(|x|+=0.5) */ -.Lconvert: - fctidz fp4,fp3 /* Convert to Integer double word round toward 0. */ - stfd fp4,8(r1) - nop - nop - nop - lwz r3,8+HIWORD(r1) /* Load return as integer. */ - lwz r4,8+LOWORD(r1) -.Lout: - addi r1,r1,16 - blr -.Lretzero: /* 0.5 > x > -0.5 */ - li r3,0 /* return 0. */ - li r4,0 - b .Lout -.Lnobias: - fmr fp3,fp1 - b .Lconvert - END (__llround) - -libm_alias_double (__llround, llround) - -strong_alias (__llround, __llroundf) -libm_alias_float (__llround, llround) diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S deleted file mode 100644 index 72d6181541..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __llroundf is in s_llround.S */ diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S deleted file mode 100644 index 5035170d94..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S +++ /dev/null @@ -1,53 +0,0 @@ -/* lround function. POWER5+, PowerPC32 version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include -#include - -/* long [r3] llround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we pre-round using the V2.02 Floating Round to Integer Nearest - instruction before we use the Floating Convert to Integer Word with - round to zero instruction. */ - - .machine "power5" -ENTRY (__llround) - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - frin fp2,fp1 - fctidz fp3,fp2 /* Convert To Integer Word lround toward 0. */ - stfd fp3,8(r1) - nop /* Ensure the following load is in a different dispatch */ - nop /* group to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8+HIWORD(r1) - lwz r4,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__llround) - -libm_alias_double (__llround, llround) - -strong_alias (__llround, __llroundf) -libm_alias_float (__llround, llround) diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S deleted file mode 100644 index 030d2fdff8..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __llroundf is in s_llround.S */ diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S deleted file mode 100644 index f30a0bff3e..0000000000 --- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S +++ /dev/null @@ -1,51 +0,0 @@ -/* lround function. POWER5+, PowerPC32 version. - Copyright (C) 2006-2019 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 - . */ -#include -#include -#include -#include - -/* long [r3] lround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we pre-round using the V2.02 Floating Round to Integer Nearest - instruction before we use the Floating Convert to Integer Word with - round to zero instruction. */ - - .machine "power5" -ENTRY (__lround) - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - frin fp2,fp1 - fctiwz fp3,fp2 /* Convert To Integer Word lround toward 0. */ - stfd fp3,8(r1) - nop /* Ensure the following load is in a different dispatch */ - nop /* group to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__lround) - -libm_alias_double (__lround, lround) - -strong_alias (__lround, __lroundf) -libm_alias_float (__lround, lround) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S deleted file mode 100644 index 7ba312cc6b..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S +++ /dev/null @@ -1,53 +0,0 @@ -/* lround function. POWER5+, PowerPC32 version. - Copyright (C) 2006-2019 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 - . */ - -#include -#include -#include -#include - -/* long [r3] llround (float x [fp1]) - IEEE 1003.1 lround function. IEEE specifies "round to the nearest - integer value, rounding halfway cases away from zero, regardless of - the current rounding mode." However PowerPC Architecture defines - "round to Nearest" as "Choose the best approximation. In case of a - tie, choose the one that is even (least significant bit o).". - So we pre-round using the V2.02 Floating Round to Integer Nearest - instruction before we use the Floating Convert to Integer Word with - round to zero instruction. */ - - .machine "power5" -ENTRY (__llround) - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - frin fp2,fp1 - fctidz fp3,fp2 /* Convert To Integer Word lround toward 0. */ - stfd fp3,8(r1) -/* Insure the following load is in a different dispatch group by - inserting "group ending nop". */ - ori r1,r1,0 - lwz r3,8+HIWORD(r1) - lwz r4,8+LOWORD(r1) - addi r1,r1,16 - blr - END (__llround) - -libm_alias_double (__llround, llround) - -strong_alias (__llround, __llroundf) -libm_alias_float (__llround, llround) diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S deleted file mode 100644 index 030d2fdff8..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S +++ /dev/null @@ -1 +0,0 @@ -/* __llroundf is in s_llround.S */ From patchwork Fri Mar 29 13:35:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161443 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2053774jan; Fri, 29 Mar 2019 06:40:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQ72lYM+Lhl5V/oek3sQMf//FEde37OgXlXu9lodAX7NmbJPi1KdGpI8VfkHYrTwJf8Kxd X-Received: by 2002:a62:1647:: with SMTP id 68mr47358888pfw.113.1553866821872; Fri, 29 Mar 2019 06:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866821; cv=none; d=google.com; s=arc-20160816; b=MIsSffATOJ+Npc9AbvRGOK5Bz7Cs3GijwWR8U63JduzE6o9kvP2LP6CFNWZynuzFru v4ECqEd5iA/qHWwW+ksAJpLrMDqPwChWFbABoQ4BRwBNC2B5I8Plyi1vtQGfWT9ucsp+ s5qgu/xPr98kOFzNJrbeC8rwtiZodE7+JRDZ8DSDL57Q6fIZWazIbO9/3XuRowUBjMpp Ghu5ss5sWD8kzvOMkklXPWlhrZmX5DYMxVbXsq8FatAFdp1FoWi6VNG6UnoiWY9bC/co GRfyEXOpz/dmUhx5gTZJGRnAeANijo6UB4lpc1rJKuHruawqr21gfIjGkNtLPeBY8vEv lPYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=mWEmVj5K/8coLx5dvrKjqPQZfmXzIxJA/p37YQh44rM=; b=EavdZ4apQN2JZf+YhEa0aFRgd5FZX0qZHi5Slhfov1BWNjOXfsnZ5FUM86Lv1lcMYX WW6PqBKji6r1oaxWqzLmJXsCd9bJ4Q/RxCI05mSj91Xepgo3FUJFOtKY1YdiUSoZnlU2 NWRTpmpOqaVNKxckOR0FkyLcRwPJqW8Cl6IVe9CuycfbM82LqXAzZFwQn0BFt6DUZuTx G+UFI5KhJqrz4GWcQf132K0lrt5H9t7PqxESJHP1Zr9BCfmV4cYPxNWT2BYQQ9iMBNJ9 BbAowHGNOOVe+K9NV0db7NPA38hn8ef9n84at7d1r3iOCrOaq9WmUuSTmEGTVfUNlW5X PtIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=tIBpP2nd; dkim=pass header.i=@linaro.org header.s=google header.b=waV77zUD; spf=pass (google.com: domain of libc-alpha-return-101012-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101012-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id az7si1950702plb.21.2019.03.29.06.40.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:40:21 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101012-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=tIBpP2nd; dkim=pass header.i=@linaro.org header.s=google header.b=waV77zUD; spf=pass (google.com: domain of libc-alpha-return-101012-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101012-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=E22EH/QHfOZBM/PeMj5ez8nRgMtKgw8 KmwVp3w+AkymaOWxIhQf4PIFqeQOooVdjMbkFzqroqiXG4FpAaAQzlgqp9P7fsTS p/gTJXbcGFiWE/2PIuF4z0FdOhyCI9S+Gy0gnrUw0zAz+wlf9HDK9W81kQgK/6K7 NWS6e7Ynr7Bg= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=LLSzwSEelJZt7H4rlhZ5XXHkQFA=; b=tIBpP 2ndWGOnfrmMuj+B3yVUQhaWsvFl4TEzK3DQMBT6Bw1+Z/z4kDho2DZs2utqP1Y9B 36Ai/MaTWAD1IdcyXqmfziFwj6lQuQ6tzulivCzEYydyr7YXyVbOwG0eY1kH7H4B wDRQk309fKKtfJRVj9ysRcqpw+ZjBRURkclhf4= Received: (qmail 122863 invoked by alias); 29 Mar 2019 13:36:29 -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 121060 invoked by uid 89); 29 Mar 2019 13:36:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Short, fp3 X-HELO: mail-vk1-f169.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=mWEmVj5K/8coLx5dvrKjqPQZfmXzIxJA/p37YQh44rM=; b=waV77zUDdkaloTym5ZcL23c1mTMzcW9e8VIp0fiCBlwrloOBry7TuSG8zJsnHpXpOw 6hMEQeHAqmAjQmNYjlrubyXcFpjp15/d9COUBPhRfqVR/GKWJktbCZdrHkHAebts3oxG 8tyMQgzZsBqaJpH8deojDXfe8kEiy/0SFm/5qH7F2vprAPHKpqGx33nzekro5d9o0rp4 /rkgAUdnOVSKwXfVsr9RS2UHbNVm9SAizuPgB8KfQE40rH1mAtZ/8A21EP8PWjFWInjd Z9D04hEEXiUXFvLs1i4/0moaUKbYBcBCA1jADU3JrP4f1Ww7Vr7QxKD0MpbQNfIp9KZh GJdw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 22/28] powerpc: Use generic e_expf Date: Fri, 29 Mar 2019 10:35:23 -0300 Message-Id: <20190329133529.22523-23-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> Generic implementation is faster on both power8 and power9: POWER9: - sysdeps/ieee754/flt-32/e_expf.c "expf": { "workload-spec2017.wrf": { "duration": 5.1236e+09, "iterations": 7.53344e+08, "reciprocal-throughput": 5.9436, "latency": 7.65869, "max-throughput": 1.68248e+08, "min-throughput": 1.30571e+08 } } - sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S "expf": { "workload-spec2017.wrf": { "duration": 5.14429e+09, "iterations": 5.29248e+08, "reciprocal-throughput": 8.05372, "latency": 11.3863, "max-throughput": 1.24166e+08, "min-throughput": 8.78249e+07 } } Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove e_expf-power8 and expf-ppc64. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-power8.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c: Likewise. --- .../powerpc/powerpc64/fpu/multiarch/Makefile | 1 - .../powerpc64/fpu/multiarch/e_expf-power8.S | 24 -- .../powerpc64/fpu/multiarch/e_expf-ppc64.c | 21 -- .../powerpc/powerpc64/fpu/multiarch/e_expf.c | 32 -- .../powerpc/powerpc64/fpu/multiarch/w_expf.c | 1 - sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S | 303 ------------------ sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c | 1 - 7 files changed, 383 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-power8.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 48cf8dca3b..118865a1a9 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -10,7 +10,6 @@ libm-sysdep_routines += s_logb-power7 s_logbf-power7 \ s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ s_logbl-ppc64 e_hypot-ppc64 \ e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \ - e_expf-power8 e_expf-ppc64 \ $(sysdep_calls:s_%=m_%) CFLAGS-s_logbf-power7.c = -mcpu=power7 diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-power8.S deleted file mode 100644 index e0e14c2a47..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-power8.S +++ /dev/null @@ -1,24 +0,0 @@ -/* __ieee754_expf() POWER8 version. - Copyright (C) 2016-2019 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 - . */ - -#undef strong_alias -#define strong_alias(a, b) - -#define __ieee754_expf __ieee754_expf_power8 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c deleted file mode 100644 index 00c2006d41..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c +++ /dev/null @@ -1,21 +0,0 @@ -/* __ieee_expf() PowerPC64 version. - Copyright (C) 2016-2019 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 - . */ - -#define __expf __ieee754_expf_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c deleted file mode 100644 index dc0023c244..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Multiple versions of ieee754_expf. - Copyright (C) 2016-2019 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 - . */ - -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__ieee754_expf) __ieee754_expf_ppc64 attribute_hidden; -extern __typeof (__ieee754_expf) __ieee754_expf_power8 attribute_hidden; - -libc_ifunc (__ieee754_expf, - (hwcap2 & PPC_FEATURE2_ARCH_2_07) - ? __ieee754_expf_power8 - : __ieee754_expf_ppc64); - -strong_alias (__ieee754_expf, __expf_finite) diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c deleted file mode 100644 index b5fe164520..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S b/sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S deleted file mode 100644 index 7469a72873..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S +++ /dev/null @@ -1,303 +0,0 @@ -/* Optimized expf(). PowerPC64/POWER8 version. - Copyright (C) 2016-2019 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 - . */ - -#include - -/* Short algorithm description: - * - * Let K = 64 (table size). - * e^x = 2^(x/log(2)) = 2^n * T[j] * (1 + P(y)) - * where: - * x = m*log(2)/K + y, y in [0.0..log(2)/K] - * m = n*K + j, m,n,j - signed integer, j in [0..K-1] - * values of 2^(j/K) are tabulated as T[j]. - * - * P(y) is a minimax polynomial approximation of expf(y)-1 - * on small interval [0.0..log(2)/K]. - * - * P(y) = P3*y*y*y*y + P2*y*y*y + P1*y*y + P0*y, calculated as - * z = y*y; P(y) = (P3*z + P1)*z + (P2*z + P0)*y - * - * Special cases: - * expf(NaN) = NaN - * expf(+INF) = +INF - * expf(-INF) = 0 - * expf(x) = 1 for subnormals - * for finite argument, only expf(0)=1 is exact - * expf(x) overflows if x>88.7228317260742190 - * expf(x) underflows if x<-103.972076416015620 - */ - -#define C1 0x42ad496b /* Single precision 125*log(2). */ -#define C2 0x31800000 /* Single precision 2^(-28). */ -#define SP_INF 0x7f800000 /* Single precision Inf. */ -#define SP_EXP_BIAS 0x1fc0 /* Single precision exponent bias. */ - -#define DATA_OFFSET r9 - -/* Implements the function - - float [fp1] expf (float [fp1] x) */ - - .machine power8 -ENTRY (__ieee754_expf, 4) - addis DATA_OFFSET,r2,.Lanchor@toc@ha - addi DATA_OFFSET,DATA_OFFSET,.Lanchor@toc@l - - xscvdpspn v0,v1 - mfvsrd r8,v0 /* r8 = x */ - lfd fp2,(.KLN2-.Lanchor)(DATA_OFFSET) - lfd fp3,(.P2-.Lanchor)(DATA_OFFSET) - rldicl r3,r8,32,33 /* r3 = |x| */ - lis r4,C1@ha /* r4 = 125*log(2) */ - ori r4,r4,C1@l - cmpw r3,r4 - lfd fp5,(.P3-.Lanchor)(DATA_OFFSET) - lfd fp4,(.RS-.Lanchor)(DATA_OFFSET) - fmadd fp2,fp1,fp2,fp4 /* fp2 = x * K/log(2) + (2^23 + 2^22) */ - bge L(special_paths) /* |x| >= 125*log(2) ? */ - - lis r4,C2@ha - ori r4,r4,C2@l - cmpw r3,r4 - blt L(small_args) /* |x| < 2^(-28) ? */ - - /* Main path: here if 2^(-28) <= |x| < 125*log(2) */ - frsp fp6,fp2 - xscvdpsp v2,v2 - mfvsrd r8,v2 - mr r3,r8 /* r3 = m */ - rldicl r8,r8,32,58 /* r8 = j */ - lfs fp4,(.SP_RS-.Lanchor)(DATA_OFFSET) - fsubs fp2,fp6,fp4 /* fp2 = m = x * K/log(2) */ - srdi r3,r3,32 - clrrwi r3,r3,6 /* r3 = n */ - lfd fp6,(.NLN2K-.Lanchor)(DATA_OFFSET) - fmadd fp0,fp2,fp6,fp1 /* fp0 = y = x - m*log(2)/K */ - fmul fp2,fp0,fp0 /* fp2 = z = y^2 */ - lfd fp4,(.P1-.Lanchor)(DATA_OFFSET) - lfd fp6,(.P0-.Lanchor)(DATA_OFFSET) - lis r4,SP_EXP_BIAS@ha - ori r4,r4,SP_EXP_BIAS@l - add r3,r3,r4 - rldic r3,r3,49,1 /* r3 = 2^n */ - fmadd fp4,fp5,fp2,fp4 /* fp4 = P3 * z + P1 */ - fmadd fp6,fp3,fp2,fp6 /* fp6 = P2 * z + P0 */ - mtvsrd v1,r3 - xscvspdp v1,v1 - fmul fp4,fp4,fp2 /* fp4 = (P3 * z + P1)*z */ - fmadd fp0,fp0,fp6,fp4 /* fp0 = P(y) */ - sldi r8,r8,3 /* Access doublewords from T[j]. */ - addi r6,DATA_OFFSET,(.Ttable-.Lanchor) - lfdx fp3,r6,r8 - fmadd fp0,fp0,fp3,fp3 /* fp0 = T[j] * (1 + P(y)) */ - fmul fp1,fp1,fp0 /* fp1 = 2^n * T[j] * (1 + P(y)) */ - frsp fp1,fp1 - blr - - .align 4 -/* x is either underflow, overflow, infinite or NaN. */ -L(special_paths): - srdi r8,r8,32 - rlwinm r8,r8,3,29,29 /* r8 = 0, if x positive. - r8 = 4, otherwise. */ - addi r6,DATA_OFFSET,(.SPRANGE-.Lanchor) - lwzx r4,r6,r8 /* r4 = .SPRANGE[signbit(x)] */ - cmpw r3,r4 - /* |x| <= .SPRANGE[signbit(x)] */ - ble L(near_under_or_overflow) - - lis r4,SP_INF@ha - ori r4,r4,SP_INF@l - cmpw r3,r4 - bge L(arg_inf_or_nan) /* |x| > Infinite ? */ - - addi r6,DATA_OFFSET,(.SPLARGE_SMALL-.Lanchor) - lfsx fp1,r6,r8 - fmuls fp1,fp1,fp1 - blr - - - .align 4 -L(small_args): - /* expf(x) = 1.0, where |x| < |2^(-28)| */ - lfs fp2,(.SPone-.Lanchor)(DATA_OFFSET) - fadds fp1,fp1,fp2 - blr - - - .align 4 -L(arg_inf_or_nan:) - bne L(arg_nan) - - /* expf(+INF) = +INF - expf(-INF) = 0 */ - addi r6,DATA_OFFSET,(.INF_ZERO-.Lanchor) - lfsx fp1,r6,r8 - blr - - - .align 4 -L(arg_nan): - /* expf(NaN) = NaN */ - fadd fp1,fp1,fp1 - frsp fp1,fp1 - blr - - .align 4 -L(near_under_or_overflow): - frsp fp6,fp2 - xscvdpsp v2,v2 - mfvsrd r8,v2 - mr r3,r8 /* r3 = m */ - rldicl r8,r8,32,58 /* r8 = j */ - lfs fp4,(.SP_RS-.Lanchor)(DATA_OFFSET) - fsubs fp2,fp6,fp4 /* fp2 = m = x * K/log(2) */ - srdi r3,r3,32 - clrrwi r3,r3,6 /* r3 = n */ - lfd fp6,(.NLN2K-.Lanchor)(DATA_OFFSET) - fmadd fp0,fp2,fp6,fp1 /* fp0 = y = x - m*log(2)/K */ - fmul fp2,fp0,fp0 /* fp2 = z = y^2 */ - lfd fp4,(.P1-.Lanchor)(DATA_OFFSET) - lfd fp6,(.P0-.Lanchor)(DATA_OFFSET) - ld r4,(.DP_EXP_BIAS-.Lanchor)(DATA_OFFSET) - add r3,r3,r4 - rldic r3,r3,46,1 /* r3 = 2 */ - fmadd fp4,fp5,fp2,fp4 /* fp4 = P3 * z + P1 */ - fmadd fp6,fp3,fp2,fp6 /* fp6 = P2 * z + P0 */ - mtvsrd v1,r3 - fmul fp4,fp4,fp2 /* fp4 = (P3*z + P1)*z */ - fmadd fp0,fp0,fp6,fp4 /* fp0 = P(y) */ - sldi r8,r8,3 /* Access doublewords from T[j]. */ - addi r6,DATA_OFFSET,(.Ttable-.Lanchor) - lfdx fp3,r6,r8 - fmadd fp0,fp0,fp3,fp3 /* fp0 = T[j] * (1 + T[j]) */ - fmul fp1,fp1,fp0 /* fp1 = 2^n * T[j] * (1 + T[j]) */ - frsp fp1,fp1 - blr -END(__ieee754_expf) - - .section .rodata, "a",@progbits -.Lanchor: - .balign 8 -/* Table T[j] = 2^(j/K). Double precision. */ -.Ttable: - .8byte 0x3ff0000000000000 - .8byte 0x3ff02c9a3e778061 - .8byte 0x3ff059b0d3158574 - .8byte 0x3ff0874518759bc8 - .8byte 0x3ff0b5586cf9890f - .8byte 0x3ff0e3ec32d3d1a2 - .8byte 0x3ff11301d0125b51 - .8byte 0x3ff1429aaea92de0 - .8byte 0x3ff172b83c7d517b - .8byte 0x3ff1a35beb6fcb75 - .8byte 0x3ff1d4873168b9aa - .8byte 0x3ff2063b88628cd6 - .8byte 0x3ff2387a6e756238 - .8byte 0x3ff26b4565e27cdd - .8byte 0x3ff29e9df51fdee1 - .8byte 0x3ff2d285a6e4030b - .8byte 0x3ff306fe0a31b715 - .8byte 0x3ff33c08b26416ff - .8byte 0x3ff371a7373aa9cb - .8byte 0x3ff3a7db34e59ff7 - .8byte 0x3ff3dea64c123422 - .8byte 0x3ff4160a21f72e2a - .8byte 0x3ff44e086061892d - .8byte 0x3ff486a2b5c13cd0 - .8byte 0x3ff4bfdad5362a27 - .8byte 0x3ff4f9b2769d2ca7 - .8byte 0x3ff5342b569d4f82 - .8byte 0x3ff56f4736b527da - .8byte 0x3ff5ab07dd485429 - .8byte 0x3ff5e76f15ad2148 - .8byte 0x3ff6247eb03a5585 - .8byte 0x3ff6623882552225 - .8byte 0x3ff6a09e667f3bcd - .8byte 0x3ff6dfb23c651a2f - .8byte 0x3ff71f75e8ec5f74 - .8byte 0x3ff75feb564267c9 - .8byte 0x3ff7a11473eb0187 - .8byte 0x3ff7e2f336cf4e62 - .8byte 0x3ff82589994cce13 - .8byte 0x3ff868d99b4492ed - .8byte 0x3ff8ace5422aa0db - .8byte 0x3ff8f1ae99157736 - .8byte 0x3ff93737b0cdc5e5 - .8byte 0x3ff97d829fde4e50 - .8byte 0x3ff9c49182a3f090 - .8byte 0x3ffa0c667b5de565 - .8byte 0x3ffa5503b23e255d - .8byte 0x3ffa9e6b5579fdbf - .8byte 0x3ffae89f995ad3ad - .8byte 0x3ffb33a2b84f15fb - .8byte 0x3ffb7f76f2fb5e47 - .8byte 0x3ffbcc1e904bc1d2 - .8byte 0x3ffc199bdd85529c - .8byte 0x3ffc67f12e57d14b - .8byte 0x3ffcb720dcef9069 - .8byte 0x3ffd072d4a07897c - .8byte 0x3ffd5818dcfba487 - .8byte 0x3ffda9e603db3285 - .8byte 0x3ffdfc97337b9b5f - .8byte 0x3ffe502ee78b3ff6 - .8byte 0x3ffea4afa2a490da - .8byte 0x3ffefa1bee615a27 - .8byte 0x3fff50765b6e4540 - .8byte 0x3fffa7c1819e90d8 - -.KLN2: - .8byte 0x40571547652b82fe /* Double precision K/log(2). */ - -/* Double precision polynomial coefficients. */ -.P0: - .8byte 0x3fefffffffffe7c6 -.P1: - .8byte 0x3fe00000008d6118 -.P2: - .8byte 0x3fc55550da752d4f -.P3: - .8byte 0x3fa56420eb78fa85 - -.RS: - .8byte 0x4168000000000000 /* Double precision 2^23 + 2^22. */ -.NLN2K: - .8byte 0xbf862e42fefa39ef /* Double precision -log(2)/K. */ -.DP_EXP_BIAS: - .8byte 0x000000000000ffc0 /* Double precision exponent bias. */ - - .balign 4 -.SPone: - .4byte 0x3f800000 /* Single precision 1.0. */ -.SP_RS: - .4byte 0x4b400000 /* Single precision 2^23 + 2^22. */ - -.SPRANGE: /* Single precision overflow/underflow bounds. */ - .4byte 0x42b17217 /* if x>this bound, then result overflows. */ - .4byte 0x42cff1b4 /* if x From patchwork Fri Mar 29 13:35:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161442 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2053495jan; Fri, 29 Mar 2019 06:40:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNAh7Z8T2rzDHfByIe9qrY+EcmgF1p6MBsh0YUlBATVOprR6TwiMVZyeSrlVZr721WyAs3 X-Received: by 2002:a17:902:b58f:: with SMTP id a15mr34649923pls.36.1553866809627; Fri, 29 Mar 2019 06:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866809; cv=none; d=google.com; s=arc-20160816; b=gX3dlCWtXPLcclyKF/0f/KZgYfb96CfkPobV2DPFO/BtxWQ/BZl1xa986WXCwaWp6Z 8fFdALH3rU1LdP2qiPKTV/b4+ya/gUvNGDnpaiUG8Xt5qOFnJNKR4QXmEo4rxHJU80Ob ZGiEXDYkRuWLq8tw54MBNo/h+qrdcV6UrifLfJm+pyn/hmgRZ/2PKlvi87NVvKmqGchh WfrOf3di/dAJKGKYGIT3+YLzWR9sgPIorRUoUD4phd3m8OYZVQ3Ex9AOsf7lZ9BBX5Bi 1L9ccWYvqlFTDqC2cKjTRV6mseB321FeoqSUFxvdMaAspHqOVkZSvxvDYid+qI4/PpAd 264A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=Pdm3ZuoJK2+Vqh20TNr/C6X7Q2Ozy+BNwFLr8VSlBXA=; b=zWaael3sGiWwXkUM7Xjkf4pRjRu8lboUs39ix/xQwIsSL40Jfu5ds4FJM5AY4nhHai Ql4b0g25h2Sol98VwP5CXSXv5VlVOJ0Fk/H+yRfNn5b6W41knW/3hhbzH9XycJdxIYsd bEknzI9qTqCuF7ly7yeLwDKknUZpArOGx3dOp8QMIBV9lEKnEi7ScuOOXVZVBDWPubU2 31nG9CmDOnzthkcJsMSMDIy84KEHsUsUxg3lpIzuvWHif/XuHBJKrJVHQy2p3ntih8rm DjwpSuFrGNg27Bk2HtQXufla6JrOQcRBwvl4+oxxawx+Ny6c3Q2GAjOmNM0b27ervhzS JTZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=UIpU0Vf9; dkim=pass header.i=@linaro.org header.s=google header.b=xK0m9vMP; spf=pass (google.com: domain of libc-alpha-return-101011-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101011-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id s21si1826749pfh.260.2019.03.29.06.40.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:40:09 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101011-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=UIpU0Vf9; dkim=pass header.i=@linaro.org header.s=google header.b=xK0m9vMP; spf=pass (google.com: domain of libc-alpha-return-101011-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101011-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=MwrqTcQZ5bDVtx6s9/1RZj3dWD5SO2u HrElOsLaFo7p1h03i5TmOwXseMxo3KDd4mhangs4dWzMdyidnBBej35b3p50lFDb XIwJG1uM5HkDIAvHw3tAkjk1U1zVvzEB2Yqv6imCFriw/Z92XcNl98Lc3b+CpbEM umafcx6zLQS8= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=ag+zlN9ZeWFlBN7mFYP9trFDrKk=; b=UIpU0 Vf95GWNAnq9V/ZyMVvvP6VWt1MQvFbBuwq4ukpt0P3D8T4WfA22dmHmYZ15MIiSn pP139entwqAUfaMvY3a+fhiQg0HzmrNZG+ZrS1Cng20R/UhSDGbJxVOHUtMyjjMX xJArUe9uoGs9YhOzfsENBKfBgmZ73jhCGIwmTM= Received: (qmail 122763 invoked by alias); 29 Mar 2019 13:36:28 -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 120865 invoked by uid 89); 29 Mar 2019 13:36:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f54.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Pdm3ZuoJK2+Vqh20TNr/C6X7Q2Ozy+BNwFLr8VSlBXA=; b=xK0m9vMP/mo4zID28IlQq6IjaZ1n03ixCpLvQdXuMATNwHVZpa6U0x2csWjz2pN4t+ Kz9N7b4hibiCvysw/GXzD8GXVeS9D6ElfxG3WrFfITP9cDwmu11KNq0+eZZMJ2+FMKFj m1YY2Rqbnvt12oP6sKl6MA33v/3v4M1nWkCMek86xb3s3CRB4uq0mK+O+tGBhp1oXR+X Is3bThSxVBNc8ZB79sE+7nQHRKBo0zyDX5TTPDeRw2DcOV1MkEyzBMjWutaOu76Iwdgm QIJUhqhBuovt3rezafxtB4hDIrTELuE20+QdZMvSbnnzB9sbYLYdIoWQj811gkU3YXV5 +1Lw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 23/28] benchtests: hypot benchmark Date: Fri, 29 Mar 2019 10:35:24 -0300 Message-Id: <20190329133529.22523-24-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> Inputs are based on argument reductions from generic and powerpc implementation. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * benchtests/Makefile (bench-math): Add hypot. * benchtests/hypot-inputs: New file. --- benchtests/Makefile | 2 +- benchtests/hypot-inputs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 benchtests/hypot-inputs -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/benchtests/Makefile b/benchtests/Makefile index 42bf13b27f..013653588e 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -24,7 +24,7 @@ include ../Makeconfig bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \ modf pow rint sin sincos sinh sqrt tan tanh fmin fmax fminf \ fmaxf powf trunc truncf expf exp2f logf log2f sincosf sinf \ - cosf isnan isinf isfinite + cosf isnan isinf isfinite hypot bench-pthread := pthread_once thread_create diff --git a/benchtests/hypot-inputs b/benchtests/hypot-inputs new file mode 100644 index 0000000000..e987e5dd1b --- /dev/null +++ b/benchtests/hypot-inputs @@ -0,0 +1,16 @@ +## includes: math.h +## args: double:double +## ret: double + +## name: overflow +0x3.ffffffffffffcp-1024, 0x8p-152 +## name: higher_two500 +0x1.000002027941dp+500, 0x1.0000000000001p+500 +## name: subnormal +0x0.fffffffffffffp-1022, 0x0.fffffffffffffp-1022 +## name: less_two500 +0x1.fffffffffffffp-501, 0x1.fffffffffffffp-501 + +## name: default +3.0 , 4.0 +5.0 , 4.0 From patchwork Fri Mar 29 13:35:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161448 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2054933jan; Fri, 29 Mar 2019 06:41:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4s8wTgulbcEHW6OkNKNAQq/WdjijoEoz/UZgqwBY6I51sIuSP6zrDHnGQ+FEvnRsXCqju X-Received: by 2002:a63:c23:: with SMTP id b35mr5794915pgl.298.1553866893271; Fri, 29 Mar 2019 06:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866893; cv=none; d=google.com; s=arc-20160816; b=s/E1j9zeri55wy3Cj6/TA+bsAes3mNGRtapGYcZc7hpaZIZIy+4fQtDNxeMXk09/VM dMrqztdEbZMK87hFhsdh9K6YyZvncBoSA42oK8f2eikEJbfkx173sSuOQYounx7kWeQl qvEEjNBVITIOc3ZWL0deYo+jPWpMhA2UU3E0PFjZsP/azy0Tc6Zr2coBOvW6cje+2ln4 zaH9pwNfeDaCIVVXkkYXdaHN6q9USvVVf/E+TZlzNvRjtbGjx2PLuGbaW4qdk9PYjTc8 UYm40fkNFf/H3hSx8cQd4tMa8b8DmJ2HkK8lpN8luN2rif3IgQSNxO8R/T+p3Sxp0fdb 8b4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=9rJxf3/tZo4wh8l9T/lwT4LS1EH4AVs9yKluKbKcVrI=; b=hm/iJNUMiRBd3Aq24A8I46YbwL30aVWQuGeCmcOQEiWHpUfggnLzhBb0079HQI3u+2 rIfQNRaiUS/qf/CmF6CsqH3o89UeBz4UdQSHw1ohxQqJOwXjmst93IdUZ0AENMic09KB pfVlM3GnoUqfm0cxQJdxxvIC0ZngJjBVIhLERTEM33sREn1vLJjS2sfZKeZhil9Oj1D3 E0AGRUOg/WcQegPvG1kStq+POwIS/TxtSuw6x7aPT3mHrh41h0o/J2ww15j4rpMZeFvH g/qz746VFnai9J/S+N+WuaIXRK1yuqJ4qAxgMx1fIixt++AEeG6a+mIVVb8ASqym7DTO cFzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=hHrUzHhv; dkim=pass header.i=@linaro.org header.s=google header.b=ejMWvB2g; spf=pass (google.com: domain of libc-alpha-return-101017-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101017-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g31si1961187pgm.141.2019.03.29.06.41.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:41:33 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101017-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=hHrUzHhv; dkim=pass header.i=@linaro.org header.s=google header.b=ejMWvB2g; spf=pass (google.com: domain of libc-alpha-return-101017-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101017-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=lEg3Mrg7nNO04uet/eH1fULJa6JieRh FDa+ULEgmkAvQm7kk0iLt/PtxDSjwtQE47z0PbQy4V6Tk04d50ZNhbxeZPdIB6Z5 PhXqR8gtGkFFAwKrRsoFtxZN4ERPL3SatpC+Z5Std/MblUg22SbIL6N9uzMS+D09 oa6vxFYrSeaw= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=TjhKPgshZQjArnXKxRQNM5Iai1A=; b=hHrUz HhvYvJscg40AiZpcovEShDmsqzoVHwXcl3XuObnTwu0/pUXXzomgOfH22Flt7vWW rOcnYZxEHnPBd1mH2/72wz+JzZt6ITxgZOns3HKgJorI408PvdnXvGXyGtPhttkx tiY3LFtHy3/4yDb0SqkGN6I3cxyf9+cOtmyuqI= Received: (qmail 123521 invoked by alias); 29 Mar 2019 13:36:37 -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 121308 invoked by uid 89); 29 Mar 2019 13:36:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vk1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=9rJxf3/tZo4wh8l9T/lwT4LS1EH4AVs9yKluKbKcVrI=; b=ejMWvB2gfBUeaZqq5XbzRm42Uo0khrkDbkpUGJbdjH2HoJsudwsWpGZrRqzpgke1aU L77yeYgO7ARlV0h121SSDMls4cXkJ4kdaptx+4YV+C4Bm3sfz7MRNrH3ZDEmRVEYdFkU SFJSzoLAM/2jr/mNC6IRNw4udPvgIDTf+mveFAeJw3DXh5fEO8RJb91oTEN23l5h/EJv DAZPktknkUOL/SQhsBM4rhHoji+6e1At8qo+HyhnwSG03jmoMOIdc168HwHAM3p3XYFk w1UZllsjDpxGmDz5ogbdYSYQjWA6qBoLZfqMQ+60JoWHRmarVzFaJ4TiQNafk3h4ks+H JgvQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 24/28] powerpc: hypot refactor and optimization Date: Fri, 29 Mar 2019 10:35:25 -0300 Message-Id: <20190329133529.22523-25-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> The powerpc hypot is slight optimized by: - Commit 8df4e219e43, both isnan and isinf are always inlined and thus the check TEST_INF_NAN does not make sense anymore. The generic check for POWER7 should be faster on all powerpc configuration. - Two reduntant checks (for y == 0 and y > two60factor && (x / y) > two60) are removed. Both changes leads to unrequired ifunc especialization for power7 and thus they are removed. Finally The code is also cleanup a bit by inlining the constants floating points. The performance changes using the hypot benchtests are: - POWER9 without patch: "hypot": { "overflow": { "duration": 4.98585e+09, "iterations": 4.84932e+08, "max": 46.551, "min": 10.229, "mean": 10.2815 }, "higher_two500": { "duration": 5.00192e+09, "iterations": 4.24843e+08, "max": 33.319, "min": 11.606, "mean": 11.7736 }, "subnormal": { "duration": 5.0075e+09, "iterations": 4.06792e+08, "max": 22.178, "min": 12.15, "mean": 12.3097 }, "less_two500": { "duration": 5.00685e+09, "iterations": 4.08772e+08, "max": 22.784, "min": 12.052, "mean": 12.2485 }, "default": { "duration": 5.06002e+09, "iterations": 4.09894e+08, "max": 20.648, "min": 11.874, "mean": 12.3447 } } - POWER9 with patch: "hypot": { "overflow": { "duration": 4.91848e+09, "iterations": 7.28039e+08, "max": 47.958, "min": 6.436, "mean": 6.75579 }, "higher_two500": { "duration": 4.9359e+09, "iterations": 6.63376e+08, "max": 20.783, "min": 7.321, "mean": 7.44057 }, "subnormal": { "duration": 4.9479e+09, "iterations": 6.19772e+08, "max": 18.856, "min": 7.817, "mean": 7.98341 }, "less_two500": { "duration": 4.94275e+09, "iterations": 6.3889e+08, "max": 17.452, "min": 7.597, "mean": 7.73647 }, "default": { "duration": 5.03645e+09, "iterations": 5.70718e+08, "max": 18.904, "min": 8.55, "mean": 8.82476 } } - POWER7 without patch "hypot": { "overflow": { "duration": 4.86637e+09, "iterations": 6.43196e+08, "max": 53.958, "min": 7.328, "mean": 7.56592 }, "higher_two500": { "duration": 4.99842e+09, "iterations": 3.11012e+08, "max": 78.227, "min": 15.696, "mean": 16.0715 }, "subnormal": { "duration": 4.99841e+09, "iterations": 3.08935e+08, "max": 51.392, "min": 15.983, "mean": 16.1795 }, "less_two500": { "duration": 5.00108e+09, "iterations": 2.99464e+08, "max": 73.247, "min": 16.416, "mean": 16.7001 }, "default": { "duration": 5.04645e+09, "iterations": 3.52608e+08, "max": 70.073, "min": 13.38, "mean": 14.3118 } } - POWER7 with patch "hypot": { "overflow": { "duration": 4.80785e+09, "iterations": 8.00001e+08, "max": 66.262, "min": 5.888, "mean": 6.00981 }, "higher_two500": { "duration": 4.9859e+09, "iterations": 3.39449e+08, "max": 5148.44, "min": 14.539, "mean": 14.6882 }, "subnormal": { "duration": 4.9905e+09, "iterations": 3.28874e+08, "max": 64.905, "min": 14.971, "mean": 15.1745 }, "less_two500": { "duration": 4.99494e+09, "iterations": 3.19755e+08, "max": 103.696, "min": 14.972, "mean": 15.6211 }, "default": { "duration": 5.03951e+09, "iterations": 4.02502e+08, "max": 61.008, "min": 12.368, "mean": 12.5205 } } Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/e_hypot.c (two60, two500, two600, two1022, twoM500, twoM600, two60factor, pdnum): Remove. (TEST_INFO_NAN): Remove macro. (__ieee754_hypot): Replace static variables with inline definition, remove ununsed branches. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove e_hypot-* objects. (CFLAGS-e_hypot-power7.c, CFLAGS-e_hypotf-power7.c): Remove rule. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-power7.c: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-power7.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c: Likewise. --- sysdeps/powerpc/fpu/e_hypot.c | 96 +++++-------------- .../powerpc/powerpc64/fpu/multiarch/Makefile | 5 +- .../powerpc64/fpu/multiarch/e_hypot-power7.c | 19 ---- .../powerpc64/fpu/multiarch/e_hypot-ppc64.c | 26 ----- .../powerpc/powerpc64/fpu/multiarch/e_hypot.c | 33 ------- .../powerpc64/fpu/multiarch/e_hypotf-power7.c | 19 ---- .../powerpc64/fpu/multiarch/e_hypotf-ppc64.c | 26 ----- .../powerpc64/fpu/multiarch/e_hypotf.c | 33 ------- 8 files changed, 23 insertions(+), 234 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-power7.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-power7.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/fpu/e_hypot.c b/sysdeps/powerpc/fpu/e_hypot.c index 039e5be430..adbc7d28f6 100644 --- a/sysdeps/powerpc/fpu/e_hypot.c +++ b/sysdeps/powerpc/fpu/e_hypot.c @@ -22,15 +22,6 @@ #include #include -static const double two60 = 1.152921504606847e+18; -static const double two500 = 3.2733906078961419e+150; -static const double two600 = 4.149515568880993e+180; -static const double two1022 = 4.49423283715579e+307; -static const double twoM500 = 3.054936363499605e-151; -static const double twoM600 = 2.4099198651028841e-181; -static const double two60factor = 1.5592502418239997e+290; -static const double pdnum = 2.225073858507201e-308; - /* __ieee754_hypot(x,y) * * This a FP only version without any FP->INT conversion. @@ -39,95 +30,52 @@ static const double pdnum = 2.225073858507201e-308; * is needed. */ -#ifdef _ARCH_PWR7 -/* POWER7 isinf and isnan optimization are fast. */ -# define TEST_INF_NAN(x, y) \ - if ((isinf(x) || isinf(y)) \ - && !issignaling (x) && !issignaling (y)) \ - return INFINITY; \ - if (isnan(x) || isnan(y)) \ - return x + y; -# else -/* For POWER6 and below isinf/isnan triggers LHS and PLT calls are - * costly (especially for POWER6). */ -# define GET_TW0_HIGH_WORD(d1,d2,i1,i2) \ - do { \ - ieee_double_shape_type gh_u1; \ - ieee_double_shape_type gh_u2; \ - gh_u1.value = (d1); \ - gh_u2.value = (d2); \ - (i1) = gh_u1.parts.msw & 0x7fffffff; \ - (i2) = gh_u2.parts.msw & 0x7fffffff; \ - } while (0) - -# define TEST_INF_NAN(x, y) \ - do { \ - uint32_t hx, hy; \ - GET_TW0_HIGH_WORD(x, y, hx, hy); \ - if (hy > hx) { \ - uint32_t ht = hx; hx = hy; hy = ht; \ - } \ - if (hx >= 0x7ff00000) { \ - if ((hx == 0x7ff00000 || hy == 0x7ff00000) \ - && !issignaling (x) && !issignaling (y)) \ - return INFINITY; \ - return x + y; \ - } \ - } while (0) - -#endif - - double __ieee754_hypot (double x, double y) { + if ((isinf(x) || isinf(y)) + && !issignaling (x) && !issignaling (y)) + return INFINITY; + if (isnan(x) || isnan(y)) + return x + y; + x = fabs (x); y = fabs (y); - TEST_INF_NAN (x, y); - if (y > x) { double t = x; x = y; y = t; } - if (y == 0.0) - return x; + /* if y is higher enough, y * 2^60 might overflow. The tests if y >= 1.7976931348623157e+308/2^60 (two60factor) and uses the appropriate check to avoid the overflow exception generation. */ - if (y > two60factor) - { - if ((x / y) > two60) - return x + y; - } - else - { - if (x > (y * two60)) - return x + y; - } - if (x > two500) + if (y <= 0x1.fffffffffffffp+963 && x > (y * 0x1p+60)) + return x + y; + + if (x > 0x1p+500) { - x *= twoM600; - y *= twoM600; - return sqrt (x * x + y * y) / twoM600; + x *= 0x1p-600; + y *= 0x1p-600; + return sqrt (x * x + y * y) / 0x1p-600; } - if (y < twoM500) + if (y < 0x1p-500) { - if (y <= pdnum) + if (y <= 0x0.fffffffffffffp-1022) { - x *= two1022; - y *= two1022; - double ret = sqrt (x * x + y * y) / two1022; + x *= 0x1p+1022; + y *= 0x1p+1022; + double ret = sqrt (x * x + y * y) / 0x1p+1022; math_check_force_underflow_nonneg (ret); return ret; } else { - x *= two600; - y *= two600; - return sqrt (x * x + y * y) / two600; + x *= 0x1p+600; + y *= 0x1p+600; + return sqrt (x * x + y * y) / 0x1p+600; } } return sqrt (x * x + y * y); diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 118865a1a9..534d5a7133 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -8,8 +8,7 @@ sysdep_calls := s_modf-power5+ s_modf-ppc64 \ sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_logb-power7 s_logbf-power7 \ s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ - s_logbl-ppc64 e_hypot-ppc64 \ - e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \ + s_logbl-ppc64 \ $(sysdep_calls:s_%=m_%) CFLAGS-s_logbf-power7.c = -mcpu=power7 @@ -17,8 +16,6 @@ CFLAGS-s_logbl-power7.c = -mcpu=power7 CFLAGS-s_logb-power7.c = -mcpu=power7 CFLAGS-s_modf-power5+.c = -mcpu=power5+ CFLAGS-s_modff-power5+.c = -mcpu=power5+ -CFLAGS-e_hypot-power7.c = -mcpu=power7 -CFLAGS-e_hypotf-power7.c = -mcpu=power7 # These files quiet sNaNs in a way that is optimized away without # -fsignaling-nans. diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-power7.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-power7.c deleted file mode 100644 index 69818d8438..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-power7.c +++ /dev/null @@ -1,19 +0,0 @@ -/* __ieee_hypot() POWER7 version. - Copyright (C) 2013-2019 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 - . */ - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-ppc64.c deleted file mode 100644 index da1e80f0d6..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-ppc64.c +++ /dev/null @@ -1,26 +0,0 @@ -/* __ieee_hypot() PowerPC64 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef strong_alias -#define strong_alias(a, b) - -#define __ieee754_hypot __ieee754_hypot_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c deleted file mode 100644 index 3bd04e9517..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Multiple versions of ieee754_hypot. - Copyright (C) 2013-2019 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 - . */ - -#include -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__ieee754_hypot) __ieee754_hypot_ppc64 attribute_hidden; -extern __typeof (__ieee754_hypot) __ieee754_hypot_power7 attribute_hidden; - -libc_ifunc (__ieee754_hypot, - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __ieee754_hypot_power7 - : __ieee754_hypot_ppc64); - -strong_alias (__ieee754_hypot, __hypot_finite) diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-power7.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-power7.c deleted file mode 100644 index 223947a617..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-power7.c +++ /dev/null @@ -1,19 +0,0 @@ -/* __ieee_hypotf() POWER7 version. - Copyright (C) 2013-2019 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 - . */ - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-ppc64.c deleted file mode 100644 index 6d5d54bb79..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-ppc64.c +++ /dev/null @@ -1,26 +0,0 @@ -/* __ieee_hypot() PowerPC64 version. - Copyright (C) 2013-2019 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 - . */ - -#include - -#undef strong_alias -#define strong_alias(a, b) - -#define __ieee754_hypotf __ieee754_hypotf_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c deleted file mode 100644 index 02c0ab497f..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Multiple versions of ieee754_hypot. - Copyright (C) 2013-2019 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 - . */ - -#include -#include -#include -#include -#include "init-arch.h" - -extern __typeof (__ieee754_hypotf) __ieee754_hypotf_ppc64 attribute_hidden; -extern __typeof (__ieee754_hypotf) __ieee754_hypotf_power7 attribute_hidden; - -libc_ifunc (__ieee754_hypotf, - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __ieee754_hypotf_power7 - : __ieee754_hypotf_ppc64); - -strong_alias (__ieee754_hypotf, __hypotf_finite) From patchwork Fri Mar 29 13:35:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161447 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2054745jan; Fri, 29 Mar 2019 06:41:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkbUGUP5zR1sKXyo8M/u+DjqFlkwC71Xc+5qyaBrx2iB9LpMMykU1BHi73xh6v1LXrK49v X-Received: by 2002:a17:902:6949:: with SMTP id k9mr46894802plt.275.1553866880695; Fri, 29 Mar 2019 06:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866880; cv=none; d=google.com; s=arc-20160816; b=VTIsJ98cjfakc1aMraxcphhiyd+3PpQC0SJVUTpnj0USRdbA6AH4wms/BesT5UWvz2 4gmF9/9INcU796GQKH4L1XprLaBEHGeMKkPine+Oy8/TJBra+RcaQ7sQuSWWwjrSr/oB eKsTzbLMeB9njSttZCY5fwjdylZFJo1PV44ME/9JnRXqSQFNPrRcZuvKC6bLTFr+Jfx+ Jlrsmq5ipnUe41kTjsxf1YPXw/DfdoO2mv0gqBypmI9pM0XVPdRdxfJAIbIBrNQO13/w fIR2Z8hmpmSq2xqxbWx5LJGrr43RMIMTGBUOj8sKTikRDEu7c+ASWha1eIQR3MB399JI wnOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=PJ0W78oPbyZgma1Jk97CPbBEMSlNHwPe+xNKBp1/E5c=; b=zLmHuwWhk0nV28A+14r58RuURLipAmkIojr/zJDmSa0nFHxcINbEjUi+2pIT16xGFP Upggkjx9vgBcd2hsG7vcx/ocDIOG0Sqb7vYeIHuI9oANd6x01CG1bkbxvGp/CmyHU0x0 B7K9bYdB81ucENbXSHpcj+ZFWkColshtvmMu4TKE3wF2cAMfeiXF/hsUdm0qZkDt2au7 d3Sa+7tcsQzsrgFlNH7ZAdIpF98BdVlBHxgk1AlWHZs2T45cpo7601FA5S9oWEqithxr n5tduELKAHU5DxIxXTn9gXrB2mFOhfsOqiwvx9C8ogSkyCxX0RW9UaxC6MyTnIV5BoZ+ YFFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=A6QrOQg+; dkim=pass header.i=@linaro.org header.s=google header.b=P0WKEveI; spf=pass (google.com: domain of libc-alpha-return-101016-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101016-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id j12si1925627plk.144.2019.03.29.06.41.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:41:20 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101016-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=A6QrOQg+; dkim=pass header.i=@linaro.org header.s=google header.b=P0WKEveI; spf=pass (google.com: domain of libc-alpha-return-101016-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101016-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=hMHvxLK7/FeedbI3aX2Qd8/1a8syp84 V7a/9yyIQRRZfnfjfOgQQRHFlgewC8MGJLejprPPJkbnkcEqMx3vz/f61uHNkYkU cqqsAZ3xHPXjhbMdEQijs+HjlQxNZND0+ZW4C3HJbE+UXz3gdYPU8vs2nrrWqLl9 R+WeZ+WXYyPo= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=hdePESYLFnngyTDU0UDeyYjwVK0=; b=A6QrO Qg++XGpMF5Qcy9VAodNTaIXFnmRLTQNfl+SCBcs4k0FuuZPwdtx8srG2SoiGDiI+ rK7m4k9hf6JuMdtLoFH+oYV9Rq6oC9T7JxHZnSGLXoTRIXoKYJ9zLxoEzzGm52m6 alyweB0B/nViZ1+yeGzvnkEW3nNnp17fcJh4GI= Received: (qmail 123424 invoked by alias); 29 Mar 2019 13:36:36 -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 121309 invoked by uid 89); 29 Mar 2019 13:36:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=2224 X-HELO: mail-ua1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=PJ0W78oPbyZgma1Jk97CPbBEMSlNHwPe+xNKBp1/E5c=; b=P0WKEveIZmcxRYmXwfmeRl3ohQxJAKHT4YDJcBOCaam3WzGH5sthLdnzxbK4mP1+ik VmbqOCFok7pRAfgLu+xtX0g0V3omQ8WZ6d/mjpJOgYzFI5oB5uXuteYvn0hkkUKhtXjL j+yZrXfweYTIhkeqTGw7D5+8+oRpiiGi6jDft9RJfCj8Kw8P6NenvzqnTjFEEx4yH7gR S+uRyy28HcMGPJwmjz2EPM0GxhRkeN5nK3xPrUgdRiCQ+aw+g/9FrcBDoo381b0yDjDP EVW2daJiEzygxTtzIgS+ApwFP1zop3CgPeb4cWK2iKGNYrud+xZJ/1ubvUpe05NfU1oq 7m8A== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 25/28] powerpc: Refactor modf{f} Date: Fri, 29 Mar 2019 10:35:26 -0300 Message-Id: <20190329133529.22523-26-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> The modf{f} optimization is not an optimization for ISA 2.07+. This patch move the IFUNC for powerpc64 only, move the power5+ to generic location, and include the generic implementation for ISA 2.07+. The performance changes are based on modf benchtests: * POWER9 - generic code "modf": { "": { "duration": 4.97057e+09, "iterations": 1.00688e+09, "max": 28.76, "min": 4.912, "mean": 4.9366 } } * POWER9 - power5+ optimization "modf": { "": { "duration": 4.98291e+09, "iterations": 9.32818e+08, "max": 15.058, "min": 5.107, "mean": 5.34178 } } * POWER8 - generic code "modf": { "": { "duration": 5.05329e+09, "iterations": 8.38814e+08, "max": 518.051, "min": 5.79, "mean": 6.02433 } } * POWER8 - power5+ optimization "modf": { "": { "duration": 5.05573e+09, "iterations": 8.35254e+08, "max": 63.141, "min": 5.873, "mean": 6.05293 } } * POWER7 - generic code "modf": { "": { "duration": 4.89818e+09, "iterations": 1.08408e+09, "max": 57.556, "min": 3.953, "mean": 4.51827 } } * POWER7 - power5+ optimization "modf": { "": { "duration": 4.83789e+09, "iterations": 1.33409e+09, "max": 46.608, "min": 2.224, "mean": 3.62636 } } Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/power5+/fpu/s_modf.c: Move to ... * sysdeps/powerpc/fpu/s_modf.c: ... here. Add ISA 2.07 optimization. * sysdeps/powerpc/power5+/fpu/s_modff.c: Move to ... * sysdeps/powerpc/fpu/s_modff.c: ... here. Add ISA 2.07 optimization. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c: Adjust include. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (sysdep_calls, sysdep_routines): Add s_modf* objects. (CFLAGS-s_modf-power5+.c, CFLAGS-s_modff-power5+.c, CFLAGS-s_modf-ppc64.c, CFLAGS-s_modff-ppc64.c): New rule. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c: Movo to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c: Move ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c: ... here. --- sysdeps/powerpc/{power5+ => }/fpu/s_modf.c | 17 +++++++++++++---- sysdeps/powerpc/{power5+ => }/fpu/s_modff.c | 13 +++++++++++-- .../power4/fpu/multiarch/s_modf-power5+.c | 13 +------------ .../power4/fpu/multiarch/s_modff-power5+.c | 9 +-------- .../powerpc64/be/fpu/multiarch/Makefile | 19 ++++++++++++++++++- .../{ => be}/fpu/multiarch/s_modf-power5+.c | 3 ++- .../{ => be}/fpu/multiarch/s_modf-ppc64.c | 0 .../powerpc64/{ => be}/fpu/multiarch/s_modf.c | 0 .../{ => be}/fpu/multiarch/s_modff-power5+.c | 3 ++- .../{ => be}/fpu/multiarch/s_modff-ppc64.c | 0 .../{ => be}/fpu/multiarch/s_modff.c | 0 .../powerpc/powerpc64/fpu/multiarch/Makefile | 13 ------------- 12 files changed, 48 insertions(+), 42 deletions(-) rename sysdeps/powerpc/{power5+ => }/fpu/s_modf.c (74%) rename sysdeps/powerpc/{power5+ => }/fpu/s_modff.c (77%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modf-power5+.c (91%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modf-ppc64.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modf.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modff-power5+.c (91%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modff-ppc64.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modff.c (100%) -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/power5+/fpu/s_modf.c b/sysdeps/powerpc/fpu/s_modf.c similarity index 74% rename from sysdeps/powerpc/power5+/fpu/s_modf.c rename to sysdeps/powerpc/fpu/s_modf.c index dbb11652e1..2304fc48ed 100644 --- a/sysdeps/powerpc/power5+/fpu/s_modf.c +++ b/sysdeps/powerpc/fpu/s_modf.c @@ -15,9 +15,15 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, see . */ -#include -#include -#include +/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make + generic implementation faster. Also disables for old ISAs that do not + have ceil/floor instructions. */ +#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR5X) +# include +#else +# include +# include +# include double __modf (double x, double *iptr) @@ -44,7 +50,10 @@ __modf (double x, double *iptr) return copysign (x - *iptr, x); } } +# ifndef __modf libm_alias_double (__modf, modf) -#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) compat_symbol (libc, __modf, modfl, GLIBC_2_0); +# endif +# endif #endif diff --git a/sysdeps/powerpc/power5+/fpu/s_modff.c b/sysdeps/powerpc/fpu/s_modff.c similarity index 77% rename from sysdeps/powerpc/power5+/fpu/s_modff.c rename to sysdeps/powerpc/fpu/s_modff.c index 87c9f020f7..2a0f114b20 100644 --- a/sysdeps/powerpc/power5+/fpu/s_modff.c +++ b/sysdeps/powerpc/fpu/s_modff.c @@ -15,8 +15,14 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, see . */ -#include -#include +/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make + generic implementation faster. Also disables for old ISAs that do not + have ceil/floor instructions. */ +#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR5X) +# include +#else +# include +# include float __modff (float x, float *iptr) @@ -43,4 +49,7 @@ __modff (float x, float *iptr) return copysignf (x - *iptr, x); } } +# ifndef __modff libm_alias_float (__modf, modf) +# endif +#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c index b1d0540b31..6f93c2b652 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c @@ -16,16 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - #define __modf __modf_power5plus - -#include +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c index 8b333eae0d..2e701881e8 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c @@ -16,12 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include -#include - -#undef weak_alias -#define weak_alias(a,b) - #define __modff __modff_power5plus - -#include +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index 9917cd15d5..63de39bbf1 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -1,4 +1,13 @@ ifeq ($(subdir),math) +# These functions are built both for libc and libm because they're required +# by printf. While the libc objects have the prefix s_, the libm ones are +# prefixed with m_. +sysdep_calls := s_modf-power5+ \ + s_modf-ppc64 \ + s_modff-power5+ \ + s_modff-ppc64 + +sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_ceil-power5+ \ s_ceil-ppc64 \ s_ceilf-power5+ \ @@ -22,7 +31,8 @@ libm-sysdep_routines += s_ceil-power5+ \ s_llround-power6x \ s_llround-power5+ \ s_llround-ppc64 \ - s_llroundf-ppc64 + s_llroundf-ppc64 \ + $(sysdep_calls:s_%=m_%) CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ @@ -35,4 +45,11 @@ CFLAGS-s_truncf-power5+.c = -mcpu=power5+ CFLAGS-s_llround-power8.c += -mcpu=power8 CFLAGS-s_llround-power6x.c += -mcpu=power6x CFLAGS-s_llround-power5+.c += -mcpu=power5+ + +CFLAGS-s_modf-power5+.c += -mcpu=power5+ +CFLAGS-s_modff-power5+.c += -mcpu=power5+ +# These files quiet sNaNs in a way that is optimized away without +# -fsignaling-nans. +CFLAGS-s_modf-ppc64.c += -fsignaling-nans +CFLAGS-s_modff-ppc64.c += -fsignaling-nans endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c similarity index 91% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c index 1a958de178..6f93c2b652 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c @@ -16,4 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include +#define __modf __modf_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-ppc64.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c similarity index 91% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c index 4939d4bc2b..2e701881e8 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c @@ -16,4 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include +#define __modff __modff_power5plus +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 534d5a7133..d7ad1e2724 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -1,10 +1,4 @@ ifeq ($(subdir),math) -# These functions are built both for libc and libm because they're required -# by printf. While the libc objects have the prefix s_, the libm ones are -# prefixed with m_. -sysdep_calls := s_modf-power5+ s_modf-ppc64 \ - s_modff-power5+ s_modff-ppc64 - sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_logb-power7 s_logbf-power7 \ s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ @@ -14,11 +8,4 @@ libm-sysdep_routines += s_logb-power7 s_logbf-power7 \ CFLAGS-s_logbf-power7.c = -mcpu=power7 CFLAGS-s_logbl-power7.c = -mcpu=power7 CFLAGS-s_logb-power7.c = -mcpu=power7 -CFLAGS-s_modf-power5+.c = -mcpu=power5+ -CFLAGS-s_modff-power5+.c = -mcpu=power5+ - -# These files quiet sNaNs in a way that is optimized away without -# -fsignaling-nans. -CFLAGS-s_modf-ppc64.c += -fsignaling-nans -CFLAGS-s_modff-ppc64.c += -fsignaling-nans endif From patchwork Fri Mar 29 13:35:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161445 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2054332jan; Fri, 29 Mar 2019 06:40:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFoae46EN394ilIw8gW3u3rqdgWsTRCnyo8VGLjOc7QS9QKMDhJvPP5kSaGRAv2mTdpq5l X-Received: by 2002:a63:158:: with SMTP id 85mr46445055pgb.351.1553866854707; Fri, 29 Mar 2019 06:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866854; cv=none; d=google.com; s=arc-20160816; b=NUzrHbV21PUkv7I+d9lloSiNPGAQG4vsv2SJmwNiz6bJS4qrJmGVJjcdYVqyQwn0Is tfF/Da22pDJBzIuVk3wE72pSrRuPB6z+qs7vcLIijF5XZYF3C9V3pIa8JoeLVKfTzAId lWwbI9VI6/zDdvUfRBA5INICVp3vrfUJaIpKV8OMfyPqIF65d3zJYEAOw+hX3Jwukk41 lBK6YJ+EbyKzpFPX57vTL/eee01i9Kgmjqyig9ncwkbzDN+aiavb4Rq4+GU8fi69CL40 IUBdLHwFj0X9lYnyq4ASjWErKkmQhyeEZl0Uqv+WcBY+B3ihnkhCtFUJ1/iFe9bG6Gf7 FfJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=9Ai/L+/L/wd+PwNU3uHs2ubUI6AYvtmCBzSWLSqkGpo=; b=UEUcoIqPwrhO/oHyMEx3lbrmzMBMPBzuIId1iaxLOdkTNe78GFCI/9A+UGPbohaMlh pxhhurMUSAzfzyy+vbsLbn2dh8mM3ng7IwVRLR02mSC1YiRYJPI6AWDVDFmVe6wpkCDl q6kvPlHW5IrqUkMLq1dobIOG3ov1s8ln/TYzc/8NpuIrD6fix+pEp5tMBSQIgsPlDQEB gxz05JsNYIMivzOwL8Lwk1UbEDKSSlNIZQ9ey9pPC0UKNPhNMnmMlX6NS9dVqwJ2Lbdx T3QxCnmrxPcJkDkf/YMRdw+BusTmIA073mdnKvQDTxU53XtpR5SP916TUoY00L8IUGrj VUgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Gs3O6g3l; dkim=pass header.i=@linaro.org header.s=google header.b=BSxaJPV0; spf=pass (google.com: domain of libc-alpha-return-101014-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101014-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i67si1975824pfb.117.2019.03.29.06.40.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:40:54 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101014-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Gs3O6g3l; dkim=pass header.i=@linaro.org header.s=google header.b=BSxaJPV0; spf=pass (google.com: domain of libc-alpha-return-101014-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101014-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=NybyotoGXPME52IjGZX5SuhguZwv18s CgQL7129lt8Qnzy9Pnq1Poj6zPw2wQHrMwtvz7N5tcVyqW81/xA+lku8mMhzmgOp /iL1DGSi5sSjwaiuhRNuCgjR4QAFSnvU6EgaWEe/H/oX0mgPtcw4LFAGQJ7M3lcl Fa1+Tmji/W+k= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=n8+e5EdD3qCLe4+UNDppPY7sXOg=; b=Gs3O6 g3lJ5fdROohlXmI+HMZNNECzSE9V+04S9dKrw3evE3SlkrgB4dkJerUlabVyIqVu MI5xUNjd/O1KiVyc/QgKInsMmMGuVyBcNk+/JSymhuyRA1Mp+DNWh+/KtViTBt/m pWZ0VqHz1EFEfj3Az7/90Og/jA/+Oey/Nn+Ba4= Received: (qmail 123247 invoked by alias); 29 Mar 2019 13:36: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 121199 invoked by uid 89); 29 Mar 2019 13:36:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f42.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=9Ai/L+/L/wd+PwNU3uHs2ubUI6AYvtmCBzSWLSqkGpo=; b=BSxaJPV0Yj4P0ILpV1SQdl6GOU7vaPeOu5f+h+qy/zO2ccffkZ2Kn4WSPDN3S6N5M8 J9b8HPyzxz9ldnYXJvO6Q4Ln2WrqEtjQp5UUjQ97bHsVxaMG14RT6iSnhJGBdTxO8md4 ZxMhN9+JtWomlv+FjtpHWEMeW1JZdCyKcJRWStI6aG7F2zhWpse9WJzIN57XZdAFO0X2 YFrMgEI/ilLoJUzW96w+nl4guwSbAsTd2N9lEdxTQigdBj9RreK0Bb75fP5qVr00ak7/ tQYB9UI2kRie45Y4unnvh+qEAsgtsWoLMCiH5ztO8M5pkTBS95WV1z4X8nfgXCpbtmv1 nGug== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 26/28] benchtests: Add logb{f} benchmark Date: Fri, 29 Mar 2019 10:35:27 -0300 Message-Id: <20190329133529.22523-27-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * benchtests/Makefile (bench-math): Add logb. * benchtests/logb-inputs: New file. * benchtests/logbf-inputs: New file. --- benchtests/Makefile | 2 +- benchtests/logb-inputs | 11 +++++++++++ benchtests/logbf-inputs | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 benchtests/logb-inputs create mode 100644 benchtests/logbf-inputs -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/benchtests/Makefile b/benchtests/Makefile index 013653588e..07343b01c6 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -24,7 +24,7 @@ include ../Makeconfig bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \ modf pow rint sin sincos sinh sqrt tan tanh fmin fmax fminf \ fmaxf powf trunc truncf expf exp2f logf log2f sincosf sinf \ - cosf isnan isinf isfinite hypot + cosf isnan isinf isfinite hypot logb logbf bench-pthread := pthread_once thread_create diff --git a/benchtests/logb-inputs b/benchtests/logb-inputs new file mode 100644 index 0000000000..ab3b161696 --- /dev/null +++ b/benchtests/logb-inputs @@ -0,0 +1,11 @@ +## args: double +## ret: double +## includes: math.h + +## name: subnormal +0x0.0000000000001p-1022 +0x0.fffffffffffffp-1022 + +## name: normal +1.0 +1024.0 diff --git a/benchtests/logbf-inputs b/benchtests/logbf-inputs new file mode 100644 index 0000000000..c97fa17842 --- /dev/null +++ b/benchtests/logbf-inputs @@ -0,0 +1,11 @@ +## args: double +## ret: double +## includes: math.h + +## name: subnormal +0x1p-149 +0x1.fffff8p-128 + +## name: normal +1.0 +1024.0 From patchwork Fri Mar 29 13:35:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161450 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2055508jan; Fri, 29 Mar 2019 06:42:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgqzxfeNnDyaaep963wk0BxvWuV0+KUOVIWZQ6d8NWEbbo2j3U2hNeYl/+ZKf21RTZV9N1 X-Received: by 2002:a17:902:6942:: with SMTP id k2mr49333597plt.136.1553866924540; Fri, 29 Mar 2019 06:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866924; cv=none; d=google.com; s=arc-20160816; b=y27VOc2FJoJZC5RJffYrhq9bVMmOPtzqE+bx8EmvdN+3+akHXAAmg0TYORzfVKCQui 4qmhiJr/rk+xDtUYTohmj63Yjd9+dhICFfv+O+tPRQMJEGYlox34vKmKqve70v/YmbBM 81lZy92NkZOwRIK/JyJWeoGWqjpnHxjpSd12VXZM66nfg3/5e/1L7iU0uFwTajGUpdYI Ry+GzMkgPuBToMSFf9dt81iJs/8yd/bZLqaXKvi4OjR+VqF6zikkBitu5eU5gHeI1Lyq bo44pWtxQ0e7uOMM2RFi/P1Mz2HUxb8C9gaJ3XoiZ3mwmUVpHWzEbvFqcLuCbRpYYfLS rEZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=lTMW3XGfyYZPu9k98JqFneBXmo5QMzBzwgQNH6SFJt0=; b=J0zFUTgTU2NipmhHSf+d2SBAz6ghNCzOkEEPY0rE7i/ZRXdgQ1MKFaAlu7NEvDApEe uIT/5hDRnvemTpX2E4mekG/Ow44frzWa3uYalmbSJFHH9Pkg7rM15siW8YErlBZ1ZGgs PNUGYfbAOapjaFJkAKYE/rCLulmuw7KmP7UaoNti4J3QL2bmX4v3l3g4kNyNzm2c4Tkn lDis2IyPN3rsECW5tiasshfAX6/+uQgswLiXS2Nuxvf2Fh2cVGAdrmRqAoGQXVw9MsdX Rmmv3Uu32uH4VEtec/8a13FnsgR/2Ar9GmTVYHTGKg+jpB13n45R3Be3uuyrCHSSA+Tc q9lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=tUw6n2gB; dkim=pass header.i=@linaro.org header.s=google header.b=o+HBqyBV; spf=pass (google.com: domain of libc-alpha-return-101019-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101019-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h10si1845984pgs.573.2019.03.29.06.42.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:42:04 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101019-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=tUw6n2gB; dkim=pass header.i=@linaro.org header.s=google header.b=o+HBqyBV; spf=pass (google.com: domain of libc-alpha-return-101019-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101019-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=FlckatwNchHNtpaxrt1uDZutLBrq2fH ++CG3+GXl0+0CskTQWDJtTGi4QK8EfFJFGEyIUNvkzNwdJ1hUAjdzNpk9ZTy2zR9 eamNQq2Ds2sDPKucfG500J5oQESS6OrEilcbxowzwV/w6/JpZFyI2JOplQH8fxhT YfqFotmlK4H8= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=NkMfi9cCIRzJ4TR1apw2R3DxV5w=; b=tUw6n 2gBLCoeEUD8L/S73sFBhq5VRieYNmQZsmQK1xtLtlJKDTamft8OeBYmS25DoOoa3 onbn0RoFHlsPih+jodDC/Jv9XXYI282ugcpP3symmYdjlxJn/2U7IcDQf6OV28Na Kg0tfN/ZwvGANRQt81H9jq2GqIaYW0g4Xce5Y8= Received: (qmail 123737 invoked by alias); 29 Mar 2019 13:36:39 -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 121569 invoked by uid 89); 29 Mar 2019 13:36:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=1023 X-HELO: mail-ua1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=lTMW3XGfyYZPu9k98JqFneBXmo5QMzBzwgQNH6SFJt0=; b=o+HBqyBVbDnHWjcutYoPqvMIEZzY0DGlyTqhVN0JiqvLyvL4y3vZpYWKDDxA7qOvHo cNcr7+YzPigDmcJP00YlyGrhWUx6CqEWCqQNcE2XNghKKAbdasFpDlxWDdIzzW34rs8v eOL/Y14Fr6fI7nZq/JMfK2qjguTdm3SyDyS5Cx7LosjNQ8Ogbl+lePu61ZUPkzfiBAFq 6NojuP67HmsL8mZwOGiVazVbSU0bO/TdFcKS10t4h7/517LHkQOu3LskSWQqa5U2Km/2 2YqUQ3wpXenXuh4bWpCRWPVa12H56bUmZEWNexAz29ZHNDJdWosOsiP4/t9fVRevXxqO nvOg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 27/28] math: Use wordsize-64 version for s_logb Date: Fri, 29 Mar 2019 10:35:28 -0300 Message-Id: <20190329133529.22523-28-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> - The resulting binary difference on 32 bits architecture is minimum. On i686-linux-gnu (with architecture optimization routine removed) there is no different using logb benchtests - It helps wordsize-64 architectures that use ldbl-opt. - It add some code simplification with reduction of duplicated implementations. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c: Move to ... * sysdeps/ieee754/dbl-64/s_logb.c: ... here. Add work around for powerpc32 integer 0 converting to -0. --- sysdeps/ieee754/dbl-64/s_logb.c | 61 ++++++++++----------- sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c | 47 ---------------- 2 files changed, 29 insertions(+), 79 deletions(-) delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c index a6de1f6e49..e336251fda 100644 --- a/sysdeps/ieee754/dbl-64/s_logb.c +++ b/sysdeps/ieee754/dbl-64/s_logb.c @@ -1,22 +1,24 @@ -/* @(#)s_logb.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ +/* Compute radix independent exponent. + Copyright (C) 2011-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2011. -/* - * double logb(x) - * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. - * Use ilogb instead. - */ + 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 + . */ #include + #include #include #include @@ -24,28 +26,23 @@ double __logb (double x) { - int32_t lx, ix, rix; + int64_t ix, ex; - EXTRACT_WORDS (ix, lx, x); - ix &= 0x7fffffff; /* high |x| */ - if ((ix | lx) == 0) + EXTRACT_WORDS64 (ix, x); + ix &= UINT64_C(0x7fffffffffffffff); + if (ix == 0) return -1.0 / fabs (x); - if (ix >= 0x7ff00000) + ex = ix >> 52; + if (ex == 0x7ff) return x * x; - if (__glibc_unlikely ((rix = ix >> 20) == 0)) + if (__glibc_unlikely (ex == 0)) { - /* POSIX specifies that denormal number is treated as - though it were normalized. */ - int ma; - if (ix == 0) - ma = __builtin_clz (lx) + 32; - else - ma = __builtin_clz (ix); - rix -= ma - 12; + int m = __builtin_clzll (ix); + ex -= m - 12; } - if (FIX_INT_FP_CONVERT_ZERO && rix == 1023) + if (FIX_INT_FP_CONVERT_ZERO && ex == 1023) return 0.0; - return (double) (rix - 1023); + return (double) (ex - 1023); } #ifndef __logb libm_alias_double (__logb, logb) diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c deleted file mode 100644 index d9b40af2c7..0000000000 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Compute radix independent exponent. - Copyright (C) 2011-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2011. - - 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 - . */ - -#include - -#include -#include - - -double -__logb (double x) -{ - int64_t ix, ex; - - EXTRACT_WORDS64 (ix, x); - ix &= UINT64_C(0x7fffffffffffffff); - if (ix == 0) - return -1.0 / fabs (x); - ex = ix >> 52; - if (ex == 0x7ff) - return x * x; - if (__glibc_unlikely (ex == 0)) - { - int m = __builtin_clzll (ix); - ex -= m - 12; - } - return (double) (ex - 1023); -} -#ifndef __logb -libm_alias_double (__logb, logb) -#endif From patchwork Fri Mar 29 13:35:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 161451 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2055683jan; Fri, 29 Mar 2019 06:42:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQT1B7GkFAIQYCl11k4EAldT8TpGJTWGmcUON3XioyhwaShdj/61N0SR5ShtCUZusODwin X-Received: by 2002:a62:12d0:: with SMTP id 77mr47483870pfs.15.1553866936926; Fri, 29 Mar 2019 06:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866936; cv=none; d=google.com; s=arc-20160816; b=tO/ijGadBC9j0AWDl8cCGENBPv05nUXMaVSbbJG1dmhQ9iK3Bh+Ghc9z1FTBlN6sw0 dzCaEGRNwMWUQWPvdjZ137agWAR24Jp5rzYm/rUg3NsCTvwjvqzFIDsvWJsJQpWkFdtT 1j71wLgsWsSAeqxfJqoxILO3E4xsldLWZF0Y14OHwziY1cAKqMI/N7wBa7TXNSEN7tYc IJ05Js5x7Ebw10V92/i37UxrtwleR42Ld2hK1iGr+xCF84TgnAbBeaRq2oXENyUObpMl Kq56fWnw4Q0sGtWbFcE9I5LRNH9yNOdt+WA4+HfPBN8KIhyBeakiA2GujfNCdqJg24IK n38A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=E4FAv7PBwLCP6d6vZpaxRFgMx8KruYUip9Pfc2wWkhc=; b=NKHxfOCyMBBU5hJ6JJ+8aOx44b2MQpDKIcB74UCfYEWpUkhz9ZtnKWlp70s96UNijI pmg4zDnAui1ExKiF6jRp+QYHPQ3sqP0dcoX4HMuJ0oM9TiIl9wn7PgnVKMuEGvM6oDVf IVeGjN4os8CR9em8XjiVEz3zKPSf5BSMK9ccO88i6Ql5hFkok/0rM761+1QQ2OPLc39U 8WouKIx9/UB/mN+lfi8GTp2LB2Z52MjeUsiXjcVYbsElTUNT7CcxAD+Reai2Hwyc8xtw jUSZLsk0FqqbSbnDtrWDGzHdPnzIgIJHmyXRMN1mGfAwqYLmZTfUu0B6kvIruDw/xEgq XFzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="CYVy/aNt"; dkim=pass header.i=@linaro.org header.s=google header.b=nAdvOp8a; spf=pass (google.com: domain of libc-alpha-return-101020-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101020-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id k24si1774298pfk.284.2019.03.29.06.42.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:42:16 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101020-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="CYVy/aNt"; dkim=pass header.i=@linaro.org header.s=google header.b=nAdvOp8a; spf=pass (google.com: domain of libc-alpha-return-101020-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101020-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=fly8DU4xoC/hre6w0i+VhyXZzBpurLr mNxJ01sgsPge3l6XkYI6Z8j+xp/bWuvJkNetqD+W3vnCz/jVXQ3gDziGyi+eqhQA RbdhcdwrlBZ5qs8elLyW6XUPH6YiG3u8qnN+u2l0kBCSyEPlaBLxqJ77zvjVwxJI vD1AVFugp9Ow= 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:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=kEX5iS2nw3+etChNcSLEQ6pCrjg=; b=CYVy/ aNtDLBWN45LGZkLYe4Kq/khqWaZByjSFhKPGDa156eWn9srFRtfETefOF6PiL+wP 1YjJ2clFGRoWsuKshnAngoxe7i/UwECbWLLfJoqQFM92LeR9lzYG49W3faLGKWHK Y2fQoo6zFCJBq7wfHZlf/28UqOhcG8TlALmhis= Received: (qmail 124176 invoked by alias); 29 Mar 2019 13:36:43 -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 121855 invoked by uid 89); 29 Mar 2019 13:36:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=1023 X-HELO: mail-ua1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=E4FAv7PBwLCP6d6vZpaxRFgMx8KruYUip9Pfc2wWkhc=; b=nAdvOp8aWEEUxQzotHwzBQAyoyI6geeVkhLMkN5uvzBCm/0aGIRl7RmyGo9c+ynG33 xmR18lhz88/h3S6DC7UOliffZv1LJE3wLJZIaoSsRUQ8eTSOPLibuOrRhLgllVB9K94x 9AqBbm/zEgCF5FP5VLRTI3QGq8xe1VpAnZtLodQ5W7oeh5hL3ZMclQaYNtwt9eu9yE3J crPwXPsavNJqR0M0OA+K9TnRo3Ih8wgGPXeKAUEhF5a68WZxq3nCYI1GOEibwEFG+vxh C5XmuR5cfRwOGeHjgg1W9XfheCMFPmx4L3oMnX/XiOP3of9BsGKabKnjZwyZPrUESMJd Xsdw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 28/28] powerpc: refactor logb{f,l} Date: Fri, 29 Mar 2019 10:35:29 -0300 Message-Id: <20190329133529.22523-29-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> The power7 logb implementation does not show a performance gain on ISA 2.07+ chips with faster floating-point to GRP instructions (currently POWER8 and POWER9). This patch moves the POWER7 implementation to generic one and enables it for POWER7. It also add some cleanup to use inline floating-point number instead of define them using static const. The performance difference is for POWER9: - Without patch: "logb": { "subnormal": { "duration": 4.99202e+09, "iterations": 8.83662e+08, "max": 75.194, "min": 5.501, "mean": 5.64925 }, "normal": { "duration": 4.97063e+09, "iterations": 9.97094e+08, "max": 46.489, "min": 4.956, "mean": 4.98512 } } - With patch: "logb": { "subnormal": { "duration": 4.97226e+09, "iterations": 9.92036e+08, "max": 77.209, "min": 4.892, "mean": 5.01218 }, "normal": { "duration": 4.96192e+09, "iterations": 1.07545e+09, "max": 12.361, "min": 4.593, "mean": 4.61382 } } The ifunc implementation is also enabled only for powerpc64. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/power7/fpu/s_logb.c: Move to ... * sysdeps/powerpc/fpu/s_logb.c: ... here. Use inline FP constants. * sysdeps/powerpc/power7/fpu/s_logbf.c: Move to ... * sysdeps/powerpc/fpu/s_logbf.c: ... here. Use inline FP constants. * sysdeps/powerpc/power7/fpu/s_logbl.c: Move to ... * sysdeps/powerpc/fpu/s_logbl.c: ... here. Use inline FP constants. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c: Adjust implementation path. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c: Adjust implementation path. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c: Adjust implementation path. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_log* objects. (CFLAGS-s_logbf-power7.c, CFLAGS-s_logbl-power7.c, CFLAGS-s_logb-power7.c): New fule. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-power7.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-ppc64.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-power7.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-ppc64.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-power7.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-ppc64.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Remove file. * sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c: Remove file. * sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c: Likewise. --- sysdeps/powerpc/{power7 => }/fpu/s_logb.c | 64 ++++++++----------- sysdeps/powerpc/{power7 => }/fpu/s_logbf.c | 44 ++++++------- sysdeps/powerpc/{power7 => }/fpu/s_logbl.c | 47 ++++++-------- .../power4/fpu/multiarch/s_logb-power7.c | 13 +--- .../power4/fpu/multiarch/s_logbf-power7.c | 8 +-- .../power4/fpu/multiarch/s_logbl-power7.c | 3 +- .../powerpc64/be/fpu/multiarch/Makefile | 10 +++ .../{ => be}/fpu/multiarch/s_logb-power7.c | 3 +- .../{ => be}/fpu/multiarch/s_logb-ppc64.c | 0 .../powerpc64/{ => be}/fpu/multiarch/s_logb.c | 0 .../{ => be}/fpu/multiarch/s_logbf-power7.c | 3 +- .../{ => be}/fpu/multiarch/s_logbf-ppc64.c | 0 .../{ => be}/fpu/multiarch/s_logbf.c | 0 .../{ => be}/fpu/multiarch/s_logbl-power7.c | 3 +- .../{ => be}/fpu/multiarch/s_logbl-ppc64.c | 0 .../{ => be}/fpu/multiarch/s_logbl.c | 0 .../powerpc/powerpc64/fpu/multiarch/Makefile | 11 ---- sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c | 1 - .../powerpc/powerpc64/power7/fpu/s_logbf.c | 1 - .../powerpc/powerpc64/power7/fpu/s_logbl.c | 1 - 20 files changed, 87 insertions(+), 125 deletions(-) rename sysdeps/powerpc/{power7 => }/fpu/s_logb.c (56%) rename sysdeps/powerpc/{power7 => }/fpu/s_logbf.c (67%) rename sysdeps/powerpc/{power7 => }/fpu/s_logbl.c (72%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logb-power7.c (91%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logb-ppc64.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logb.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbf-power7.c (91%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbf-ppc64.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbf.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbl-power7.c (91%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbl-ppc64.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbl.c (100%) delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/power7/fpu/s_logb.c b/sysdeps/powerpc/fpu/s_logb.c similarity index 56% rename from sysdeps/powerpc/power7/fpu/s_logb.c rename to sysdeps/powerpc/fpu/s_logb.c index 4cddc0f9c1..364f7f0cc3 100644 --- a/sysdeps/powerpc/power7/fpu/s_logb.c +++ b/sysdeps/powerpc/fpu/s_logb.c @@ -1,4 +1,4 @@ -/* logb(). PowerPC/POWER7 version. +/* Get exponent of a floating-point value. PowerPC version. Copyright (C) 2012-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,59 +16,49 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include -#include +/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make + generic implementation faster. */ +#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR7) +# include +#else +# include +# include +# include +# include /* This implementation avoids FP to INT conversions by using VSX bitwise instructions over FP values. */ - -static const double two1div52 = 2.220446049250313e-16; /* 1/2**52 */ -static const double two10m1 = -1023.0; /* 2**10 -1 */ - -/* FP mask to extract the exponent. */ -static const union { - unsigned long long mask; - double d; -} mask = { 0x7ff0000000000000ULL }; - double __logb (double x) { double ret; - if (__builtin_expect (x == 0.0, 0)) + if (__glibc_unlikely (x == 0.0)) /* Raise FE_DIVBYZERO and return -HUGE_VAL[LF]. */ - return -1.0 / __builtin_fabs (x); + return -1.0 / fabs (x); - /* ret = x & 0x7ff0000000000000; */ - asm ( - "xxland %x0,%x1,%x2\n" - "fcfid %0,%0" - : "=f" (ret) - : "f" (x), "f" (mask.d)); - /* ret = (ret >> 52) - 1023.0; */ - ret = (ret * two1div52) + two10m1; - if (__builtin_expect (ret > -two10m1, 0)) + /* Mask to extract the exponent. */ + asm ("xxland %x0,%x1,%x2\n" + "fcfid %0,%0" + : "=d" (ret) + : "d" (x), "d" (0x7ff0000000000000ULL)); + ret = (ret * 0x1p-52) - 1023.0; + if (ret > 1023.0) /* Multiplication is used to set logb (+-INF) = INF. */ return (x * x); - else if (__builtin_expect (ret == two10m1, 0)) + else if (ret == -1023.0) { /* POSIX specifies that denormal numbers are treated as though they were normalized. */ - int32_t lx, ix; - int ma; - - EXTRACT_WORDS (ix, lx, x); - ix &= 0x7fffffff; - if (ix == 0) - ma = __builtin_clz (lx) + 32; - else - ma = __builtin_clz (ix); - return (double) (-1023 - (ma - 12)); + int64_t ix; + EXTRACT_WORDS64 (ix, x); + ix &= UINT64_C (0x7fffffffffffffff); + return (double) (-1023 - (__builtin_clzll (ix) - 12)); } /* Test to avoid logb_downward (0.0) == -0.0. */ return ret == -0.0 ? 0.0 : ret; } +# ifndef __logb libm_alias_double (__logb, logb) +# endif +#endif diff --git a/sysdeps/powerpc/power7/fpu/s_logbf.c b/sysdeps/powerpc/fpu/s_logbf.c similarity index 67% rename from sysdeps/powerpc/power7/fpu/s_logbf.c rename to sysdeps/powerpc/fpu/s_logbf.c index b0d006b5c7..cf564ad294 100644 --- a/sysdeps/powerpc/power7/fpu/s_logbf.c +++ b/sysdeps/powerpc/fpu/s_logbf.c @@ -1,4 +1,4 @@ -/* logbf(). PowerPC/POWER7 version. +/* Get exponent of a floating-point value. PowerPC version. Copyright (C) 2012-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,40 +16,33 @@ License along with the GNU C Library; if not, see . */ -#include - +/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make + generic implementation faster. */ +#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR7) +# include +#else +# include +# include /* This implementation avoids FP to INT conversions by using VSX bitwise instructions over FP values. */ - -static const double two1div52 = 2.220446049250313e-16; /* 1/2**52 */ -static const double two10m1 = -1023.0; /* -2**10 + 1 */ -static const double two7m1 = -127.0; /* -2**7 + 1 */ - -/* FP mask to extract the exponent. */ -static const union { - unsigned long long mask; - double d; -} mask = { 0x7ff0000000000000ULL }; - float __logbf (float x) { /* VSX operation are all done internally as double. */ double ret; - if (__builtin_expect (x == 0.0, 0)) + if (__glibc_unlikely (x == 0.0)) /* Raise FE_DIVBYZERO and return -HUGE_VAL[LF]. */ - return -1.0 / __builtin_fabsf (x); + return -1.0 / fabs (x); - /* ret = x & 0x7f800000; */ - asm ( - "xxland %x0,%x1,%x2\n" - "fcfid %0,%0" - : "=f"(ret) - : "f" (x), "f" (mask.d)); + /* mask to extract the exponent. */ + asm ("xxland %x0,%x1,%x2\n" + "fcfid %0,%0" + : "=d"(ret) + : "d" (x), "d" (0x7ff0000000000000ULL)); /* ret = (ret >> 52) - 1023.0, since ret is double. */ - ret = (ret * two1div52) + two10m1; - if (__builtin_expect (ret > -two7m1, 0)) + ret = (ret * 0x1p-52) - 1023.0; + if (ret > 127.0) /* Multiplication is used to set logb (+-INF) = INF. */ return (x * x); /* Since operations are done with double we don't need @@ -57,4 +50,7 @@ __logbf (float x) The test is to avoid logb_downward (0.0) == -0.0. */ return ret == -0.0 ? 0.0 : ret; } +# ifndef __logbf libm_alias_float (__logb, logb) +# endif +#endif diff --git a/sysdeps/powerpc/power7/fpu/s_logbl.c b/sysdeps/powerpc/fpu/s_logbl.c similarity index 72% rename from sysdeps/powerpc/power7/fpu/s_logbl.c rename to sysdeps/powerpc/fpu/s_logbl.c index 76c29daeca..543cd4a188 100644 --- a/sysdeps/powerpc/power7/fpu/s_logbl.c +++ b/sysdeps/powerpc/fpu/s_logbl.c @@ -1,4 +1,4 @@ -/* logbl(). PowerPC/POWER7 version. +/* Get exponent of a floating-point value. PowerPC version. Copyright (C) 2012-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,22 +16,17 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include +/* ISA 2.07 provides fast GPR to FP instruction (mfvsr{d,wz}) which make + generic implementation faster. */ +#if defined(_ARCH_PWR8) || !defined(_ARCH_PWR7) +# include <./sysdeps/ieee754/ldbl-128ibm/s_logbl.c> +#else +# include +# include +# include /* This implementation avoids FP to INT conversions by using VSX bitwise instructions over FP values. */ - -static const double two1div52 = 2.220446049250313e-16; /* 1/2**52 */ -static const double two10m1 = -1023.0; /* 2**10 -1 */ - -/* FP mask to extract the exponent. */ -static const union { - unsigned long long mask; - double d; -} mask = { 0x7ff0000000000000ULL }; - long double __logbl (long double x) { @@ -39,24 +34,23 @@ __logbl (long double x) double ret; int64_t hx; - if (__builtin_expect (x == 0.0L, 0)) + if (__glibc_unlikely (x == 0.0)) /* Raise FE_DIVBYZERO and return -HUGE_VAL[LF]. */ return -1.0L / __builtin_fabsl (x); ldbl_unpack (x, &xh, &xl); EXTRACT_WORDS64 (hx, xh); - /* ret = x & 0x7ff0000000000000; */ - asm ( - "xxland %x0,%x1,%x2\n" - "fcfid %0,%0" - : "=f" (ret) - : "f" (xh), "f" (mask.d)); - /* ret = (ret >> 52) - 1023.0; */ - ret = (ret * two1div52) + two10m1; - if (__builtin_expect (ret > -two10m1, 0)) + + /* Mask to extract the exponent. */ + asm ("xxland %x0,%x1,%x2\n" + "fcfid %0,%0" + : "=d" (ret) + : "d" (xh), "d" (0x7ff0000000000000ULL)); + ret = (ret * 0x1p-52) - 1023.0; + if (ret > 1023.0) /* Multiplication is used to set logb (+-INF) = INF. */ return (xh * xh); - else if (__builtin_expect (ret == two10m1, 0)) + else if (ret == -1023.0) { /* POSIX specifies that denormal number is treated as though it were normalized. */ @@ -78,6 +72,7 @@ __logbl (long double x) /* Test to avoid logb_downward (0.0) == -0.0. */ return ret == -0.0 ? 0.0 : ret; } -#ifndef __logbl +# ifndef __logbl long_double_symbol (libm, __logbl, logbl); +# endif #endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c index 812771ac2e..c893ebcf29 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c @@ -16,16 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include -#include - -#undef weak_alias -#define weak_alias(a, b) -#undef strong_alias -#define strong_alias(a, b) -#undef compat_symbol -#define compat_symbol(lib, name, alias, ver) - #define __logb __logb_power7 - -#include +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c index 62c2318421..059c53bce2 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c @@ -16,11 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include - -#undef weak_alias -#define weak_alias(a, b) - #define __logbf __logbf_power7 - -#include +#include diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c index c4fe590c6c..22a6ffb064 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c +++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c @@ -17,5 +17,4 @@ . */ #define __logbl __logbl_power7 - -#include +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index 63de39bbf1..f4e2e88af0 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -32,6 +32,12 @@ libm-sysdep_routines += s_ceil-power5+ \ s_llround-power5+ \ s_llround-ppc64 \ s_llroundf-ppc64 \ + s_logb-power7 \ + s_logbf-power7 \ + s_logbl-power7 \ + s_logb-ppc64 \ + s_logbf-ppc64 \ + s_logbl-ppc64 \ $(sysdep_calls:s_%=m_%) CFLAGS-s_ceil-power5+.c = -mcpu=power5+ @@ -48,6 +54,10 @@ CFLAGS-s_llround-power5+.c += -mcpu=power5+ CFLAGS-s_modf-power5+.c += -mcpu=power5+ CFLAGS-s_modff-power5+.c += -mcpu=power5+ +CFLAGS-s_logbf-power7.c = -mcpu=power7 +CFLAGS-s_logbl-power7.c = -mcpu=power7 +CFLAGS-s_logb-power7.c = -mcpu=power7 + # These files quiet sNaNs in a way that is optimized away without # -fsignaling-nans. CFLAGS-s_modf-ppc64.c += -fsignaling-nans diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-power7.c similarity index 91% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-power7.c index 507862b2bf..807bf58eeb 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-power7.c @@ -16,4 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include +#define __logb __logb_power7 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-ppc64.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-ppc64.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-power7.c similarity index 91% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-power7.c index 3535ea78cd..4fee11dd84 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-power7.c @@ -16,4 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include +#define __logbf __logbf_power7 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-ppc64.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-ppc64.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-power7.c similarity index 91% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-power7.c index 915636176d..c413d6e50d 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-power7.c @@ -16,4 +16,5 @@ License along with the GNU C Library; if not, see . */ -#include +#define __logbl __logbl_power7 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-ppc64.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-ppc64.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile deleted file mode 100644 index d7ad1e2724..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -ifeq ($(subdir),math) -sysdep_routines += $(sysdep_calls) -libm-sysdep_routines += s_logb-power7 s_logbf-power7 \ - s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ - s_logbl-ppc64 \ - $(sysdep_calls:s_%=m_%) - -CFLAGS-s_logbf-power7.c = -mcpu=power7 -CFLAGS-s_logbl-power7.c = -mcpu=power7 -CFLAGS-s_logb-power7.c = -mcpu=power7 -endif diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c b/sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c deleted file mode 100644 index 2599c771d9..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c b/sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c deleted file mode 100644 index 7a5a8032e0..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c b/sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c deleted file mode 100644 index 524ae2c78d..0000000000 --- a/sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c +++ /dev/null @@ -1 +0,0 @@ -#include