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: 161439 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2052697jan; Fri, 29 Mar 2019 06:39:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPa4SOGt8XqAzbpz7//Fa3m3zJZ7lK15I+/rRc4m6d3wU1WG4eoV0IlxWJdDnoQpHnr3V2 X-Received: by 2002:aa7:885a:: with SMTP id k26mr46749261pfo.70.1553866769031; Fri, 29 Mar 2019 06:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553866769; cv=none; d=google.com; s=arc-20160816; b=IB9ES7LiRnXpRCpFJcOk+TtMKdNQGIQNDrE0yYOV93ArHIWJuVo6CkkoZwtmKWJzwF nS4B9FUpd2V2Pi6J4cpZQ/w/JQ4SAajA7XihXAmQWbtg0GSt0zX5+J5LSdCaE8nRejYo 2V3UmlhuBPXURhtVmUR44Ae65UZyqz1Nkd13SxwGv/Ntjjdm4/H0PRMxMr7HwkWx/LHW O/ttnR7Iswla3mxph4GgsISHoZ7wqvkyeh2raAUvIpHkMZR/dobG1R1bfAAb5WlRp9tf pONYN8kRWB9rXHzmDXB/9wi+gBAZ4kUUElfVLhaaUfgKNVYMIF776h8fvfbf0FXtBHxB ppZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=m1+p1IiaJ584VJs5eKxAx+lkh3AWKI0H5I+g7UXcb1U=; b=mp7XKF1wKUvOkN0F2qJgy4LApGAUMJeBejEgq9CzPEoY7ie9TpB4lSJFdF/dSq4Mgj NBSqyW2D0gC486XGNYfxoRUltN/pZHjcXJGgT/ruV5vEgE0t+YxAGXwZ661ObtA4pAhy YWO6CqJmAMf8uBTFfygrXB8VE4SVO3yD0AjTJDCEn9Hzp1b32xjzNx/tCXfWCP+a23CB a/4+68OyuWkG4x8hV3C56Z8hvXG46CLpIMbjDjdptrsLvgovXr837lJ5xygq8M5LrWdh MY9VVgjx451VE4rd9akUoalULCBUW+3mz/GAusOwNeqtnA1o5kzmcoYM6CGfKlHKtjPU 2cDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=VC8cXUGm; dkim=pass header.i=@linaro.org header.s=google header.b=aYoxac61; spf=pass (google.com: domain of libc-alpha-return-101008-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101008-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id b4si1875275pgq.50.2019.03.29.06.39.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 06:39:29 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101008-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=VC8cXUGm; dkim=pass header.i=@linaro.org header.s=google header.b=aYoxac61; spf=pass (google.com: domain of libc-alpha-return-101008-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101008-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Ushad2j5EX9UrbZGXOMegsUSHVla04Q S4tonEwXz4iTpshn6YVg6pl6vlfYZC1tHCa4iZ0Z4CJ30ix39AI/2OILJpbaPzVC osx8VCyeV6kuYhpbss5Drpm4OqruygqGw02WsEBmObYsgJ4lEpACXpvbQdqP/nhL cQrd4ePK0XTo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Yp9jRKBN4KkaSDCXZCQ9O4G0rP0=; b=VC8cX UGmIMAWMBIuWGJDFrv0OkX+i9NKnpbDWmMfw/QKylDm8A3kB9DL7U49yjrThETmj CVCTZiBslCD2FxDo1O7Bnr+QwE7XX0reTiJR5ZbWcWZ8Uk/1zd8uWZB1+njfPVPa Xhcq7+fZqvuNPzh4sc883j0Wvyyrb8kEUxVvk8= Received: (qmail 121907 invoked by alias); 29 Mar 2019 13:36:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 120541 invoked by uid 89); 29 Mar 2019 13:36:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=m1+p1IiaJ584VJs5eKxAx+lkh3AWKI0H5I+g7UXcb1U=; b=aYoxac61PTCkgdxvBoHo3DiGMk1p16tx1R8eZgFUvoAQbFqBSgO+EyymB2JIjK1dcM 2IDAuCJtXi0N0DlxDhMurmpn8j5ex2PoaNxOU53LHv0h6pv6VGc8E75aYBYuhZsPF0/u plhHQVuE2S89uHUBtIEWHEQVPffDUQdgO7wBcpQUyKd7LBOm1ZjIBzsQ2pKP4OlmLncH FxjNzMSq+YJLxqYiaNMIKaC48MbM4dc3cZMiP8k/5XZk/sh3n9zG7KxPcKSnvpNmqRMd ve3piyh4+3l6izJWtM61n6AibRRZoE+URFVdsLawVBmX+IMs47y1+NFq5PYQKH8H0y5K 8D7w== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 18/28] powerpc: refactor powerpc64 lrint/lrintf/llrint/llrintf Date: Fri, 29 Mar 2019 10:35:19 -0300 Message-Id: <20190329133529.22523-19-adhemerval.zanella@linaro.org> In-Reply-To: <20190329133529.22523-1-adhemerval.zanella@linaro.org> References: <20190329133529.22523-1-adhemerval.zanella@linaro.org> This patches consolidates all the powerpc llrint{f} implementations on the generic sysdeps/powerpc/fpu/s_llrint{f}. The IFUNC support is also moved only to powerpc64 only, since for powerpc64le generic implementation resulting in optimized code. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (libm-sysdep_routines): Add s_llrint-power8, s_llrint-power6x, and s_llrint-ppc64. (CFLAGS-s_llrint-power8.c, CFLAGS-s_llrint-power6x.c): New rule. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c: New file. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c: Likewise. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c: ... here. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c: Move to ... * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c: ... here. * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c: New file. * sysdeps/powerpc/powerpc64/fpu/Makefile: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (libm-sysdep_routines): Remove s_llrint-* objects. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llrint.c: New file. * sysdeps/powerpc/powerpc64/fpu/s_llrintf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lrint.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lrintf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Remove file. * sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_lrint.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise. --- .../powerpc64/be/fpu/multiarch/Makefile | 7 ++- .../be/fpu/multiarch/s_llrint-power6x.c | 2 + .../be/fpu/multiarch/s_llrint-power8.c | 2 + .../be/fpu/multiarch/s_llrint-ppc64.c | 2 + .../{ => be}/fpu/multiarch/s_llrint.c | 0 .../{ => be}/fpu/multiarch/s_llrintf.c | 0 .../{ => be}/fpu/multiarch/s_lrint.c | 0 sysdeps/powerpc/powerpc64/fpu/Makefile | 5 ++ .../powerpc/powerpc64/fpu/multiarch/Makefile | 3 +- .../fpu/multiarch/s_llrint-power6x.S | 30 ---------- .../powerpc64/fpu/multiarch/s_llrint-power8.S | 30 ---------- .../powerpc64/fpu/multiarch/s_llrint-ppc64.S | 30 ---------- sysdeps/powerpc/powerpc64/fpu/s_llrint.S | 45 --------------- sysdeps/powerpc/powerpc64/fpu/s_llrint.c | 55 +++++++++++++++++++ sysdeps/powerpc/powerpc64/fpu/s_llrintf.S | 1 - sysdeps/powerpc/powerpc64/fpu/s_llrintf.c | 1 + sysdeps/powerpc/powerpc64/fpu/s_lrint.S | 1 - sysdeps/powerpc/powerpc64/fpu/s_lrint.c | 1 + sysdeps/powerpc/powerpc64/fpu/s_lrintf.c | 1 + .../powerpc/powerpc64/power6x/fpu/s_llrint.S | 42 -------------- .../powerpc/powerpc64/power8/fpu/s_llrint.S | 43 --------------- 21 files changed, 76 insertions(+), 225 deletions(-) create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llrint.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llrintf.c (100%) rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_lrint.c (100%) create mode 100644 sysdeps/powerpc/powerpc64/fpu/Makefile delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrint.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrint.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrintf.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrintf.c delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrint.S create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrint.c create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrintf.c delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S -- 2.17.1 Reviewed-by: Gabriel F. T. Gomes diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile index 53e600f5f6..febda6dbb3 100644 --- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile @@ -14,7 +14,10 @@ libm-sysdep_routines += s_ceil-power5+ \ s_trunc-power5+ \ s_trunc-ppc64 \ s_truncf-power5+ \ - s_truncf-ppc64 + s_truncf-ppc64 \ + s_llrint-power8 \ + s_llrint-power6x \ + s_llrint-ppc64 CFLAGS-s_ceil-power5+.c = -mcpu=power5+ CFLAGS-s_ceilf-power5+.c = -mcpu=power5+ @@ -24,4 +27,6 @@ CFLAGS-s_round-power5+.c = -mcpu=power5+ CFLAGS-s_roundf-power5+.c = -mcpu=power5+ CFLAGS-s_trunc-power5+.c = -mcpu=power5+ CFLAGS-s_truncf-power5+.c = -mcpu=power5+ +CFLAGS-s_llrint-power8.c += -mcpu=power8 +CFLAGS-s_llrint-power6x.c += -mcpu=power6x endif diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c new file mode 100644 index 0000000000..ee139b4045 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c @@ -0,0 +1,2 @@ +#define __llrint __llrint_power6x +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c new file mode 100644 index 0000000000..0f5cbff69a --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c @@ -0,0 +1,2 @@ +#define __llrint __llrint_power8 +#include diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c new file mode 100644 index 0000000000..40f212716b --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c @@ -0,0 +1,2 @@ +#define __llrint __llrint_ppc64 +#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c similarity index 100% rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c diff --git a/sysdeps/powerpc/powerpc64/fpu/Makefile b/sysdeps/powerpc/powerpc64/fpu/Makefile new file mode 100644 index 0000000000..6988a1d396 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/Makefile @@ -0,0 +1,5 @@ +ifeq ($(subdir),math) +# lrintf and llrintf are aliased to llrint, so suppress compiler builtins to +# avoid mismatched signatures. +CFLAGS-s_llrint.c += -fno-builtin-lrintf -fno-builtin-llrintf +endif diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile index 4aa7fd6295..fec878bb9d 100644 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile @@ -8,12 +8,11 @@ sysdep_calls := s_modf-power5+ s_modf-ppc64 \ sysdep_routines += $(sysdep_calls) libm-sysdep_routines += s_llround-power6x \ s_llround-power5+ s_llround-ppc64 \ - s_llrint-power6x s_llrint-ppc64 \ s_logb-power7 s_logbf-power7 \ s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \ s_logbl-ppc64 e_hypot-ppc64 \ e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \ - s_llrint-power8 s_llround-power8 s_llroundf-ppc64 \ + s_llround-power8 s_llroundf-ppc64 \ e_expf-power8 e_expf-ppc64 \ $(sysdep_calls:s_%=m_%) diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S deleted file mode 100644 index 19f9dd2d80..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Round double to long int. PowerPC64/POWER6X default version. - Copyright (C) 2013-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llrint __llrint_power6x - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S deleted file mode 100644 index 93310e8662..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Round double to long int. PowerPC64/POWER6X default version. - Copyright (C) 2014-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llrint __llrint_power8 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S deleted file mode 100644 index 2811def336..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Round double to long int. PowerPC32 default version. - Copyright (C) 2013-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#undef weak_alias -#define weak_alias(a,b) -#undef strong_alias -#define strong_alias(a,b) -#undef compat_symbol -#define compat_symbol(a,b,c,d) - -#define __llrint __llrint_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S deleted file mode 100644 index 2e0d4dfdd0..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S +++ /dev/null @@ -1,45 +0,0 @@ -/* Round double to long int. PowerPC64 version. - Copyright (C) 2004-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - -/* long long int[r3] __llrint (double x[fp1]) */ -ENTRY_TOCLESS (__llrint) - CALL_MCOUNT 0 - fctid fp13,fp1 - stfd fp13,-16(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - ld r3,-16(r1) - blr - END (__llrint) - -strong_alias (__llrint, __lrint) -libm_alias_double (__llrint, llrint) -libm_alias_double (__lrint, lrint) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llrint, __llrintf) -libm_alias_float (__llrint, llrint) -strong_alias (__lrint, __lrintf) -libm_alias_float (__lrint, lrint) diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.c b/sysdeps/powerpc/powerpc64/fpu/s_llrint.c new file mode 100644 index 0000000000..968b70b79d --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_llrint.c @@ -0,0 +1,55 @@ +/* Round to nearest integer. PowerPC64 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#define NO_MATH_REDIRECT +#define lrint __redirect_lrint +#define lrintf __redirect_lrintf +#define llrintf __redirect_llrintf +#define __lrint __redirect___lrint +#define __lrintf __redirect___lrintf +#define __llrintf __redirect___llrintf +#include +#undef lrint +#undef lrintf +#undef llrintf +#undef __lrint +#undef __lrintf +#undef __llrintf +#include +#include + +long long int +__llrint (double x) +{ + long int ret; + __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x)); + return ret; +} +#ifndef __llrint +strong_alias (__llrint, __lrint) +libm_alias_double (__llrint, llrint) +libm_alias_double (__lrint, lrint) + +/* The double version also works for single-precision as both float and + double parameters are passed in 64bit FPRs and both versions are expected + to return [long] long type. */ +strong_alias (__llrint, __llrintf) +libm_alias_float (__llrint, llrint) +strong_alias (__lrint, __lrintf) +libm_alias_float (__lrint, lrint) +#endif diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S deleted file mode 100644 index ba7752311d..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S +++ /dev/null @@ -1 +0,0 @@ -/* __llrintf is in s_llrint.S. */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c new file mode 100644 index 0000000000..fd8ce33620 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c @@ -0,0 +1 @@ +/* llrintf is implemented at s_llrint.c */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrint.S b/sysdeps/powerpc/powerpc64/fpu/s_lrint.S deleted file mode 100644 index d3c2fff581..0000000000 --- a/sysdeps/powerpc/powerpc64/fpu/s_lrint.S +++ /dev/null @@ -1 +0,0 @@ -/* __lrint is in s_llrint.c */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrint.c b/sysdeps/powerpc/powerpc64/fpu/s_lrint.c new file mode 100644 index 0000000000..4e48d8ca00 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_lrint.c @@ -0,0 +1 @@ +/* lrint is implemented at s_llrint.c */ diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c b/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c new file mode 100644 index 0000000000..3f0c570a91 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c @@ -0,0 +1 @@ +/* lrintf is implemented at s_llrint.c */ diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S deleted file mode 100644 index edf3974c77..0000000000 --- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S +++ /dev/null @@ -1,42 +0,0 @@ -/* Round double to long int. POWER6x PowerPC64 version. - Copyright (C) 2006-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - - .machine "power6" -/* long long int[r3] __llrint (double x[fp1]) */ -ENTRY_TOCLESS (__llrint) - CALL_MCOUNT 0 - fctid fp13,fp1 - mftgpr r3,fp13 - blr - END (__llrint) - -strong_alias (__llrint, __lrint) -libm_alias_double (__llrint, llrint) -libm_alias_double (__lrint, lrint) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llrint, __llrintf) -libm_alias_float (__llrint, llrint) -strong_alias (__lrint, __lrintf) -libm_alias_float (__lrint, lrint) diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S deleted file mode 100644 index dbd3ab89d6..0000000000 --- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S +++ /dev/null @@ -1,43 +0,0 @@ -/* Round double to long int. POWER8 PowerPC64 version. - Copyright (C) 2014-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - -#define MFVSRD_R3_V1 .long 0x7c230066 /* mfvsrd r3,vs1 */ - -/* long long int[r3] __llrint (double x[fp1]) */ -ENTRY_TOCLESS (__llrint) - CALL_MCOUNT 0 - fctid fp1,fp1 - MFVSRD_R3_V1 - blr -END (__llrint) - -strong_alias (__llrint, __lrint) -libm_alias_double (__llrint, llrint) -libm_alias_double (__lrint, lrint) -/* The double version also works for single-precision as both float and - double parameters are passed in 64bit FPRs and both versions are expected - to return [long] long type. */ -strong_alias (__llrint, __llrintf) -libm_alias_float (__llrint, llrint) -strong_alias (__lrint, __lrintf) -libm_alias_float (__lrint, lrint)