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 Netto X-Patchwork-Id: 1069652 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100992-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="JYxCeXcj"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="heMyRpn9"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2mz3V30z9sNy for ; Sat, 30 Mar 2019 00:35:46 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=pFwmWt5+wK0IZEsCooRhJpfcM6y3cqB LwydM2JnZlnt74akzEYjDlVaLynkZ9pbOpoJXVcX6T6Oj1NTStPg2XxTkp0gOobF VEW34tpxsXd0PfEEGk6P0qB3bsKxQlLWhMpeGsn+6ti8ok2CskPcvRr0pGuLuCj4 Q/BNDwBP45us= 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=JYxCe XcjEy5v9Ocqbubj2lAx0UJPTFrGBuUYeXY55mZja72MMMq1yQWLICgS3W1P73kBr c4PBYnekr7YFS6JwESu6f2601zJZ/u3KgsG8jPgmJ4TfAcf4OrQG9h5L0ch9lNYk dUgBfoGxMMKErSSDugGIeN5DwVARh4e5x02Ezw= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069653 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100993-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="pOfY945E"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="EKArZg5r"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2nG3rTxz9sNy for ; Sat, 30 Mar 2019 00:36:02 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=oEv3G5DRw3gMQSqw1hYY5MWUnD8++QT 9or+WYQfuiLeZ6ku1DRIseiGCxz+yABUqfoEjedXeuvdIDU+zt5/vC2WVdO5Vf9s mAm1jsw3s8NxUMnzBF6b8uPghdLUd5x284ClDDF8XiWSuYcNa4ID8KtkfEr2qsG6 vNcJWpBTqOW8= 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=pOfY9 45EWG3h8tNPQktZdQ8kQWyVkTMVGYYJ9dD/dt/zU2ttwzGL+72RmZ0HJX9dxpyBx 1ywm06F9w+rjBop99kM32Xn0OtA9+A1aHEyj/7V0pE2vx0EUzE381M6RMvpXwEFG +jAe7pAokOuf1nAbbVWZuH/+wzGJKelF1Zs/sM= 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== 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%) 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 Netto X-Patchwork-Id: 1069654 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100994-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="CD0AFth+"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="rhKMyfjk"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2nY70wpz9sQt for ; Sat, 30 Mar 2019 00:36:17 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=BeS07GjnZMIeHDbWa5rQ7XVA5Hoeurr unHfx2XZpEozEOkB9avZdnBmnUSAD1Lj6lla2Srx8u3MjqIR+VnxkGfj6R/+G0NT oFwnYc4KgqT810bbvysOVXqZydvRMu+bpAcW1i2dCKSCclKmRs0mZ1nYX62JuVEH 3PlPupJo9qCg= 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=CD0AF th+ZetkrEeUgQunoCQI7cZAqqRdwyZ/BSafXhhH4aMMVw7qj4R5PdeFaS8yort74 cbjfOy7NSFXCYIiFh38wH9+3Nbe9onSwFGpD9yCzTjg/64mZOh1MZU64PRhs7Y/k qaBV9lcmVj8UfO4QKRTiY4b02fw0K2wHrLCpiY= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100997-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="XDqf7NzL"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gGLSptA7"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2pL2X0Fz9sNy for ; Sat, 30 Mar 2019 00:36:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=b5sCAbCiZ2mxRPUJHIdKvUPeYbMummP kfj6hQ/aHI+d6P1olDEiXsHHh4iMSM7afGXmhLG2+eFgxd3U6U9wRnE5Yf51taAp mJVCU1dWptQ6UGpCamnIHtwhqJQy7540hfOKlkWsfd0WJRhpe/obhpTrqsGa3CgC yighX82CHBuc= 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=XDqf7 NzLi6stkAgol/ihtYv9KCF+1lQ64zHA/OWVEBxoTwL+sS+zc5QQYL+Rg4+1S9XD1 BV+0v1FkHwEOMnN+9X6kStgVgu5G7vG7EY2kg37VDNplxw/hx1HCEghsRuXlKsDk PXraGlNKFHdq3AhtSNSSk43VOuUQlnGoRezihc= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069658 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100998-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="XUQZGEME"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OtejXxCl"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2pb4h4lz9sNy for ; Sat, 30 Mar 2019 00:37:11 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=DWypjuGSJHDKuanqPr3/7BU0k1P6boI inRK3njpyrpziP7KXbsBHnbtzeu2lDMI84nRWKXq7hE52hNHFNHI3ug/Wokid/W0 9nC99f6q4JGy/aVyxpvqdiXyhc10o+sWqSxznU+hV9/3zovc4hoOZjS7T1BvyDcm boHNMmXgDWzg= 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=XUQZG EMEGbYA+iUhsPusFbTUEk2CZRkVwLL5JMikcw3FXu9tx0BHXSlrQRUofmaEuQtU8 IsYw+ZZg6116Yi8xOPYXOM/v8q94NwSE0Bhv+mVDDgD2apZlDYReMt0uCX+gJxO2 KNrddaKHwRbISf2Z1xKDYhCThuP1UMoMTgMIlE= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069662 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101001-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="SEzG/gRF"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VjCR/geW"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2qN3jxSz9sNy for ; Sat, 30 Mar 2019 00:37:52 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=JiILPCkISwLSGhjE7MC4A9OmEZwawAH PvNj9M7PTjsApaY3kafzjIJeMyWaxjtfUuumo228uHZ6wYVgSpaBSeb7U6tYlZPV Bq5Gj/3C0GJjfnY724dqVWcu1Rt6KhJlo9tpAAhwuFvB27IOP5i+s2Izi1NccLm6 t3vRZ/Azc9K0= 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=SEzG/ gRFsBokr+hqBegHk/w2w0dSTFCxAdrjMf818y9OL0/NAZIxCVdE8kRHSb90OX2Ua LfAVDIQrIlkByZROVNrIuMIf3ULgdi9kEEyqyqW30+VCSyzi813wYehic4etkK0e wukoVzTRl9wp4bMuzwKMpWpCKT3dDzcxnNcnyw= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069663 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101002-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="AZ/Rc/p/"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="HXdMgwBC"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2qd6jfXz9sNy for ; Sat, 30 Mar 2019 00:38:05 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=A9sxTw/KT2de161+L8njbavY+AZYw8A rexLSSN3t8VV2Qh+exV7NQksKyRY7OZ2OsPAZT/QnZwg2ZUcFPYpoYxlBEXznFFC 469X9nkJ1aJp22QcQYaRnKv+dBQ2e3JCBsf5MHDgxaIwXkEnjQlnp1R8GrwkFc27 rDFyJ/r4DT5Q= 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=AZ/Rc /p/acJASsUDFMzJLjnitM7qmUaANydsg6j3/Orp9NUx1kygdu1aRzdXc5tXPfc2k WGEoA4dGXA5hCuiTScSvyXSjAjE/VKlEQ0VWV422eypSPq/7L5M5q1/x882mwZ66 gP0qIV0XJtOML5k9qcRo99GA3Yi1ueVmXwXKbs= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100996-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="WHEb1nrA"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="EvUSV/6x"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2p50rc5z9sNy for ; Sat, 30 Mar 2019 00:36:44 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=aA8JEzbjEWqfOnVWt2VcTIhJFKCOKXC 3n1FlaWqaD4qx5fJpuryLdTRtP8cG/0NA/SfnFVkc4jXP+DSKqUD1Ouwg6AA8WfR 7Vso+EVK7qyHiwyvTbmT/20GEQERUpgf4tNS8RDgcH2FcbBN/H4wbI5hFprPoytF Oe376YY9+G78= 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=WHEb1 nrAaGYaJzyGnOP26V60mhhbVoK7HAOVC1zT08r5V7IsIzZTTzfQlRujAynJLaC8x wkmxHXMJGo1rQxKRxQhOo/+30WM613THBEQx4bkcKdMjAFPAn1Z2ntwAp4IrlR1p 2CvOIwdb2+7JHWZy7EXKR0+Dn6RmkJcBGcfJ4E= 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== 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 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 Netto X-Patchwork-Id: 1069661 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101000-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="EY6CtPfb"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="CAlrMn6a"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2q70rdWz9sNy for ; Sat, 30 Mar 2019 00:37:38 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=gLBaDeWIInkQ8UPqpjghEhIN2++LUh/ M4b2gxQvESE5cfyOb2nfhcHCqDIAt0ESWYiTdsJ1XD0S48t/euMHxAZKTMYJZ1eV F6ZD9LjpxdfK4wjtA0iLWUlnhk17AqNHevwyE4KQFANvAl5FTTBJG3LvtaX/Tm5k OOYXUhZyYlQw= 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=EY6Ct PfbktTLOr4FietqI6hCKaMtVYm+XD/wglkxGTO8vd0zTvTJ4zcxty8XHVWEBLalv xZHrEt/nUX/ze4GkdOmCxuEUEHyeeYBMBjRhIGNEYLq17hqWOGcjBccyWzZOkxMC IYi/fMgoqTPqHUm5ZZWllxzUnbVm81WbLgcP7E= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101006-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="xrNv3sjm"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QvIChj61"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2rc2dR6z9sS6 for ; Sat, 30 Mar 2019 00:38:56 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=EsN12cZDWdMVQpO/FG35pkRLfz2VSkk 81dyWXsfX4l/P/UXRApXEpBAPQESmdw4CC8Nq1uf1doOo9Cm7KhR0dlWB3DyWnT3 Pt85SrIb4ntyhLPnAhyCoPHqkSVcL/Yby3qFpPWVZ10soNZ/zKtoFcuRrHKG9aSx J7wIDxqbhRCI= 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=xrNv3 sjmJ6caB+sI76qerpZq8vICUu65vJbj+IB+9n7yPb82UjX3qYwoa+J08viCfYHay Qnom696ZYsUimO52SFVRtoZUSOhhPpYDBQLM/56o0hKyvahGjeMQWHS0U+2XZ5Xq vwKgSnmB/V/opYwo20gbA+XfCw7DKl3/vlXu98= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069660 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-100999-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ydUAZsHT"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zLdEQ3PP"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2pv3Zgbz9sNy for ; Sat, 30 Mar 2019 00:37:27 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=BFl/LuWTYrIXvQj8M95OOh3XQ6NhRyy nKbflVpRCgVSL2n/VjyrIRI0NjUCPS87zUjU2zSooEHrEDwdPAPE6TTC2pcBvfms dsmWs+kITyekVVVWXkRKYb2DGvK7krs3opdQJXJT1xRsAO1UxO/C9j/sM3jx+Ys7 oDfSK9jvONqo= 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=ydUAZ sHT1Y0bL8LzsG7K70yBCrBUtiuUp52LzBcLTN/Ywfyl9n+ETt6pI5Qx3MgQiAryV IXkqjU4tU7vk3qulx1qWR2V7N79EVr3x2A4iqhC86iM/d0dUMvDVcd+4rF17VxCq N6ML0iKgrQH4ae4snjmmAcabvUakDQiHNKZbO0= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101003-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Fwr4poKq"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="rILlrctt"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2qx2vRJz9sP1 for ; Sat, 30 Mar 2019 00:38:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=QitsYJVgbetAuZSSxYMeHdPPgtT/RM3 hqIlE91gQju/H/2OxYr17H0HMZkWWe4W7eUy3AekO8vUBAuUM3MxoymyyTQH/H0H k/iVNfqmI/ML2aT6qhhv9K9rgGb+GKWsgkS9skaoHvWTBoBW2uGaAP6wGCvCp81a AQcTSMqxfhOU= 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=Fwr4p oKqjBrgqIcVCn8Bgm23pImp0sT+cme+ONLKE6Yyu97in239XPO0KjO/dzO6qA+G9 SupyUeo+cHPFs9eCbRONH1RFrzvz8tD8vFX4j2c2M7VEbjLtKOAaDMg1w0PF2tCb 7ezRhj6xmu+bsXBTjJDurxepDgUbEXB/ulD/5E= 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== 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 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 Netto X-Patchwork-Id: 1069676 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101013-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="mUpj5N06"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DPw8ICLM"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2tP73Qbz9sP1 for ; Sat, 30 Mar 2019 00:40:29 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=thR19K+l6z8yvPMWC7vy4/1xYf65cMT aJMVuuQ2J+NJQTYj45IKgRYqmTHfzHdYstN//24vAlOaVU/iUcQuQ/RUBts/+BAA 6PglJ76EuEY97bc5qrRTPK3A7RePltQBRCY3zDasb2C5nj5aHiY/TevHc3fL7xzz LAPgFi12Jacw= 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=mUpj5 N06LwXlewSG6GmJ8jCD/MZVS7BjJswi9CimIOkwjg0paOojqpFWL/hvvB5wqnvp0 mcmjmlQo0YWnKe+Q0HZI4NuRS+z4GOG8G1jt+wgRxGQd2sL5IpHRDWOTbL6AfJTW wy1oyqc1XjkB6amup48gK+qsDAUcZAPSvY7Gn8= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069666 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101004-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="pjm3Wr16"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="RShaAOEo"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2r763ynz9sRY for ; Sat, 30 Mar 2019 00:38:31 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=ZAzEOMWjZkO/Go7p9h9fBzkEOVSx+R7 z3RMqdmyuAZYp/PJJp5b7myo644pt0lj1Stbd/YSxNR2QYssW3xpUOZKgXMrJ1Hk RayLSfy4OUb0QPNCVN3/NULPZNI1fKDJrD7a/G54LBA+90ix6q457VOoKt6BuIVN 7vVMKAbfXE/g= 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=pjm3W r16VI+sFzmwfsFDS2hVfZdgTzgznFGNPvz49pgneScPu3sJHGtDIugPNrcgTYkW/ xG2NIorGEYhZsHvDbw7KwXnKA0VKgVIBaPg0iHhV4dMJbcQp9AlEH2E2wfLDNS6R ZMP27pnoiCRGJzw9UTT1V6ixzPOePZCzXnkD3Q= 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== 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 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 Netto X-Patchwork-Id: 1069670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101007-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="AHWjhRDy"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nFuDpJKd"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2rs6F6kz9sSD for ; Sat, 30 Mar 2019 00:39:09 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=pwmGd7u1dRUmTz4DGwpQ6JYRLqnzXuL 8bT/kN91nbF1N9Mezl8H5E1IBG5cNAVqjVXdLIotykKMjMHgVMPW+tSLJ9rKQLs/ j+ymP1aTfP4Ece1f1a8+QJ78iLYeEMBuHn8RlYBINwinXmpTGjyNC3HHOr9whDGx HYuB/z/OJp8E= 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=AHWjh RDyjyOQFnPv4hb6X7IHn1z3UmfhNl4hfOthg1a1TaCdDXKtDgsddPOX0QIszkBqX rTRlnWkCNxKWPh1KccZx/R2yahTyIcviU3ipX/i0rPtmNresrAS8gFSUvQgltcPj VUOVMQOg0D8FbcPNXapI/UPjEOju4wRrGCfrc0= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- .../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 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 Netto X-Patchwork-Id: 1069668 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101005-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="NnCFqZ3A"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="HXD7LsDd"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2rM5Hyfz9sP1 for ; Sat, 30 Mar 2019 00:38:43 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=ZiSuH3tpVp0vMtxwMXGrJwCh2UM14sk Gk2hgAIoWvlTaIV4J4WmsfPnzSqCPE4nwpJhD7AC9N+7haEqjXilBNaZhPhGjlFP Tw+ALrUKpwvlSP0Zgktpmd7cISEGBbPuGPWLz8bPVgWvQeqj9LRt1NFvTrhdTftR TKTVdJ+VtWoc= 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=NnCFq Z3ATm2bTWwMulufJ2lCmqXy6+VyVH5sDpPc1CKlpByZKbVmiiDUquJMZ1RauNHKR orlqRpO3IW/zV0PmAhx1EkA+GfUDVJbK9sO0QMGjMjdR79gH49IsihhCKpJqjKKL xNtBOqhsr6rxjAh9MqF7J9F73Cu9fIvV/CpY3g= 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== 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 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 Netto X-Patchwork-Id: 1069672 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101009-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="B1OXpxQc"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="yBDolsbL"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2sP4Yzrz9sQs for ; Sat, 30 Mar 2019 00:39:37 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=jOHoHaYdFtNr5oTsMoNhIjdw5l9zGCK tqrkv9XylH6cBNJp0WxAf115grKMUdU631cavx6oKwJG+BXDwqCP59oLL/wc3oLJ zteYGm9cltHl1W+I5RWouoLzC3u2cUntTEr9u8/cFPwshe6kNPeC4AR6gwk0y+oz CUMr0IHti18w= 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=B1OXp xQcS7dzc4UuqRUI52OahdtHSGAJO+JFsfVwrbOqk73mw/tEVidmIXeLMYRMhfOWO 8iVp8/u+WowfQr3Hlp0N0zFPhXKqJcf8+pWH073Sf3bsRC8mLipbMk8Fa2cdUeq/ wxYc+WyDQ3uC8jEEncVHOPiadGHgEwhRIYA4DQ= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- .../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 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 Netto X-Patchwork-Id: 1069671 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101008-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="fYmysA6A"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="aYoxac61"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2s86xDfz9sSl for ; Sat, 30 Mar 2019 00:39:24 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=oP2HHpLwv/Va8B+YnQKbr0IkwVF2X1a DVAgjBKuFyHuOAUB4lwt0KbDzrh3qz9UGQtIIlDH3mW9SgU9ESc5hY7+j7MEcE+v xFbRz7A0szI662ynbd+dUzuCt3AKGhTZLMoUqC9JjnHmstHnkZiceIwnlNtsmXei +njTcK3m65q4= 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=fYmys A6A0e1wLZDY65nA7S8uCoeBayNDU+ZWWIdzzpKkSdB+H1oPAyVKRQXpHa6OSejCD 82YtO8CBPnJdSdZL9FBE0+dP8etJ9bPGXqmNLQslmIgNXsARC+wGGibh08N9QXWY qpfuYMBNoFiYAjETI367fwFsgqnaGOQN2hXWuE= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- .../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 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 Netto X-Patchwork-Id: 1069673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101010-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="V5CzubXR"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KQiseuD5"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2sf38Wbz9sQs for ; Sat, 30 Mar 2019 00:39:50 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=biplm5KB9ZyWFwic42+PeFs5KfAvsdw nUARqnywP1vuIvOTob/6P1k1DwLFLpCUnwoAO2j5G9glhTqDtC3EbZ20XsWlnavM +15z8kYgg4RfSO2pYx23PdKVxrVRd/DVJDk7l8z6ZR2NKiIKPc6gl45mQ0czsgZS 2sLTEaikMJi4= 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=V5Czu bXRA7QozU5O8BESHKlyHe7FFzjwmzqim7DQ28rcQkg+afMRRt6H/yF+ORxv283Ru oBPIM9xQiXoCeIMDs3NUHTthu1u8BVnDeoTmMkKw7Fa6PWxR5zXXOhLSxH3QuN0h E1wofiDJ9urpKVqlmDzPz0x8cvR0Vcrc12tCq4= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069678 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101015-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="FAZ1SIqS"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="lW2DLdLI"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2v226sZz9sNy for ; Sat, 30 Mar 2019 00:41:02 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=N5NaZyVal1gqHC+xrq7uLqEbv4dVuyj cfKP04NY7NdqqjiQ2nL9YVSEmtjcNXWSi/hmnSY7JcadAvbd0mvXs7LH7GVdVIoG gaJoqVqOacfmDoM7o5uUKTDxqbXOGrTmnV+y+BvG8vA6mLk+ocHXysUXL+3TQLTs N8Nnwzcx7iMs= 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=FAZ1S IqSzHFY6LiCC9fMfLgGCyHGT+U8rJovVPIKhEEZQJQmLYuOfaIm9AyDd6uo5Jg8S d3pTkzJ8u9E7F/d1h6KViN6+Y07w4Q6tfcU9aj8nJIL75vcoQRQaKvDrOcO4m7BK e5xv5MtABk7yTZBXJUofPYSzilY5xybPB/gDO4= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- .../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 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 Netto X-Patchwork-Id: 1069681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101018-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="uwizQ5Zc"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="jsc1gl0x"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2vs3dh7z9sP1 for ; Sat, 30 Mar 2019 00:41:45 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=KTMTzGQLtavTGVrLJtvA05nzvfX1h7Q dwcu+fp2wyR2zaTLOiCfYzcCMHCIn8wifFzSKR3ty3oiXzl8S5+t2Z0lXBTsuvza zPpYbpDBVCqBjweDVq1qlESSVmWJmYDGutDXwyEv1fIHi/S8HmHclxBpaKSRjwSL t+cilmeMr26M= 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=uwizQ 5ZcipN7hPY2BFWB2CkOPyps4cydzoQJIXbd8JGmn6Bbg2MbPmp19HZ/mDMS6xykV tqkDlXdd0uICk75e6Yj+o029f13rkZK+Y2JFncqnGCF8w5ipk6kUO7a1gEbPvCaZ tFKe1nagIHwCijIuI0tmWCecBjRRPBhkCUNFwQ= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069675 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101012-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Fy4b3Kzu"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="waV77zUD"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2t85YGqz9sNy for ; Sat, 30 Mar 2019 00:40:16 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=JOkW6dAMZDhy2xm3nWUHzD7Yt+2zH+f GaJo4OhvoNnOdt3EnzUtFEGD1DflK1t4YEY82MV/pTXtSB+QUsPafTwrVDusBNZ0 zgAPHy9CPg0G2eIPydg+CZxj4tmyUJSBa8FJs43C8ATSlRvZuoKxn5tNfSvlgy98 GnjwX03j7oBw= 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=Fy4b3 KzuBvuRbPYEBshW60hZsLEaUemO/YXyiXST8RZ+oXP+ZyjRHlhZm/DFwjIpBLCnq vc6FiwtlwtH8JfzHvQ64YtkTqbftEachcY/VmdM13MYjxPwNs/fG6mXo/eLHZlen gyT3MsdZ3gVU7Oqy7uUWfifZu5ywAx9znDDn3w= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- .../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 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 Netto X-Patchwork-Id: 1069674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101011-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ReN5Bjn/"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="xK0m9vMP"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2sx1Kqkz9sR0 for ; Sat, 30 Mar 2019 00:40:04 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=XYTvFmlfEkj+Pc01GpTKbeYEb/aHa// GaA9XQn/tbDSA/npyJlMebYihzYFie9D/yS4jhEj2+w2oBnEUxW3w3vVNMCjEjHQ nfMX6Tge2q1nwhYtwKF/r64Tlwd+XfJI3UgLZKhFVOBjemQjbhiZv7o/ClFwDA5h royVVXfzSwoM= 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=ReN5B jn/eQSYQty3N8INk46AOwxDQ/HfM1ks58Fi+RXSevPGAqFmZjUlBafWKJ+XIATVo AHhvo0Xi5rgjD5AqaM6t26o31CsTRXdeEBN7p/lvaH2dJPJNWTpoVCKCclogdrx/ rmCsVBMnhonb0Zi67rridpCJAvDeAvirprJ/cg= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- benchtests/Makefile | 2 +- benchtests/hypot-inputs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 benchtests/hypot-inputs 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 Netto X-Patchwork-Id: 1069680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101017-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="NIFyuUeQ"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ejMWvB2g"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2vX0X12z9sNy for ; Sat, 30 Mar 2019 00:41:27 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=eWa39iZ1FTIKXBT0NJ3eVsBaeKeFpBh WiEazrH8bQ8WNbgGlqT+4yj0e6SrlDjT10/OKSLds0EoVXRjETzLgoW8hTR0jjVt qYB1uvLB7uF4+oWtee/3BcPYQj/cgFjQKGuSkvCz80xLkFTlGWJZv8c1CTxXZNiX sd3+Lmx1UVR4= 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=NIFyu UeQR2w7xhElaq1I2XZP2709eP+Cl+sh2bUkMLzdHO60hD4s/aw5AHAJPBOK2uN0D vlCGxSpVFyb8APyB6ZBJOVj9tjy53kEutlQELvNkm/tZicIW/gDDKjvOwYbc1oAy /52Bs7bT5L4c80Euxu8Nojbtnhu02mIWm25U/Y= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069679 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101016-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="cRFsEuDd"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="P0WKEveI"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2vH4vHDz9sQs for ; Sat, 30 Mar 2019 00:41:15 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=hDi8Yurh976Vw1vUPQNWGrnCDPgl+ei xFpeohLxqgWu/GJwyliHjEc9I50RJXc3sClGdqPI6k+jKmPonW+7QVk7X28DRhHq k8//OmYBIN+AUkfVwPOW9cz6QTTv7kxKY15dntBtrtEG1K0qAsaK1tLjPXkUgabZ QtyBLPNSk+NE= 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=cRFsE uDdBd/YZMXjNxiidYUcSTBpguO4drfEWZSRwR2VSjmk4lfUvPpPUy372t+wL23yh edJ1xSaMZZJ7Y0Em2N/QNdySPDOPFiFKAB9uMSTq3/QHXSHseWUGoEPi1EXgJe4B luz6WriX+OrCFN7/h7ZdT93znX69pR1oCX+jso= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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%) 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 Netto X-Patchwork-Id: 1069677 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101014-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="B2OeB/bm"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="BSxaJPV0"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2tm0X9tz9sNy for ; Sat, 30 Mar 2019 00:40:47 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=tyXMQgEJnrFZqO6IV6Pt8+U5YYMacvD 6IVkYy5T/lwRR67Z19bkSlZO3ZsmEMLsEfU7P5BGm/L/6z02JlsBmdi+HneRsOWs aFADvZUsLTOOzXGToymawISpD0mFP2DmdEFy4/RRqR2bOfKD8bzesnAtxj5dRNu6 8f7RMPOQLt5I= 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=B2OeB /bmShhpwrtEpz/yb/U9dRbq6PWJ1uqDVwvxanRiNSmofEghvZMJPs1wOVuEgOoYQ r9O4nm5RXtlrQ32ENyDz5mOqcnDVeeAqpiEP2o0NXODggXs2arGsEU2k0LE/oCYg ThUXDYh24flyfV+8q5beg70CsAOnJIzvN4f3ik= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069682 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101019-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="uGkw7p20"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="o+HBqyBV"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2w72jrvz9s3l for ; Sat, 30 Mar 2019 00:41:59 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=fFRMLEVdgB02qWCm40xun0NSbE9bz9c yDBfbRQO+TYV+BuVcMiIkgg63r4exOrwnsAmpHJLq4eEFIxoo0aERag0oNsJ95HN LsRYvJDHKOPiRdZzQerQ6PKL36k3KK+mDHIcS7Vjp2sy+dWvWQMMYAb1MO47pHLj pvlQp+60LGsQ= 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=uGkw7 p20odU2nXaV5yDzNmwR78nhixfKEiN680+I9ZFzdySzA0jdMe5Gc9ZcTnL34PocE oMY5MtgLUb8igb5SqoR5IpCUFS3FwrxU3uL5i/NGlSac9/o10pWlSGNQx00Id8tC bAoO1NvRhAKWAFkKlBIPe5mtt/XDzMI6tDSuT4= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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 Netto X-Patchwork-Id: 1069683 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101020-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="dawddqe/"; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nAdvOp8a"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44W2wN1z0vz9sN6 for ; Sat, 30 Mar 2019 00:42:12 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=P91RpdJ5vH8hDXHpueUxKCQZ7DpYrOs GLbaDt3DZZfjzKNn6Po/LgeOFIBQSdzYK1YJX2Fg/xjSg0LlNhfXEbU+dtFXfCva D69g6d7FwrN1NJ1XPIv8cXa8g4MAhNeArIG3165tu0Xm56ZB7pCdCoqxm0IoHNc7 0YkSAc7RQfqU= 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=dawdd qe/A9jLyQAkzqzrsdR/IZoz7R2rX1ogBrzSBK6eogXUUnN1CnazZ0kUVbdTN8ZO1 xSjBP5v4MM5BKG8EOkv2j1M0xA8wwj2E1rkE+OFagV1JMIDhsWvgf6Z8+W3WDx6t UoAKdPuW67Nv/l52BJXS8r5tXjVBTm8I5z3k4k= 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== 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. Reviewed-by: Gabriel F. T. Gomes --- 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 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