From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2083.outbound.protection.outlook.com [40.107.105.83]) by sourceware.org (Postfix) with ESMTPS id B91F13858D32 for ; Thu, 25 May 2023 10:12:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B91F13858D32 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=M6ECqNPL0A1oHHd34AyKqExloMF7KBpt8uuCHqWrR98=; b=9EH1+mtJg2KAXJXRG5/+oLfrOl+Zw2kL8IhC9U4jDDVbHI45br2btYN9916sdzE8VCE8xwcFpZZ6lq7an24wHm2dFITu/LC/ulQQKbdU39I4w9YCUWXUSICidP6zglEDCE8H4q55TJ14Rb8FfUT/3CaCxVyINVNQA3FaNt6i94w= Received: from AS8PR07CA0017.eurprd07.prod.outlook.com (2603:10a6:20b:451::26) by DU0PR08MB9847.eurprd08.prod.outlook.com (2603:10a6:10:444::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 10:12:18 +0000 Received: from AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:451:cafe::fd) by AS8PR07CA0017.outlook.office365.com (2603:10a6:20b:451::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 10:12:18 +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 AM7EUR03FT011.mail.protection.outlook.com (100.127.140.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.17 via Frontend Transport; Thu, 25 May 2023 10:12:18 +0000 Received: ("Tessian outbound 945aec65ec65:v136"); Thu, 25 May 2023 10:12:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 12448201b79ef616 X-CR-MTA-TID: 64aa7808 Received: from 1a42e5f916dc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 667F495D-6A5E-47DA-8CFA-595166BD43E5.1; Thu, 25 May 2023 10:12:11 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1a42e5f916dc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 25 May 2023 10:12:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XwD5Ermeed6ZH19LlWWauxrz6z0+edZZy8rribzxAzLusRXa7Tv569QB9vRI7IH2vOs4z7XcwrLHbTxBYCK6+c8gJ08Vg8J/m+WzoNzN+3kGqZjlvgU/148CdEoHJ3dMbrvsaqHoCo603kVep6iVUP8Z/8BfsO0Vqrjb2xTIWuQMTAE1jVM4mocejb/wksLKMOU4P6QfdcOqRkLdfkAULsNEsRa36g+5Fofn9GOJN31uzkpo4Z3z4FP5ZP5ihpdwVLB/qJWlwlQuQOTqo8PmzztIviI68FT8+OzSkHRrZzWYICZvwi6uiw1ptXWyFavX72DG+gE2YUSKCXqDWycgkg== 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=M6ECqNPL0A1oHHd34AyKqExloMF7KBpt8uuCHqWrR98=; b=C70rE77cOccXYYddytyL3zd+nzJJY2GhyflyBNPV7t1tHciDIjqp4g/rIqF5kGga+RWEzdY1lGZ+UALZQbixEOsxVuyO6D+rQ4qZfoUR+VeMPcqPlaARHj+iRN9jcjUTRREshOgHoD0vL5D3+6S5T/qoZ4aAg10ZF3a9/DhPekOpPWyVsQnn0SYSj/bI76RF4K/Qgxxs8XaKwSG8ENFG6Un4gxkuFy7NniP7JoJ9Z4NylwBCmfGhNxxIpUaWh8hW1rRd213KFV1Huvk76USfTQqOgE4+x6n01Kfs/PcRy9EixT41ew2lILnj8tXkR+tSEppWUFM0nvVjuitwzcXkMw== 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=M6ECqNPL0A1oHHd34AyKqExloMF7KBpt8uuCHqWrR98=; b=9EH1+mtJg2KAXJXRG5/+oLfrOl+Zw2kL8IhC9U4jDDVbHI45br2btYN9916sdzE8VCE8xwcFpZZ6lq7an24wHm2dFITu/LC/ulQQKbdU39I4w9YCUWXUSICidP6zglEDCE8H4q55TJ14Rb8FfUT/3CaCxVyINVNQA3FaNt6i94w= Received: from PAXPR08MB6926.eurprd08.prod.outlook.com (2603:10a6:102:138::24) by AS4PR08MB7505.eurprd08.prod.outlook.com (2603:10a6:20b:4f7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 10:12:09 +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.6433.016; Thu, 25 May 2023 10:12:08 +0000 From: Kyrylo Tkachov To: "gcc-patches@gcc.gnu.org" Subject: [ping] RE: [PATCH] stor-layout, aarch64: Express SRA intrinsics with RTL codes Thread-Topic: [ping] RE: [PATCH] stor-layout, aarch64: Express SRA intrinsics with RTL codes Thread-Index: AdmJm/vYyeUvBq7uQaSBpBqcpApXSgFVWEdg Date: Thu, 25 May 2023 10:12:08 +0000 Message-ID: References: In-Reply-To: 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_|AS4PR08MB7505:EE_|AM7EUR03FT011:EE_|DU0PR08MB9847:EE_ X-MS-Office365-Filtering-Correlation-Id: cd684aa5-17eb-4adf-b902-08db5d0885a8 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: Yici6IhzK7jnxC8kHo0Uhwy61QboYHG9XwIyDSlK1zfilwDEbGiGoiEvpjFVXeMLD350VxhFBv+FXwt8O3ST6Hi3JFa1YpDRplRSc3F3VZqiq3vc++rAJJxGglZZ20B/j9JEmX1nBS02kgoHzK8JeKuOuBSStrUy7HLDsN+uFU7XC1hzaIKZ7KRv7K1xgib4uZVjVlQG/mz8boPpQj2TMaha0IaFkvZstHongEodpOYm5YSlbfL+waQn162tNLwmHkzs3oh4F2piNez4CmJ17TiXi4W0S6gq93D4lu7Wuo+pEV9X8MAvvqGf77Sjkg6xh6F1Hn8UQLNfnwUuWUfPNwIAo9BCvuXmm5tSjWzuSHG946NCn81KIsb+fpaGfH1qgd4QhxKiHguNzZTvElSk11sQWlufOkzXyF2yNAyGTDTU3K9XGRtsvT/w4FKAwMmZgcuq0XUsIiW1Qzr86YOrDeVk/ZFEF0RB3oWy8Roz4ODhpLPtu65e2hcPmYqLnsp6wwQ6aAOluuE38DUQ1wZMe8161skXPVv1ZmnCTr1fN+CTDzu9BhJWeSN2dqKvUN1pcPj39LPZIgNWDOgoflm8xZORCxCdWVxrzWi+isMwVM6I/92ANYqWjSxMviS/TWmY 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)(376002)(136003)(366004)(39860400002)(396003)(451199021)(33656002)(52536014)(5660300002)(8676002)(8936002)(53546011)(26005)(9686003)(6506007)(83380400001)(2906002)(186003)(55016003)(66946007)(76116006)(66556008)(66476007)(64756008)(66446008)(6916009)(122000001)(71200400001)(316002)(86362001)(38100700002)(478600001)(38070700005)(7696005)(41300700001);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: AS4PR08MB7505 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: AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c6848daa-380f-4292-06f4-08db5d087fca X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xpDK3ucBgJXgtKwdzrsBs7x+maeiVDhbEoSfb3qa9GKoRsDWfyDmh6qpEYaatmPdzMR2bkS2Tbf0PUu7cK3JPjW7XAqPW2rWdtGUPKjAL3edq1dFBjSjKhedD/+2p9VU/pE66H92ItTi1uUwLnki/4/Or3PvCk87gj0ZoJgUE32Lai2D0pbCi4k7ddtw5BAX2Lsk9B2MOvW7Ewd1nbeyroVsv6NgDVRn4Dk5YsCDD5Agyq9L4FRjUCwYvsDZPc+AQpIY3ht9LbbedN0KlyoQqADe78z72ZgFFoo44NDesf9KrVJqedFg84Wc720I11G4jF9/Ja4k+XsnfaBAizBDXw58Gn2o31NZEt6IALNldJ8bN9jyoG2rHuU8C3ELSidDa6um8h/6wf5T1QhQIjQuJwk6xp2WvZa7bGsOVNdup09EcnwOKrnhxvqPfW1shhLYhKzn5xb/a7WVVCL15D5C/RT3lVIbHqlX/Ywn/NsWOpsIYGy9QKiLvPIijceNds1RXP99xQQK1+tjJJ092PaVaroKUe8GcYKIYlSMNqWQgj5fSOiJWt8PxtuiAgYj2u+azaecz7qBTP9F+rG+ZuW3hELFqU0zLwvRC6ne0Tyl0xDHbdGp4mI1homYOAFYIQ2IJp0vPmatmB33wt3najzCGAGLWQn/6k0CqtZhAx1KrZPjUTquPBUS65UZarGPNtiIxf1xT/8XCwwK0sFF0/nrNP4uTZMk08OiOvxyAxdDHVc= 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)(39860400002)(346002)(376002)(136003)(396003)(451199021)(40470700004)(46966006)(36840700001)(52536014)(8936002)(5660300002)(8676002)(40460700003)(86362001)(26005)(53546011)(6506007)(9686003)(83380400001)(336012)(186003)(47076005)(2906002)(33656002)(36860700001)(55016003)(40480700001)(478600001)(316002)(82740400003)(356005)(81166007)(6916009)(70586007)(70206006)(82310400005)(7696005)(41300700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 10:12:18.5980 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd684aa5-17eb-4adf-b902-08db5d0885a8 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: AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9847 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,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: Ping. Thanks, Kyrill > -----Original Message----- > From: Gcc-patches bounces+kyrylo.tkachov=3Darm.com@gcc.gnu.org> On Behalf Of Kyrylo > Tkachov via Gcc-patches > Sent: Thursday, May 18, 2023 4:19 PM > To: gcc-patches@gcc.gnu.org > Subject: [PATCH] stor-layout, aarch64: Express SRA intrinsics with RTL co= des >=20 > Hi all, >=20 > This patch expresses the intrinsics for the SRA and RSRA instructions wit= h > standard RTL codes rather than relying on UNSPECs. > These instructions perform a vector shift right plus accumulate with an > optional rounding constant addition for the RSRA variant. > There are a number of interesting points: >=20 > * The scalar-in-SIMD-registers variant for DImode SRA e.g. ssra d0, d1, #= N > is left using the UNSPECs. Expressing it as a DImode plus+shift led to al= l > kinds of trouble as it started matching the existing define_insns for > "add x0, x0, asr #N" instructions and adding the SRA form as an extra > alternative required a significant amount of deduplication of iterators a= nd > things still didn't work out well. I decided not to tackle that case in > this patch. It can be attempted later. >=20 > * For the RSRA variants that add a rounding constant (1 << (shift-1)) the > addition is notionally performed in a wider mode than the input types so = that > overflow is handled properly. In RTL this can be represented with an > appropriate > extend operation followed by a truncate back to the original modes. > However for 128-bit input modes such as V4SI we don't have appropriate > modes > defined for this widening i.e. we'd need a V4DI mode to represent the > intermediate widened result. This patch defines such modes for > V16HI,V8SI,V4DI,V2TI. These will come handy in the future too as we have > more Advanced SIMD instruction that have similar intermediate widening > semantics. >=20 > * The above new modes led to a problem with stor-layout.cc. The new modes > only > exist for the sake of the RTL optimisers understanding the semantics of t= he > instruction but are not indended to be moved to and from register or > memory, > assigned to types, used as TYPE_MODE or participate in auto-vectorisation= . > This is expressed in aarch64 by aarch64_classify_vector_mode returning ze= ro > for these new modes. However, the code in stor- > layout.cc: > explicitly doesn't check this when picking a TYPE_MODE due to modes being > made > potentially available later through target switching (PR38240). > This led to these modes being picked as TYPE_MODE for declarations such a= s: > typedef int16_t vnx8hi __attribute__((vector_size (32))) when 256-bit > fixed-length SVE modes are available and vector_type_mode later strugglin= g > to rectify this. > This issue is addressed with the new target hook > TARGET_VECTOR_MODE_SUPPORTED_ANY_TARGET_P that is intended to > check if a > vector mode can be used in any legal target attribute configuration of th= e > port, as opposed to the existing TARGET_VECTOR_MODE_SUPPORTED_P that > checks > only the initial target configuration. This allows a simple adjustment in > stor-layout.cc that still disqualifies these limited modes early on while > allowing consideration of modes that can be turned on in the future with > target attributes. >=20 > Bootstrapped and tested on aarch64-none-linux-gnu. > Ok for the non-aarch64 parts? >=20 > Thanks, > Kyrill >=20 > gcc/ChangeLog: >=20 > * config/aarch64/aarch64-modes.def (V16HI, V8SI, V4DI, V2TI): New > modes. > * config/aarch64/aarch64-protos.h (aarch64_const_vec_rnd_cst_p): > Declare prototype. > (aarch64_const_vec_rsra_rnd_imm_p): Likewise. > * config/aarch64/aarch64-simd.md (*aarch64_simd_sra): > Rename to... > (aarch64_sra_n_insn): ... This. > (aarch64_rsra_n_insn): New define_insn. > (aarch64_sra_n): New define_expand. > (aarch64_rsra_n): Likewise. > (aarch64_sra_n): Rename to... > (aarch64_sra_ndi): ... This. > * config/aarch64/aarch64.cc (aarch64_classify_vector_mode): Add > any_target_p argument. > (aarch64_extract_vec_duplicate_wide_int): Define. > (aarch64_const_vec_rsra_rnd_imm_p): Likewise. > (aarch64_const_vec_rnd_cst_p): Likewise. > (aarch64_vector_mode_supported_any_target_p): Likewise. > (TARGET_VECTOR_MODE_SUPPORTED_ANY_TARGET_P): Likewise. > * config/aarch64/iterators.md (UNSPEC_SRSRA, UNSPEC_URSRA): > Delete. > (VSRA): Adjust for the above. > (sur): Likewise. > (V2XWIDE): New mode_attr. > (vec_or_offset): Likewise. > (SHIFTEXTEND): Likewise. > * config/aarch64/predicates.md (aarch64_simd_rsra_rnd_imm_vec): > New > predicate. > * doc/tm.texi (TARGET_VECTOR_MODE_SUPPORTED_P): Adjust > description to > clarify that it applies to current target options. > (TARGET_VECTOR_MODE_SUPPORTED_ANY_TARGET_P): Document. > * doc/tm.texi.in: Regenerate. > * stor-layout.cc (mode_for_vector): Check > vector_mode_supported_any_target_p when iterating through vector > modes. > * target.def (TARGET_VECTOR_MODE_SUPPORTED_P): Adjust > description to > clarify that it applies to current target options. > (TARGET_VECTOR_MODE_SUPPORTED_ANY_TARGET_P): Define.