From patchwork Thu Apr 7 15:04:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 52705 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E1DA3857809 for ; Thu, 7 Apr 2022 15:05:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E1DA3857809 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1649343903; bh=azVJJloK/trDR42rH4AjLAXj1kDMK/4ZIgGLoPqAbQY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=TYQMlH8uZX87kvwQA9LcabRHtF+4uhG3Aqy6NAGtRB5TuwNyg46P3Mpra010Ojj+3 yPn9NQ9yIAPeNOuTbzpzTNLc4aGcP1rr0ljNUf4kuOJyCcWG+MYeEs/RkQPfcnmNHF a16jv4U65wnFTYpNM0aRw7z09SMSFKx3T6i2Yxsw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70043.outbound.protection.outlook.com [40.107.7.43]) by sourceware.org (Postfix) with ESMTPS id 87BA13857809 for ; Thu, 7 Apr 2022 15:04:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 87BA13857809 Received: from AS9PR0301CA0056.eurprd03.prod.outlook.com (2603:10a6:20b:469::34) by AM9PR08MB7183.eurprd08.prod.outlook.com (2603:10a6:20b:3de::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22; Thu, 7 Apr 2022 15:04:26 +0000 Received: from AM5EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:469:cafe::e) by AS9PR0301CA0056.outlook.office365.com (2603:10a6:20b:469::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22 via Frontend Transport; Thu, 7 Apr 2022 15:04:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT010.mail.protection.outlook.com (10.152.16.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.21 via Frontend Transport; Thu, 7 Apr 2022 15:04:26 +0000 Received: ("Tessian outbound facaf1373bbd:v118"); Thu, 07 Apr 2022 15:04:26 +0000 X-CR-MTA-TID: 64aa7808 Received: from e3419e17039f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0DEBB727-AA50-4A70-B50B-1ED8BFC5373E.1; Thu, 07 Apr 2022 15:04:16 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e3419e17039f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Apr 2022 15:04:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DGe6u5Jw6shSwejYTjQDmHpE3KloqRVF2xZsnb+/vve5D7vdtGM34dDfY5RwCvNu98I0qW3uq6aQooJ1JEdLD9AjO4GgB8dJjpN5/lX+Mxon5pMGnaPKrK8tEesP17khVHTcoWetDHjIU1HQvh1P4puJcmZhY+fSkdOBs+iVdfSx9qq9Rb3QfBaO4f3qcmRGJlJpfs0Yp07Nequjofgf8jDUTHUKd82XzaiyW0Svq8VZruu5s5wsBGRInh1MGZokU5IFe+eCaf/8QhZj7f/OsIzUU5GBYkxvjKlB92GldRlPxUWlmWzcqlTc/Lzkxc3jDSXUYeIAJVXHcpEkpY4aAg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=azVJJloK/trDR42rH4AjLAXj1kDMK/4ZIgGLoPqAbQY=; b=EhUEMcwJMA1smfy4f6GzjiZ+S37C4WUcTmjfR648FFtrS2D6e7sDdgkl20W2Pde/O7vEAcKR7ohPsaCbd0CZoP4+BPyIehliR1w2597xfMjlU6okPMdPQoeIQEbr9SXkVyS3/T2LW4Lk8REQVk69Y0Ul8d22JQHKgdnq/jO1weuRDVjtXGAd31d3BJeneUs8FtrXGs+GcPa3T9zg8j8ekOzvexUI+IZldaxq2kAx4+eWxEUcKBW/cZ2GIB6GbBhSAiDyH1Nj/pih8onejupbxEo/ki9n5Gvq/xCN39VJEWhuhZy1t098oAMaCxV1jq2axLeda/ha2pXrcSZWOHTYEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by AM6PR08MB3606.eurprd08.prod.outlook.com (2603:10a6:20b:4d::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22; Thu, 7 Apr 2022 15:04:12 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::90e:52a:2cd5:ad63]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::90e:52a:2cd5:ad63%7]) with mapi id 15.20.5144.019; Thu, 7 Apr 2022 15:04:12 +0000 To: nd , GCC Patches Subject: [PATCH]AArch64 fix ls64 intrinsics expansion [PR104409] Thread-Topic: [PATCH]AArch64 fix ls64 intrinsics expansion [PR104409] Thread-Index: AQHYSpCOSmkepWQozU++W5SuNUKUqw== Date: Thu, 7 Apr 2022 15:04:11 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-ms-exchange-imapappendstamp: VI1PR08MB5325.eurprd08.prod.outlook.com (15.20.5144.019) x-ts-tracking-id: A9A251EA530B72469F86A2354C00634E.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-exchange-messagesentrepresentingtype: 1 X-MS-Office365-Filtering-Correlation-Id: e95ccde3-ef12-4bb0-ed1c-08da18a7e859 x-ms-traffictypediagnostic: AM6PR08MB3606:EE_|AM5EUR03FT010:EE_|AM9PR08MB7183:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 8x7fhoJWeKgTXef2Z2Chv2Ks02YVzkuengJK5sSRTLtTSAtavLgrQpia8B7/K7U2NsAP9b5dCv/TKfhmu5DVtfwnV4XcN5MS6zPEO5s44YuBsTjVZEhxK5VnHKsKi3G/TmxN5gpquLpudVyFu8WlvjmM2wj1DL234bENLRPJvXyU96A13J6OcOH4uk1lOIYmP8oyQKZJKH0az7s9xvBGTf6R/K1zEkm0TPpJhES7hI1Tg2SE7H9bo6abfM+/ZcnYV/yjeHTRRoS6LbnmY2NTk46uZJ7F6kw9SJdlobyv5LphDf7ZitwZ0Xta5olOd6inLR7Ycdb5tCAiQ+9s3BfV4M3zhZvhua3kAyxkC2lHN3iMc1DMKwaEza0TZF/JtCdQETb6lycGpHolTxcQgg61c1gJwqY7EtP9Pr78ZjZDAOblJzPSScKVdsUA3ewZLWcjknKIp3xd29wK4v/AQvKqoYy3floY0KZlp6N9C8i68AuYS4zPCpf3AK6++PkNIFjOjN6bKvYhGrrpQNC68GszjEopSA/eD95IbSFz0KMyFCCWy09Nr/N/NeIaMK/oOUCjXHo+1sqHS820hoVqx1l2JjSxpw5UHHINaMHQa8d5aZ8S2YJNqkRu7BdFDwQ+JJd3UPnTroa46QvuTi27UtiEHOQ2H8eGCDCMlDMFgfPYd+xqwc4And7Y2zmhdkHN3cLCvB5/g2xNcZqpQW7gAXKD+g== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(186003)(508600001)(55016003)(54906003)(38070700005)(33656002)(8936002)(44832011)(26005)(52536014)(71200400001)(2906002)(9686003)(66446008)(64756008)(66946007)(66556008)(66476007)(5660300002)(4326008)(8676002)(38100700002)(7696005)(6506007)(316002)(86362001)(76116006)(110136005)(122000001)(99936003); DIR:OUT; SFP:1101; MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3606 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 2e71ab3e-17b5-4e83-e366-08da18a7dfe3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GRc8wWe8/bwto3sUXAsnmc6BoXTaugOvhr13YHjDlIeLbDXTk59pAi+GZJjCyeK90ml9SNMr/apMvGwQ2bim6yGUYFxRnAe7adhIY9+eLq7PJtz6VKHO8NsZt6zkGUkG6eiHm4m4+pfV32FbR4k8U0waXnbSuBhmP+RVdiphyJXUqNOIDjokd1AmXFZqWR5v7f4Dlcj6cjH2AXi0evwbliGcrCLpBs5xDRxZOWcmZ6Ln/tiDEY43i9o7f8nVQWwicDOqzVddgUQR2CZqYkrl6XGqeN+glHa33ElF9SqAUbNEI9NnrhOUFMhTkqoikiUC7M/OR83HWHq/ph0vuqp5gVwVcIJOlgKUtRnFGncsNxmd+jhd3kftU1NddhGPVb+PJ36MYf8cRiliuzZa7OJrH+DZW4tTzecvL6AYlLNiOY/fqPotgX+eCwfYGqP8oqV4nIPfq4oHcJCQGlNUeXa/D4oWhjBBryHQphIHzCnIUCQgPc+LTyin3InwzeRiWsCr6FKSxZAtfZudxyxf1xBQlDGCDDY8EYNepTtlR675aGIqBpDyfce7BwYm/8KcryPF1RzCDrm+lpAFwNhKMkIM+NdRzChOqB5rnGmYH2ah8vBxgicUCUS+uPdqO7H6KfKGYrW1mmBQneNMp0+rMtrWUXn2vw75P2WPcqO9tTG45TLNWUDDNPHSVH8m12Wfh3nB X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(70206006)(70586007)(8676002)(33656002)(8936002)(47076005)(40460700003)(6506007)(7696005)(33964004)(52536014)(86362001)(5660300002)(36860700001)(4326008)(55016003)(26005)(235185007)(336012)(2906002)(356005)(81166007)(508600001)(99936003)(186003)(110136005)(9686003)(54906003)(82310400005)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2022 15:04:26.2534 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e95ccde3-ef12-4bb0-ed1c-08da18a7e859 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7183 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tamar Christina via Gcc-patches From: Tamar Christina Reply-To: Tamar Christina Cc: Richard Earnshaw , Richard Sandiford , Marcus Shawcroft Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, The LS64 intrinsics used a machinery that's not safe to use unless being called from a pragma instantiation. This moves the initialization code to a new pragma for arm_acle.h. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. I didn't add the testcase from the PR as it's 65kb but valgrind shows the memory error is gone. Ok for master? Thanks, Tamar gcc/ChangeLog: PR target/104409 * config/aarch64/aarch64-builtins.cc (handle_arm_acle_h): New. (aarch64_general_init_builtins): Move LS64 code. * config/aarch64/aarch64-c.cc (aarch64_pragma_aarch64): Support arm_acle.h * config/aarch64/aarch64-protos.h (handle_arm_acle_h): New. * config/aarch64/arm_acle.h: Add pragma GCC aarch64 "arm_acle.h". --- inline copy of patch -- diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index 5217dbdb2ac78bba0a669d22af6d769d1fe91a3d..65d09afc008b891d8b67a443140b4157cfa84c44 100644 --- diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index 5217dbdb2ac78bba0a669d22af6d769d1fe91a3d..65d09afc008b891d8b67a443140b4157cfa84c44 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -1641,6 +1641,14 @@ aarch64_init_ls64_builtins (void) = aarch64_general_add_builtin (data[i].name, data[i].type, data[i].code); } +/* Implement #pragma GCC aarch64 "arm_acle.h". */ +void +handle_arm_acle_h (void) +{ + if (TARGET_LS64) + aarch64_init_ls64_builtins (); +} + /* Initialize fpsr fpcr getters and setters. */ static void @@ -1730,9 +1738,6 @@ aarch64_general_init_builtins (void) if (TARGET_MEMTAG) aarch64_init_memtag_builtins (); - - if (TARGET_LS64) - aarch64_init_ls64_builtins (); } /* Implement TARGET_BUILTIN_DECL for the AARCH64_BUILTIN_GENERAL group. */ diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc index caf8e332ea0da0a34f4e96f12a934a5eaeaa1fb2..767ee0c763c56a022089a647c7425afb00644644 100644 --- a/gcc/config/aarch64/aarch64-c.cc +++ b/gcc/config/aarch64/aarch64-c.cc @@ -302,6 +302,8 @@ aarch64_pragma_aarch64 (cpp_reader *) aarch64_sve::handle_arm_sve_h (); else if (strcmp (name, "arm_neon.h") == 0) handle_arm_neon_h (); + else if (strcmp (name, "arm_acle.h") == 0) + handle_arm_acle_h (); else error ("unknown %<#pragma GCC aarch64%> option %qs", name); } diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 46bade28ed6056bea90067d3af1311f300cea559..c478bb59ae1208329facc74200fe98d00bf93f7c 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -982,6 +982,7 @@ rtx aarch64_general_expand_builtin (unsigned int, tree, rtx, int); tree aarch64_general_builtin_decl (unsigned, bool); tree aarch64_general_builtin_rsqrt (unsigned int); tree aarch64_builtin_vectorized_function (unsigned int, tree, tree); +void handle_arm_acle_h (void); void handle_arm_neon_h (void); namespace aarch64_sve { diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h index ecd852f8a46d87787912e6573bf363619812e48f..9775a48c65825b424d3eb442384f5ab87b734fd7 100644 --- a/gcc/config/aarch64/arm_acle.h +++ b/gcc/config/aarch64/arm_acle.h @@ -29,6 +29,8 @@ #include +#pragma GCC aarch64 "arm_acle.h" + #ifdef __cplusplus extern "C" { #endif --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -1641,6 +1641,14 @@ aarch64_init_ls64_builtins (void) = aarch64_general_add_builtin (data[i].name, data[i].type, data[i].code); } +/* Implement #pragma GCC aarch64 "arm_acle.h". */ +void +handle_arm_acle_h (void) +{ + if (TARGET_LS64) + aarch64_init_ls64_builtins (); +} + /* Initialize fpsr fpcr getters and setters. */ static void @@ -1730,9 +1738,6 @@ aarch64_general_init_builtins (void) if (TARGET_MEMTAG) aarch64_init_memtag_builtins (); - - if (TARGET_LS64) - aarch64_init_ls64_builtins (); } /* Implement TARGET_BUILTIN_DECL for the AARCH64_BUILTIN_GENERAL group. */ diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc index caf8e332ea0da0a34f4e96f12a934a5eaeaa1fb2..767ee0c763c56a022089a647c7425afb00644644 100644 --- a/gcc/config/aarch64/aarch64-c.cc +++ b/gcc/config/aarch64/aarch64-c.cc @@ -302,6 +302,8 @@ aarch64_pragma_aarch64 (cpp_reader *) aarch64_sve::handle_arm_sve_h (); else if (strcmp (name, "arm_neon.h") == 0) handle_arm_neon_h (); + else if (strcmp (name, "arm_acle.h") == 0) + handle_arm_acle_h (); else error ("unknown %<#pragma GCC aarch64%> option %qs", name); } diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 46bade28ed6056bea90067d3af1311f300cea559..c478bb59ae1208329facc74200fe98d00bf93f7c 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -982,6 +982,7 @@ rtx aarch64_general_expand_builtin (unsigned int, tree, rtx, int); tree aarch64_general_builtin_decl (unsigned, bool); tree aarch64_general_builtin_rsqrt (unsigned int); tree aarch64_builtin_vectorized_function (unsigned int, tree, tree); +void handle_arm_acle_h (void); void handle_arm_neon_h (void); namespace aarch64_sve { diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h index ecd852f8a46d87787912e6573bf363619812e48f..9775a48c65825b424d3eb442384f5ab87b734fd7 100644 --- a/gcc/config/aarch64/arm_acle.h +++ b/gcc/config/aarch64/arm_acle.h @@ -29,6 +29,8 @@ #include +#pragma GCC aarch64 "arm_acle.h" + #ifdef __cplusplus extern "C" { #endif