From patchwork Wed Jul 17 21:24:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 1133443 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-505233-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="IV+qZViS"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=marvell.com header.i=@marvell.com header.b="JkCb5egA"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="h2Tclj6N"; 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 45pqzR5pCFz9sBF for ; Thu, 18 Jul 2019 07:24:45 +1000 (AEST) 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:content-id :content-transfer-encoding:mime-version; q=dns; s=default; b=xaK 8k8QnPKB97Jq+I2zu5VcCZhMUi0oIZtW9S7gB7JKnGoH61eMaDqVoFCi0UZ0Ylsq Ju5aGIV6TRIuHqyGfdV88Q7xNsLL5WOgdrjamXeeP6mgvvtfGb/NE5no+u/7F+Eb vLgizhbughyyzqKs3BKLxefWH3rk5GO2c4FGWg3I= 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:content-id :content-transfer-encoding:mime-version; s=default; bh=NfoErRM8k iDEy41egPMJrtm5wAk=; b=IV+qZViSOR2FRJVhWDLjxCcp9bFdYhjBqF7rwOy8B 2jW2zydz9WxkM9xxJ97ldJ0h5LgvxFt/1iv8kubkSQzqYSRmJE4DYjcLIkt7reg3 SX50vXefNSKUSoSllhFxDHD7FU/pmBSEAIn/BRcxyqFj+ogBjE7IOB2jyHvYBIbW fU= Received: (qmail 13144 invoked by alias); 17 Jul 2019 21:24:36 -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 13118 invoked by uid 89); 17 Jul 2019 21:24:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SEM_URI, SEM_URIRED, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0b-0016f401.pphosted.com Received: from mx0b-0016f401.pphosted.com (HELO mx0b-0016f401.pphosted.com) (67.231.156.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Jul 2019 21:24:34 +0000 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6HLAU4B018250; Wed, 17 Jul 2019 14:24:28 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : content-type : content-id : content-transfer-encoding : mime-version; s=pfpt0818; bh=YE/l96Pe8kigPgjXhq5d09nerxcvp3AhqP2SBHc/awk=; b=JkCb5egAgQvuiBtizuE2mkg9O+gVVd1TQs4FwNzFUKWFG1gY4yOXWSADOhWmvbZDyqx7 Aw0LPKl4QIKiwNgBsZVbWtIrmIm6iH9oUZmIQjhbRqV9kKJ+hp186/IYINqbsqnelqjR 6Zf1vHOnaR6Mq4MfrIgpaCPhmml6lxBxhHwnhlwSUrRqDQBfc7+D+zNC5Z+54aGq5LIi Xxyy240a5lR+K2o9TiJsxgHNwAjpq4hpRvpNa0ss71fksaBOLdgJwsOx0NHoOuergT1t cY6VETQLz2Ir6Nfe6b8GEPqfeMXW/3+qA6pauxajhZwJZjm+QztvnifbxBYDsHpmpOWo Lw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2ts0a29b45-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2019 14:24:28 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 17 Jul 2019 14:24:26 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.56) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Wed, 17 Jul 2019 14:24:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=myaYlhuaq4k63nxZbloaam8mDm0VQ3lChwu2RX13ThoGB5sPZYRZda69J5Fb6SEs/dAnfl1VB41fgIFOQjM480rkwwFay4kGjZb3Afg1inmpcSjm7Q+0r+JiAxgzF79hXco2DJ28bvO6b07H6gDsnKU7DP02yXWYdhfykZmyZD0dqiy+RdUgjIj15bd95otjL2I76uqekiNHOeP2DAtTNdwiPOq5Yq+MtXrC1hTr7vQmd2cJ1S+o7dZsCInWI6lJXTdSIH5iPlCNIITZ42KLK4N/+S5fQNJPtJEe7bPmDBo2LnKG84VVAAPiPvDmDLcrnk4Cu+iSIS7BP9hmBaV/jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YE/l96Pe8kigPgjXhq5d09nerxcvp3AhqP2SBHc/awk=; b=SH3SV9y7tqoBRXpq71pAyCI7eoINvKHPcTtN+GTv+IOtCls1ongydnKZ/2RCQemfubZUmQBiJdbQnK0cfTD0YsoGwluFdkod3j5ra2HmOoeSBGfF0sB2m/Bq3FAiQNgBPzBOSZbcvlPtn6VOZEvGW906xpa41VIMltwK1mUvqYIGue35lBX6e4Ri8xwrURuylZgnAST5R2yG2wN8JyWgTD4aqokrQxxa1MuFF39pnjmVsjuiT1xPEoHQQAC8GDAhgwzqielr6suLwNZdghUFIHTRVgzi5bAf42Iv1BkgTIY/+VRXJZCeV2lJwt/bb/39Ak7c4KTb5zE1a9vZE3ZBNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YE/l96Pe8kigPgjXhq5d09nerxcvp3AhqP2SBHc/awk=; b=h2Tclj6NqWUZQ1oDa8uLNgpAOYzvPmjYpWUcdCFDuobF7JRSoSGm9kvdnOc1jtmgEiE1vKTzwMxjwekmKYzTRGGo1XL73MXCpsho+LL8vIsz/T3YdqHhKQN5U/tMHc8HQj9w4FzNmjaM4VWr6B5FNgtRL7Ql86oUDxAkgbZ58Ug= Received: from MN2PR18MB3263.namprd18.prod.outlook.com (10.255.237.88) by MN2PR18MB2558.namprd18.prod.outlook.com (20.179.83.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.10; Wed, 17 Jul 2019 21:24:24 +0000 Received: from MN2PR18MB3263.namprd18.prod.outlook.com ([fe80::ccb:a3e1:97dc:43bf]) by MN2PR18MB3263.namprd18.prod.outlook.com ([fe80::ccb:a3e1:97dc:43bf%7]) with mapi id 15.20.2073.012; Wed, 17 Jul 2019 21:24:24 +0000 From: Steve Ellcey To: "gcc-patches@gcc.gnu.org" CC: "Richard.Earnshaw@arm.com" , "richard.sandiford@arm.com" , "Szabolcs.Nagy@arm.com" Subject: [PATCH] Fix simd attribute handling on aarch64 Date: Wed, 17 Jul 2019 21:24:24 +0000 Message-ID: <97b75bf8798a32e72827a3d021c11fb42d984c8e.camel@marvell.com> x-ms-oob-tlc-oobclassifiers: OLM:8273; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 Content-ID: <52DF113BA7925344B7BDE0824E4217ED@namprd18.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sellcey@marvell.com This patch fixes a bug with SIMD functions on Aarch64. I found it while trying to run SPEC with ToT GCC and a glibc that defines vector math functions for aarch64. When a function is declared with the simd attribute GCC creates vector clones of that function with the return and argument types changed to vector types. On Aarch64 the vector clones are also marked with the aarch64_vector_pcs attribute to signify that they use an alternate calling convention. Due to a bug in GCC the non-vector version of the function being cloned was also being marked with this attribute. Because simd_clone_adjust and expand_simd_clones are calling targetm.simd_clone.adjust (which attached the aarch64_vector_pcs attribute to the function type) before calling simd_clone_adjust_return_type (which created a new distinct type tree for the cloned function) the attribute got attached to both the 'normal' scalar version of the SIMD function and any vector versions of the function. The attribute should only be on the vector versions. My fix is to call simd_clone_adjust_return_type and create the new type before calling targetm.simd_clone.adjust which adds the attribute. The only other platform that this patch could affect is x86 because that is the only other platform to use targetm.simd_clone.adjust. I did a bootstrap and gcc test run on x86 (as well as Aarch64) and got no regressions. OK to checkin? Steve Ellcey sellcey@marvell.com 2019-07-17 Steve Ellcey * omp-simd-clone.c (simd_clone_adjust): Call targetm.simd_clone.adjust after calling simd_clone_adjust_return_type. (expand_simd_clones): Ditto. diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c index caa8da3cba5..6a6b439d146 100644 --- a/gcc/omp-simd-clone.c +++ b/gcc/omp-simd-clone.c @@ -1164,9 +1164,8 @@ simd_clone_adjust (struct cgraph_node *node) { push_cfun (DECL_STRUCT_FUNCTION (node->decl)); - targetm.simd_clone.adjust (node); - tree retval = simd_clone_adjust_return_type (node); + targetm.simd_clone.adjust (node); ipa_parm_adjustment_vec adjustments = simd_clone_adjust_argument_types (node); @@ -1737,8 +1736,8 @@ expand_simd_clones (struct cgraph_node *node) simd_clone_adjust (n); else { - targetm.simd_clone.adjust (n); simd_clone_adjust_return_type (n); + targetm.simd_clone.adjust (n); simd_clone_adjust_argument_types (n); } }