From patchwork Mon Mar 11 22:39:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 1054975 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=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-497724-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="IQ+SywG4"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=marvell.com header.i=@marvell.com header.b="kgJB5p6P"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="ANcI+Gqa"; 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 44JCj46Nwhz9sBp for ; Tue, 12 Mar 2019 09:39:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; q=dns; s=default; b=HFxNrVCODY2oIoBTfF6s+DH0m1Jxy8docQyyYn78VV1yAVAIh+ 3TpJknI765Bn0PA3CVbW+VQZTX9XJCBkYqp9wokGZbeXA4XD3PkwC+1K8JAqCO84 d8HFJ78Bp9islcTFrod7J6yh4yu34p/LkVFXzForE30nPEkW5+K7eNkso= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; s= default; bh=W4alMzN0l1p2pXQeokAVv7Y9jlw=; b=IQ+SywG4sGP3KscjmR4B 8/p9qnmjU9uCoJSr9LbIyCgX0VQrmoNSIgPPoL3KkLTvm6vWNd1YNCT9xjXdrLZ+ TBphY21N8xbS3QDWI9KQJv2bM2H/ZGmo/urkDHZ+HJCi00Dm1DXbTUBu+3Stqyp8 zlnkSlQupztY1EZrVUYKQpw= Received: (qmail 30421 invoked by alias); 11 Mar 2019 22:39:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30411 invoked by uid 89); 11 Mar 2019 22:39:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=tot, defaults, responses X-HELO: mx0b-0016f401.pphosted.com Received: from mx0a-0016f401.pphosted.com (HELO mx0b-0016f401.pphosted.com) (67.231.148.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Mar 2019 22:39:42 +0000 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2BMTxS6009677; Mon, 11 Mar 2019 15:39:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : content-type : mime-version; s=pfpt0818; bh=awgl2LKvhJfcmCaEvD5anfzgSn9B+amPxvC/W1GIeL0=; b=kgJB5p6Pva8GK2ofdKQxWxh+P3adi6H7bPGvoNIL4CRVUMMjkkCAhSA5NRx7ZECT3fxJ yTDLnffv/k4eTF5S+u6BRsgnyF9LcdWqz6mmks8QYT7UyMIJYE9iyGGU2Ya3abKJtBES ga2I8ugvtSLRuH5jN5oeV2GERHKVJzKyFGrr79lKZNZV6eo3E9UA0MxMjlBbVio9lNCh We9DHdnsOnmqh91D6Y+3xUR9ziA2slx9fKrd46Fvjb7LjlmkfMCuokGlphOxk+ylJZ7G c19SFgUhQ2QMCXyLdfr+XZggGhMMEx5PoThH9M8bXeDI0RuIIXo52xriL6ogNUL5Xjv5 rg== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2r5pvdj5m6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2019 15:39:37 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 11 Mar 2019 15:39:36 -0700 Received: from NAM05-CO1-obe.outbound.protection.outlook.com (104.47.48.50) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 11 Mar 2019 15:39:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=awgl2LKvhJfcmCaEvD5anfzgSn9B+amPxvC/W1GIeL0=; b=ANcI+GqathKqxYwrgVPhjwJ1GCYgmeIEAarWLe3Hp3LaWBIXezg6+wnRS9doENsJa7n39NEP2BWWcmeI+8e/Wb8yfAS9cPpPrF/Z7xLcmk53Xa54xbboylWBaPBVEiolmryW71XhdukIr0X3HfRCoxbLd1fEgqeMYk7gtZvmzJ8= Received: from BN6PR1801MB2033.namprd18.prod.outlook.com (10.161.154.24) by BN6PR1801MB1889.namprd18.prod.outlook.com (10.161.156.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Mon, 11 Mar 2019 22:39:35 +0000 Received: from BN6PR1801MB2033.namprd18.prod.outlook.com ([fe80::1587:d3e2:9bbf:1674]) by BN6PR1801MB2033.namprd18.prod.outlook.com ([fe80::1587:d3e2:9bbf:1674%6]) with mapi id 15.20.1665.022; Mon, 11 Mar 2019 22:39:35 +0000 From: Steve Ellcey To: "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "joseph@codesourcery.com" Subject: RFC: Patch to allow use of DECL_NAME in libmvec calls instead of DECL_ASSEMBER_NAME Date: Mon, 11 Mar 2019 22:39:34 +0000 Message-ID: <41abe64e531d6d590fd85d9917b62bf2f169d1d1.camel@marvell.com> x-ms-exchange-purlcount: 3 received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED This is a proposed GCC patch that allows targets to modify the names of the libmvec routines that get called. Currently, if you build ToT GCC on Aarch64 and include this glibc patch: https://sourceware.org/ml/libc-alpha/2019-03/msg00106.html And then compile a call to expf which gets vectorized, GCC will generate a libmvec call to '_ZGVnN4v___expf_finite' instead of _ZGVnN4v_expf because the limvec name is based on the assembly name of the scalar function (__expf_finite) and not the 'real' name (expf). This means that libmvec needs to provide both names, even though the routines don't differ. Rather than create both names I would like to make it possible for GCC to generate calls to libmvec based on the real name by having a target specific function that allows GCC to use the DECL_NAME instead of DECL_ASSEMBLER_NAME to create the libmvec name. The responses to my glibc patch (referenced above) has a pointer to where this was discussed in the GCC mailing list a couple of years ago: https://gcc.gnu.org/ml/gcc/2015-06/msg00173.html and which has a pointer back to an older glibc string as well: https://sourceware.org/ml/libc-alpha/2015-06/msg00213.html Any thoughts on this patch as a way of 'fixing' GCC to not use the finite alias names? Steve Ellcey sellcey@marvell.com 2018-03-11 Steve Ellcey * config/aarch64/aarch64.c (aarch64_simd_clone_vec_base_name): New function. (TARGET_SIMD_CLONE_VEC_BASE_NAME): New macro. * doc/tm.texi.in (TARGET_SIMD_CLONE_VEC_BASE_NAME): New hook. * doc/tm.texi: Regenerate. * omp-simd-clone.c (simd_clone_mangle): Call vec_base_name hook. * target.def (vec_base_name): New hook. * targhooks.c (cgraph.h): New include. (default_vec_base_name): New function. * targhooks.h (default_vec_base_name): New function declaration. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 252bed7..cddab80 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -18711,6 +18711,14 @@ aarch64_simd_clone_usable (struct cgraph_node *node) } } +/* Implement TARGET_SIMD_CLONE_VEC_BASE_NAME */ + +static const char * +aarch64_simd_clone_vec_base_name (struct cgraph_node *node) +{ + return IDENTIFIER_POINTER (DECL_NAME (node->decl)); +} + /* Implement TARGET_COMP_TYPE_ATTRIBUTES */ static int @@ -19251,6 +19259,9 @@ aarch64_libgcc_floating_mode_supported_p #undef TARGET_SIMD_CLONE_USABLE #define TARGET_SIMD_CLONE_USABLE aarch64_simd_clone_usable +#undef TARGET_SIMD_CLONE_VEC_BASE_NAME +#define TARGET_SIMD_CLONE_VEC_BASE_NAME aarch64_simd_clone_vec_base_name + #undef TARGET_COMP_TYPE_ATTRIBUTES #define TARGET_COMP_TYPE_ATTRIBUTES aarch64_comp_type_attributes diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index fe1194e..de4bdb42 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4196,6 +4196,8 @@ address; but often a machine-dependent strategy can generate better code. @hook TARGET_SIMD_CLONE_USABLE +@hook TARGET_SIMD_CLONE_VEC_BASE_NAME + @hook TARGET_SIMT_VF @hook TARGET_GOACC_VALIDATE_DIMS diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c index 388198b..b3a57aa 100644 --- a/gcc/omp-simd-clone.c +++ b/gcc/omp-simd-clone.c @@ -409,7 +409,7 @@ simd_clone_mangle (struct cgraph_node *node, } pp_underscore (&pp); - const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)); + const char *str = targetm.simd_clone.vec_base_name (node); if (*str == '*') ++str; pp_string (&pp, str); diff --git a/gcc/target.def b/gcc/target.def index 66cee07..da60249 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1655,6 +1655,13 @@ usable. In that case, the smaller the number is, the more desirable it is\n\ to use it.", int, (struct cgraph_node *), NULL) +DEFHOOK +(vec_base_name, +"This hook should return the name of the scalar function being cloned.\n\ +This defaults to DECL_ASSEMBLER_NAME, but targets could use DECL_NAME\n\ +instead or some other variation of the function name.", +const char *, (struct cgraph_node *), default_vec_base_name) + HOOK_VECTOR_END (simd_clone) /* Functions relating to OpenMP SIMT vectorization transform. */ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 318f7e9..6792ee5 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see #include "real.h" #include "langhooks.h" #include "sbitmap.h" +#include "cgraph.h" bool default_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, @@ -2379,4 +2380,10 @@ default_remove_extra_call_preserved_regs (rtx_insn *, HARD_REG_SET *) { } +const char * +default_vec_base_name (struct cgraph_node * node) +{ + return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)); +} + #include "gt-targhooks.h" diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 5943627..85dce1a 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -286,5 +286,6 @@ extern bool speculation_safe_value_not_needed (bool); extern rtx default_speculation_safe_value (machine_mode, rtx, rtx, rtx); extern void default_remove_extra_call_preserved_regs (rtx_insn *, HARD_REG_SET *); +extern const char * default_vec_base_name (struct cgraph_node *); #endif /* GCC_TARGHOOKS_H */