From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2089.outbound.protection.outlook.com [40.107.21.89]) by sourceware.org (Postfix) with ESMTPS id CE5703858D1E for ; Tue, 2 May 2023 09:19:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE5703858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mlb2hg04djUGLvaQQn7Y/ZpIOH5M/HHcGWTa26jPfCY=; b=D8D1WjAUEev9u1CJliEwT9BHz5GBvVNeWnqD1pXtE1HonRUxLP4OWRA+kcuOERFx8z9TsQm0n6LSxWo4BWVuyYUxwlwlJCUD62NVCIZlOQK/Uxw569rlRvrVXadB/CW5GZYxWau7iz+LWM7y+gDLupKp2dUJENHlF+ylEpNxtIw= Received: from DB6PR07CA0188.eurprd07.prod.outlook.com (2603:10a6:6:42::18) by DB4PR08MB8176.eurprd08.prod.outlook.com (2603:10a6:10:380::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.30; Tue, 2 May 2023 09:19:00 +0000 Received: from DBAEUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:42:cafe::65) by DB6PR07CA0188.outlook.office365.com (2603:10a6:6:42::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.19 via Frontend Transport; Tue, 2 May 2023 09:19:00 +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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT045.mail.protection.outlook.com (100.127.142.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.20 via Frontend Transport; Tue, 2 May 2023 09:19:00 +0000 Received: ("Tessian outbound 5154e9d36775:v136"); Tue, 02 May 2023 09:19:00 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 61adab69fea81cd5 X-CR-MTA-TID: 64aa7808 Received: from 8699bab07fb3.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 14549BAF-DB8E-4529-91A6-46720988464E.1; Tue, 02 May 2023 09:18:53 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8699bab07fb3.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 02 May 2023 09:18:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PvbejzIQMlMMIfZntkEEx6zvq8XZumqoBD0cz62OCHWM0Xi6ku5Alt4tXe+2LuJSZkHYZdIQS2YrguaOgagx1DtNIdOJChUYaM+G3lk81YCt4w21Pnu5dfUWESFeZ1KBqHgRoQXgVZrgLgw7j4VVdhdml1i/clH3QKyZMo8Mi35cCumvISN3XwhX9r53M5ts56UNg8elvNfz75CXhIgz20d6hj/pVIUcyAdt1TbwQ5PYlG5puN1IXycMswBEScKb1I0fq1omsEeMPVle8gLah53BowHplyGItpuwnrNt+8B24DFh+70lfJSjH+aLEH9K8m2jxlYz3GG/oNMUTdR00Q== 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=Mlb2hg04djUGLvaQQn7Y/ZpIOH5M/HHcGWTa26jPfCY=; b=ajn7WQpiGqaWz9oE0taa4Pt7Z1rIWxteFF41svs58hIaxZRoex9mXlfcJZdtzmGPmLkadN1kxL6Xm6xRvCN8tzcnpFToYZEhJpBg9KVV0i4WvhZla5nJ+XL1BLKpDC6LGRWWCjza+nhTrzsPqZjX1zIooLQzoMSLCIrQHVlLkJx/6cVLOeKFk6W/6MgUUM1y7KM5qIEQKy3t7LCBT6O3GB2EeoaNKsygWqAB5oaiXMaybaprjobK+hejpTWHfHnHugKZZvBlUYr+fHEM/w9xjb+FVqe8ndgvMjj59buUvrrrgZv2n/AzIMv1u97RhDN8au3XTCG6OLZhTIBmpCUjWg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mlb2hg04djUGLvaQQn7Y/ZpIOH5M/HHcGWTa26jPfCY=; b=D8D1WjAUEev9u1CJliEwT9BHz5GBvVNeWnqD1pXtE1HonRUxLP4OWRA+kcuOERFx8z9TsQm0n6LSxWo4BWVuyYUxwlwlJCUD62NVCIZlOQK/Uxw569rlRvrVXadB/CW5GZYxWau7iz+LWM7y+gDLupKp2dUJENHlF+ylEpNxtIw= Received: from PAXPR08MB6926.eurprd08.prod.outlook.com (2603:10a6:102:138::24) by AS8PR08MB7917.eurprd08.prod.outlook.com (2603:10a6:20b:538::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.31; Tue, 2 May 2023 09:18:50 +0000 Received: from PAXPR08MB6926.eurprd08.prod.outlook.com ([fe80::db73:66ba:ae70:1ff1]) by PAXPR08MB6926.eurprd08.prod.outlook.com ([fe80::db73:66ba:ae70:1ff1%3]) with mapi id 15.20.6340.031; Tue, 2 May 2023 09:18:50 +0000 From: Kyrylo Tkachov To: Christophe Lyon , "gcc-patches@gcc.gnu.org" , Richard Earnshaw , Richard Sandiford CC: Christophe Lyon Subject: RE: [PATCH 00/22] arm: New framework for MVE intrinsics Thread-Topic: [PATCH 00/22] arm: New framework for MVE intrinsics Thread-Index: AQHZcfwuvoHXMrmGHkmy04ZKAMkswa9GyX5A Date: Tue, 2 May 2023 09:18:50 +0000 Message-ID: References: <20230418134608.244751-1-christophe.lyon@arm.com> In-Reply-To: <20230418134608.244751-1-christophe.lyon@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: PAXPR08MB6926:EE_|AS8PR08MB7917:EE_|DBAEUR03FT045:EE_|DB4PR08MB8176:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a02698c-d2ac-43fc-1d5b-08db4aee43ba 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: 6CjZ/j9CfnMFP2f0MheQLZGVdRlLiXgbn/JLc0/GI9Wi61+r/vkPoVGVyTja6qE9423Q6d/AFRDANltdfJEzoTRm7G1s4sJSQc4LbEtsYxZhMMT2itsxKtPF4J1toFEOJY8Ab4cGjzACAjZcfntSjXpa7kTg7qp1JF3VyrJ6V2y6qEqwpEMLSaN0SmsS5sP7XEx+XfQLUAtF7Bopsb3sxppEXJl1KLHAUDS+hlePmFlAPMwvxtkTE34rDL7NgajmQe/jr1ZSdODrJKacsrKPAgcpRbn/0Be8DZj5Px+6nutWxZfUQ7Dq2g2KLmrw5KMGEPVbBHBkgl6r4x+I1p3YA4vZXrkd163cyukAziJjISZAjBR1DARZ7gCMT3y4zKVRJvvZecPG49YWrr8vE7FD6E9r1y85/oAD2POlp5JY6fjkoa6fc/8Esw6O0E8f5qAKyJntpTmk/sbPqwP6RtKH2j1T6JlKP3l32YyicP33U1qAtnv9oxoOkbRJ7f7KH/77OrmkQzZXLxVA1qS4ZXMbfoUg778KPxENdd+hQjnWaVeUvqBcjrps7bQzkbASn0Zo8W4Wc+W9IYAdVzwcWuyNhJPJzVlOhI7Tux37oTr6224= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR08MB6926.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199021)(7696005)(83380400001)(71200400001)(55016003)(186003)(26005)(53546011)(6506007)(9686003)(38070700005)(8936002)(8676002)(38100700002)(478600001)(52536014)(110136005)(6636002)(66476007)(66446008)(66946007)(86362001)(66556008)(76116006)(316002)(4326008)(64756008)(41300700001)(33656002)(5660300002)(2906002)(122000001);DIR:OUT;SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7917 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: DBAEUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6cd53952-963a-4721-74e5-08db4aee3de0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B8jrWhzhIy8bsJV5L8VgqQyS64K0qUblCiQrilnB0r/E/qF6vd5XyXQnDVz7wVLtPpdrx+jTC7xWSAGiZMv+M7OQ806GOwynzpN9YgJmljqne9SCB9MObPI+1Wpn7BD+scpa0w+pn2oTfiEp6WKmmCpfE1pCAB5ZG4Yi9LhAMbN0eZCJFEQzjcOSqZF2DroOhnWeDVk/U0+jwRcrfeDVV+NvR4WbEXtUdNlIrAMR9aD45zRDAeUYpzbbzPVmygmb28me488twiyiGiZ7It9yX8CcbZgD00z+/gbwyZbal5z8ucUm5DNZ3iNK6gUEO+hhgP8i33HcwxlDoLtAzQXrkDAQDp+5EjkdIgPWpDD/xSnRXE4NWPmtVQ/2yLNo9hja1+AQV6l7Nw1UwGz+IC6nxXcIsTfGuA9jhl0HI7FLBo4svca/wfLPQFIcW2MuiNVsmBokZlRjYNwEe0Un2AsGeNMJl+38iMQIsSP46zsvrmsBlFjBgRM3VTY8p1Bkrjrm6AkF3fWWxy/EctSWTSNoXVEr39YOR84PIsYnZAGFEc9iGUZ2J3Q18dCtxTsUS78Ve7ewI5HpToSR1YymApJbWpfkP437bATacNF4ZXF6wNAarnMwbgJvr36sA2RzqKXW7sLPLm5BfoMnVayKb4uk20ei4Wi2sA9yYWVmhZA38ZPvLk2khtzB5aIi/iLSGNSb 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:(13230028)(4636009)(396003)(136003)(39850400004)(376002)(346002)(451199021)(36840700001)(46966006)(478600001)(83380400001)(36860700001)(186003)(70586007)(70206006)(4326008)(6636002)(110136005)(336012)(9686003)(47076005)(53546011)(6506007)(7696005)(26005)(316002)(34020700004)(8676002)(8936002)(356005)(5660300002)(41300700001)(82740400003)(2906002)(55016003)(40480700001)(52536014)(81166007)(82310400005)(86362001)(33656002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2023 09:19:00.1843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a02698c-d2ac-43fc-1d5b-08db4aee43ba 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: DBAEUR03FT045.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8176 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Christophe, > -----Original Message----- > From: Christophe Lyon > Sent: Tuesday, April 18, 2023 2:46 PM > To: gcc-patches@gcc.gnu.org; Kyrylo Tkachov ; > Richard Earnshaw ; Richard Sandiford > > Cc: Christophe Lyon > Subject: [PATCH 00/22] arm: New framework for MVE intrinsics >=20 > Hi, >=20 > This is the beginning of a long patch series to change the way Arm MVE > intrinsics are implemented. The goal is to get rid of arm_mve.h, which > takes a long time to parse and compile. >=20 Thanks for doing this. It is a significant improvement to the MVE intrinsic= s and should address some of the biggest maintainability and scalability is= sues we have in that area. I'll be going through the patches one-by-one (I've looked at these offline = already before), but the approach looks good to me at a high level. My hope is that we'll move all the intrinsics, including the Neon ones to u= se this framework in the future, but getting the framework in place first i= s a good major first step in that direction. Thanks, Kyrill > Roughly speaking, it's about using a framework very similar to what is > implemented for AArch64/SVE intrinsics. I haven't converted all the > intrinsics yet, but I think it would be good to start the conversion > when stage-1 reopens. >=20 > * Factorizing names > One of the main implementation differences I noticed between SVE and > MVE is that mve.md provides only full builtin names at the moment, and > makes almost no use of "parameterized names" > (https://gcc.gnu.org/onlinedocs/gccint/Parameterized- > Names.html#Parameterized-Names). >=20 > Without this, we'd need the builtin expander to use a large > switch/case of the form: >=20 > switch (code) > case VADDQ_S: insn_code =3D code_for_mve_vaddq_s (...) > case VADDQ_U: insn_code =3D code_for_mve_vaddq_u (...) > case VSUBQ_S: insn_code =3D code_for_mve_vsubq_s (...) > case VSUBQ_U: insn_code =3D code_for_mve_vsubq_u (...) > .... >=20 > so part of the work (which I called "factorize" in the commit > messages) is about replacing >=20 > (define_insn "mve_vaddq_n_" > with > (define_insn "@mve_q_n_" > with the help of a new iterator (mve_insn). >=20 > Doing so makes it more obvious that some patterns are identical, > except for the instruction name. I took this opportunity to merge > them, so for instance I have a patch which merges add, sub and mul > patterns. Although not strictly necessary for the MVE intrinsics > restructuring work, this is a good opportunity to reduce such code > duplication (I did notice a few bugs during that process, which led me > to post a few small patches in the past months). Note that identical > patterns will probably remain after the series, they can be merged > later if we want. >=20 > This factorization also implies the introduction of new iterators, but > also means that several existing ones become useless. These patches do > not remove them because it's a bit painful to reorder patches which > remove lines at some "random" places, leading to merge conflicts. It's > much simpler to write a big cleanup patch at the end of the serie to > remove all such useless iterators at once. >=20 > * Intrinsic re-implementation > After intrinsic names have been factorized, the actual > re-implementation patch is small: > - add 1 line in each of arm-mve-builtins-base.{cc,def,h} describing > the intrinsic shape/signature, types and predicates involved, > RTX/unspec codes > - remove the intrinsic definitions from arm_mve.h >=20 > The full series of ~140 patches is organized like this: > - patches 1 and 2 introduce the new framework > - new implementation of vreinterpretq > - new implementation of vuninitialized > - patch groups of varying size, consisting in: > - add a new "shape" if needed (e.g. unary, binary, ternary, ....) > - add framework support functions if needed > - factorize a set of intrinsics (at minimum, just make use of > parameterized-names) > - actual re-implementation of the intrinsics >=20 > I kept patches small so the incremental progress is easy to follow and > check. I'll submit the patches in small groups, this first one will > make sure we agree on the implementation. >=20 > Tested on arm-eabi with -mthumb/-mfloat-abi=3Dhard/-march=3Darmv8.1- > m.main+mve. >=20 > To help reviewers, I suggest to compare arm-mve-builtins.cc with > aarch64-sve-builtins.cc. >=20 > Christophe Lyon (22): > arm: move builtin function codes into general numberspace > arm: [MVE intrinsics] Add new framework > arm: [MVE intrinsics] Rework vreinterpretq > arm: [MVE intrinsics] Rework vuninitialized > arm: [MVE intrinsics] add binary_opt_n shape > arm: [MVE intrinsics] add unspec_based_mve_function_exact_insn > arm: [MVE intrinsics] factorize vadd vsubq vmulq > arm: [MVE intrinsics] rework vaddq vmulq vsubq > arm: [MVE intrinsics] add binary shape > arm: [MVE intrinsics] factorize vandq veorq vorrq vbicq > arm: [MVE intrinsics] rework vandq veorq > arm: [MVE intrinsics] add binary_orrq shape > arm: [MVE intrinsics] rework vorrq > arm: [MVE intrinsics] add unspec_mve_function_exact_insn > arm: [MVE intrinsics] add create shape > arm: [MVE intrinsics] factorize vcreateq > arm: [MVE intrinsics] rework vcreateq > arm: [MVE intrinsics] factorize several binary_m operations > arm: [MVE intrinsics] factorize several binary _n operations > arm: [MVE intrinsics] factorize several binary _m_n operations > arm: [MVE intrinsics] factorize several binary operations > arm: [MVE intrinsics] rework vhaddq vhsubq vmulhq vqaddq vqsubq > vqdmulhq vrhaddq vrmulhq >=20 > gcc/config.gcc | 2 +- > gcc/config/arm/arm-builtins.cc | 237 +- > gcc/config/arm/arm-builtins.h | 1 + > gcc/config/arm/arm-c.cc | 42 +- > gcc/config/arm/arm-mve-builtins-base.cc | 163 + > gcc/config/arm/arm-mve-builtins-base.def | 50 + > gcc/config/arm/arm-mve-builtins-base.h | 47 + > gcc/config/arm/arm-mve-builtins-functions.h | 387 + > gcc/config/arm/arm-mve-builtins-shapes.cc | 529 ++ > gcc/config/arm/arm-mve-builtins-shapes.h | 47 + > gcc/config/arm/arm-mve-builtins.cc | 2013 ++++- > gcc/config/arm/arm-mve-builtins.def | 40 +- > gcc/config/arm/arm-mve-builtins.h | 672 +- > gcc/config/arm/arm-protos.h | 24 + > gcc/config/arm/arm.cc | 27 + > gcc/config/arm/arm_mve.h | 7581 +---------------- > gcc/config/arm/arm_mve_builtins.def | 6 - > gcc/config/arm/arm_mve_types.h | 1430 ---- > gcc/config/arm/iterators.md | 240 +- > gcc/config/arm/mve.md | 1747 +--- > gcc/config/arm/predicates.md | 4 + > gcc/config/arm/t-arm | 32 +- > gcc/config/arm/unspecs.md | 1 + > gcc/config/arm/vec-common.md | 8 +- > gcc/testsuite/g++.target/arm/mve.exp | 8 +- > .../arm/mve/general-c++/nomve_fp_1.c | 15 + > .../arm/mve/general-c++/vreinterpretq_1.C | 25 + > .../gcc.target/arm/mve/general-c/nomve_fp_1.c | 15 + > .../arm/mve/general-c/vreinterpretq_1.c | 25 + > 29 files changed, 4926 insertions(+), 10492 deletions(-) > create mode 100644 gcc/config/arm/arm-mve-builtins-base.cc > create mode 100644 gcc/config/arm/arm-mve-builtins-base.def > create mode 100644 gcc/config/arm/arm-mve-builtins-base.h > create mode 100644 gcc/config/arm/arm-mve-builtins-functions.h > create mode 100644 gcc/config/arm/arm-mve-builtins-shapes.cc > create mode 100644 gcc/config/arm/arm-mve-builtins-shapes.h > create mode 100644 gcc/testsuite/g++.target/arm/mve/general- > c++/nomve_fp_1.c > create mode 100644 gcc/testsuite/g++.target/arm/mve/general- > c++/vreinterpretq_1.C > create mode 100644 gcc/testsuite/gcc.target/arm/mve/general- > c/nomve_fp_1.c > create mode 100644 gcc/testsuite/gcc.target/arm/mve/general- > c/vreinterpretq_1.c >=20 > -- > 2.34.1