From patchwork Thu Oct 26 19:06:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 117257 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1124890qgn; Thu, 26 Oct 2017 12:08:34 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QlVXU9RWCB9/tGVfFNlUErA6z43ofjWl7azShTXvMUFH+00EC90X1sOxsNBa9Gi7LMpcp+ X-Received: by 10.84.168.129 with SMTP id f1mr5032981plb.71.1509044914247; Thu, 26 Oct 2017 12:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509044914; cv=none; d=google.com; s=arc-20160816; b=KWI2a5DPBVlGmzhXLQjkeNaqpNgF36x1m8yG6dQ/J0UVoSMVyH5V6iVulM01iZwS6H gwki8o0ZAH4PaYqcbW/vxq3EnuE20JDLDiypOv2m9JRDPlv0AG4Y+t8ezR4gr0gcqRND P17xRGlsKpkIV8tJBFpPNWQip7FJXNg0Urb3fUKcAZozwxwJqdzVkxRzkqLvJXtmovhI rNzJm/o47ezbBjxdV6gfJUSoMlCR32tljpmP/S8N7Rj3ltez2/H85IGTKPrBQMEyaGAa EyfUQL+VQgOrNfVkbhK3EXONLv3+rMw8WbZHeEkw5h+Q4OOCs1Gn5IUNkSuvNuqYltql NaTw== 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:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=xVTaNFY4L1DNomhFvAzmL44grshnaTe/12Eg1KYk8L4=; b=w0f0ugUxHVGD/SZJPwxXDI9q45ZdRNviHS1GtSVRc4OB9AI/y7zbOCgzgcvga7Uve7 gOL4b0VcOwUNns7HTyZJR6OfLxL+0HGzd5+lO9sOlFpUcMEX6vXnXP1lBUlCY9j6eu9Q hSSoe0lLsPh4vz5h7GKDtqg2qomvqRnV/oGfvFoIgnUVBvDzvac5xRCb6xnH79skeBoI PFM3hyXd5xifl8ynlotg++V+YnmFoPat1U+1IzlzFMsjJEdtrZIc03Q/rl9LwuQyxj6N C0xfUorcfISO5JmmomU0/mbx8Lpzet+amMK6TI6Zjdt21umVUp9nD8GXXmVS4ah9KEJO d4Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=yAqFShjp; spf=pass (google.com: domain of libc-alpha-return-86407-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86407-patch=linaro.org@sourceware.org; dmarc=fail (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 b1si3688841pgq.241.2017.10.26.12.08.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 12:08:34 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-86407-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=yAqFShjp; spf=pass (google.com: domain of libc-alpha-return-86407-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86407-patch=linaro.org@sourceware.org; dmarc=fail (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=Cbv70v7qh0RLt7pelB5IXiUEgqwRPPe tnfruIPMgrxPYogQ7MTgLWBc3K+CDEKhh4AkvqfJCI7uVz82HERRV7VkMtkcl9PW beZCEbyUrkNnBBR5z4B5yj0gr7k19HTADCVKLQoH/jPKM6gF3A7Nb1T609lu2jds DOpW4o0YUmlQ= 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=nxVYc90PYsJsURKzQc0Ve3/j4bA=; b=yAqFS hjpXDafUzLMXyzQ6d15T1CPQglZZmm239b0wgJ7ORFVICkDqDw6QpiGeuy9wwx3h BaCeJjJoQMtPZFiZ1LoXBRymPfCjCEgNe6ZJ7Owv/8D3T+LvVgN7m5xBshid7haE GdMz/fElpZQYHgtd6FuSDg09+WRDQWrSsdxQBs= Received: (qmail 97779 invoked by alias); 26 Oct 2017 19:07:14 -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 97735 invoked by uid 89); 26 Oct 2017 19:07:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk0-f196.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=xVTaNFY4L1DNomhFvAzmL44grshnaTe/12Eg1KYk8L4=; b=FaIKx2Q9x65Fe8WV+RtC9355VVs2qvl2eUtejAmN3jI4HwWvRqzWMz/ntOfjbhfB34 Glt20hKuTrUdM4B3rXuEhfbg8nJfq9ZTL9zU5aD8rpOqE1VEGWdUiwFk+AZGZZXGRjgK iiid+5Y2UAXRAbBhyBZ1P9cKntc6L2qkKBeHrNPX8Hos1zS0WfjZgliPblTj6ogy1qEi X+tqSPSKRMmsKFFqJSnC7YdCe80e6w2egWIAiDPuY9l1wit2XlFvZCqDpbIgxqy3R2jZ L8o/ZxApe1cMOkFF5fo2JVk+KqGy1BULLxw27jgEa0D+B5t2BjZlxS0YJqlLAalBihU6 RNxA== X-Gm-Message-State: AMCzsaWrQ0Anagnrbt1J1OiarRL+/O1WdGB/vi9bh/PJZYvRDcXPbNrI 6l9ocaoWRJsvopdNq9LLqRHvDcSRRPc= X-Received: by 10.55.119.70 with SMTP id s67mr9209734qkc.294.1509044829093; Thu, 26 Oct 2017 12:07:09 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 06/25] sparc: refactor sparc64 signbit{f} selector to C Date: Thu, 26 Oct 2017 17:06:34 -0200 Message-Id: <1509044813-9951-7-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1509044813-9951-1-git-send-email-adhemerval.zanella@linaro.org> References: <1509044813-9951-1-git-send-email-adhemerval.zanella@linaro.org> This patch refactors the sparc64 ifunc selector to a C implementation. Also, the generic symbol is moved to its own implementation file (s_signbit-generic.S). The patch simplifies the Makefile by moving the common objects from libm-sysdeps_routines and sysdeps_routines to sysdeps_call rule and including it where required with the correct prefix. Checked on sparc64-linux-gnu and sparcv9-linux-gnu. * sysdeps/sparc/sparc-ifunc.h (sparc_libm_ifunc_redirected): New macro. * sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdep_calls): New rule. (sysdep_routines): Use sysdep_calls as base. (libm-sysdep_routines): Add generic rule for symbols shared with libc. Add s_signbit-generic and s_signbitf-generic objects. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c: New file. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c: Likewise. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S: Likewise. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S: Likewise. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S: Remove file. * sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S: Likewise. Signed-off-by: Adhemerval Zanella --- ChangeLog | 14 ++++++++ sysdeps/sparc/sparc-ifunc.h | 3 ++ sysdeps/sparc/sparc64/fpu/multiarch/Makefile | 20 +++++++----- .../sparc64/fpu/multiarch/s_signbit-generic.S | 6 ++++ sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S | 20 ------------ sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c | 37 ++++++++++++++++++++++ .../sparc64/fpu/multiarch/s_signbitf-generic.S | 2 ++ sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S | 10 ------ sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c | 28 ++++++++++++++++ 9 files changed, 102 insertions(+), 38 deletions(-) create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S delete mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S delete mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S create mode 100644 sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c -- 2.7.4 diff --git a/sysdeps/sparc/sparc-ifunc.h b/sysdeps/sparc/sparc-ifunc.h index 54420d8..4a68cf1 100644 --- a/sysdeps/sparc/sparc-ifunc.h +++ b/sysdeps/sparc/sparc-ifunc.h @@ -158,6 +158,9 @@ END (__##name) # define sparc_libc_ifunc(name, expr) sparc_libm_ifunc (name, expr) +# define sparc_libm_ifunc_redirected(redirected_name, name, expr) \ + __ifunc (redirected_name, name, expr, int hwcap, libm_ifunc_init) + /* It essentially does libc_hidden_builtin_def (name) and redirect the internal redirected symbol to ifunc implementation. */ # if defined SHARED diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile index 2ac4496..702452c 100644 --- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile +++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile @@ -1,17 +1,21 @@ ifeq ($(subdir),math) -libm-sysdep_routines += m_signbitf-vis3 m_signbit-vis3 m_finitef-vis3 \ - m_finite-vis3 m_isinff-vis3 m_isinf-vis3 \ - m_isnanf-vis3 m_isnan-vis3 s_lrintf-vis3 \ - s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \ +# 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_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \ + s_signbit-generic s_finitef-vis3 \ + s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \ + s_isnanf-vis3 s_isnan-vis3 + +sysdep_routines += $(sysdep_calls) +libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \ s_fmaf-vis3 s_fma-vis3 s_fmaf-generic s_fma-generic \ s_nearbyint-vis3 s_nearbyintf-vis3 \ s_ceilf-vis3 s_ceil-vis3 s_ceilf-generic \ s_ceil-generic s_floorf-vis3 s_floor-vis3 \ s_floorf-generic s_floor-generic s_truncf-vis3 \ - s_trunc-vis3 s_truncf-generic s_trunc-generic -sysdep_routines += s_signbitf-vis3 s_signbit-vis3 s_finitef-vis3 \ - s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \ - s_isnanf-vis3 s_isnan-vis3 + s_trunc-vis3 s_truncf-generic s_trunc-generic \ + $(sysdep_calls:s_%=m_%) CFLAGS-s_ceilf-vis3.c += -Wa,-Av9d -mvis3 CFLAGS-s_ceil-vis3.c += -Wa,-Av9d -mvis3 diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S new file mode 100644 index 0000000..dfa40ac --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S @@ -0,0 +1,6 @@ +#define __signbit __signbit_generic +#undef strong_alias +#define strong_alias(a, b) +#undef hidden_def +#define hidden_def(a) +#include diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S deleted file mode 100644 index b8ff64a..0000000 --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S +++ /dev/null @@ -1,20 +0,0 @@ -#include - -SPARC_ASM_VIS3_IFUNC(signbit) - -/* On 64-bit the double version will also always work for - long-double-precision since in both cases the word with the - sign bit in it is passed always in register %f0. */ -strong_alias (__signbit, __signbitl) -hidden_def (__signbitl) - -# undef weak_alias -# define weak_alias(a, b) -# undef strong_alias -# define strong_alias(a, b) -# undef hidden_def -# define hidden_def(a) - -#define __signbit __signbit_generic - -#include "../s_signbit.S" diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c new file mode 100644 index 0000000..33e69f8 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c @@ -0,0 +1,37 @@ +/* signbit ifunc resolver, Linux/sparc64 version. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for 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 __signbit __redirect_signbit +#include +#undef __signbit + +#include + +extern __typeof (__redirect_signbit) __signbit_vis3 attribute_hidden; +extern __typeof (__redirect_signbit) __signbit_generic attribute_hidden; + +sparc_libm_ifunc_redirected (__redirect_signbit, __signbit, + hwcap & HWCAP_SPARC_VIS3 + ? __signbit_vis3 + : __signbit_generic); + +/* On 64-bit the double version will also always work for + long-double-precision since in both cases the word with the + sign bit in it is passed always in register %f0. */ +strong_alias (__signbit, __signbitl) +sparc_ifunc_redirected_hidden_def (__redirect_signbit, __signbitl) diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S new file mode 100644 index 0000000..851ff35 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S @@ -0,0 +1,2 @@ +#define __signbitf __signbitf_generic +#include diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S deleted file mode 100644 index d57e999..0000000 --- a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S +++ /dev/null @@ -1,10 +0,0 @@ -#include - -SPARC_ASM_VIS3_IFUNC(signbitf) - -# undef weak_alias -# define weak_alias(a, b) - -#define __signbitf __signbitf_generic - -#include "../s_signbitf.S" diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c new file mode 100644 index 0000000..7e817f0 --- /dev/null +++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c @@ -0,0 +1,28 @@ +/* signbit ifunc resolver, Linux/sparc64 version. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more 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 + +extern int __signbitf_vis3 (float) attribute_hidden; +extern int __signbitf_generic (float) attribute_hidden; + +sparc_libm_ifunc(__signbitf, + hwcap & HWCAP_SPARC_VIS3 + ? __signbitf_vis3 + : __signbitf_generic);