From patchwork Tue Aug 31 13:26:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 1522619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=UIs1fbDn; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GzSfx2GsCz9sW8 for ; Tue, 31 Aug 2021 23:27:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9BC0385843A for ; Tue, 31 Aug 2021 13:27:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9BC0385843A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1630416470; bh=iqdQbilqIjDoMVRAMt2/riGwVPjNfhyV/8e4hW+MYXo=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=UIs1fbDnO/8ZHTavar7M1rLJ3OZnVp7MKcLh/eYFUjH4tdr9hnIBLJl4+Zzkb06PR +x2u8AWKRLVUKF9dyyIeQV1tv2vVJa0vV+vpMDfYbWdABEfsKqZ7XFeEAtUo0LTHEx e/XVuA1pV1r3zqZu9nrkLDaLQW1PA2tY2JL7lXyE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40049.outbound.protection.outlook.com [40.107.4.49]) by sourceware.org (Postfix) with ESMTPS id 3BAFB3858026 for ; Tue, 31 Aug 2021 13:27:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3BAFB3858026 Received: from AS8PR04CA0022.eurprd04.prod.outlook.com (2603:10a6:20b:310::27) by AM6PR08MB3046.eurprd08.prod.outlook.com (2603:10a6:209:48::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.23; Tue, 31 Aug 2021 13:26:59 +0000 Received: from AM5EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:310:cafe::ed) by AS8PR04CA0022.outlook.office365.com (2603:10a6:20b:310::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.20 via Frontend Transport; Tue, 31 Aug 2021 13:26:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; 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 AM5EUR03FT041.mail.protection.outlook.com (10.152.17.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Tue, 31 Aug 2021 13:26:58 +0000 Received: ("Tessian outbound 1a0c40aa17d8:v103"); Tue, 31 Aug 2021 13:26:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8561285d25f97dbf X-CR-MTA-TID: 64aa7808 Received: from cf8a601611d2.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 10C24E33-05B5-4F6F-AC9E-FA9CA9C314C7.1; Tue, 31 Aug 2021 13:26:52 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cf8a601611d2.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 31 Aug 2021 13:26:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BchUFEA9pMwsHub+HAQhck6R8sta22NXLu8je96ZNvZevao3PsItuX3FDJ4H1sWEZu3OSpMTjjT6qO8eulCFt23Y9ameg8BaNDz+SNEwB0B916U6ONsJ29g5b1F5pBxfUxEjvWbxxFncTEBGzf8VyvNziGiniRLOjRQ5LYeAeiQ619hB77RlSupCeIQkZYWU8CI6F8lhofR0n+9twEGZvo65oM54M2PXo3VIgElU8bvmkz+efkaimvi/+qjIq60h4ktyWiifV9cp6WWV2poDnjtHB10UHV4eK+92ktArfj+aPWZKvdPN0Rr3jc6HoMj0L4+06J8hazNEmdlDHDNKWQ== 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=iqdQbilqIjDoMVRAMt2/riGwVPjNfhyV/8e4hW+MYXo=; b=XUAhcXwxZ6vOj59JqO3MyheXyZ3N4HDEyZ3d1VqMIj4raVViAwWa4nKCL0iOgUl3z6910zO0tTvKoctK4pIwlqR3GaaVSaNXfZ5jGEDhn95o1AcLWlYVcHVzuQSP/obP74qU4neN98N1ygUuKKbZuAvcVTn05s4Tb7VwiF0TV3JEGPoamnVslYMRkgQnR2NAStm5NsGngBcuaj8iVTmSNaRC+BvM6U+J1PYozIVWpIk/y0KjzVhrG9bmMqREEBIPc/V8AhpwWtxvjXS2lAeVJ6a7WjQi1XDNvUzQvxyJyo6Cjj1XXzuNGXf6ijm2oY5uHIKBncaf3ShWZ3vrYN4B3g== 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 Authentication-Results-Original: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by VI1PR08MB3440.eurprd08.prod.outlook.com (2603:10a6:803:7c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.20; Tue, 31 Aug 2021 13:26:49 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::bd45:5ad5:f666:272a]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::bd45:5ad5:f666:272a%4]) with mapi id 15.20.4457.024; Tue, 31 Aug 2021 13:26:49 +0000 Date: Tue, 31 Aug 2021 14:26:41 +0100 To: gcc-patches@gcc.gnu.org Subject: [PATCH]AArch64[RFC] Force complicated constant to memory when beneficial Message-ID: Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: SA0PR12CA0027.namprd12.prod.outlook.com (2603:10b6:806:6f::32) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.53) by SA0PR12CA0027.namprd12.prod.outlook.com (2603:10b6:806:6f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17 via Frontend Transport; Tue, 31 Aug 2021 13:26:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28dfc4c8-6875-4a06-2391-08d96c83028d X-MS-TrafficTypeDiagnostic: VI1PR08MB3440:|AM6PR08MB3046: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LJpZ0n9eXxvJvLEj6qp58ELH+o0E8FYRZ+O2RZDvkseZ6xjm4VSvyKh8JsGMn+mLAms717gaZ84slLOMhUmznuSM1o8Izehq0Xjc19mCv+tA1svwpcg2wCO8fk+eiV1XpBTs281Tn4pC7EpcGhGkAM4/RBx6FJiLUicyBjnNh6bMlohJ9S56u4X3fMd+/hOvaTtfX4dTz0DbtN71gr3uMycbHY/wmZhCtAWXngTTIQelNkDW3ah3dV+i8SDG0A0wM4i/sgeXki90NL5PT1+rSTJoRGVxwkjCrAgKgPFLVzil9vb0GNL9OtDDvHOIafY65kBb3t9PTeq0xjuIK9G7rNuMaISgEiHMs0pD8z3HYs7HIUSIaHnBijNAPUAR+Vrus0WaH8SJMRQM5ffBgt6878QnExYXcmMJQz3LtQl/Mv8NbUylHnbZ8oB5u0G+z5ECWk9Gq2ryhgq7bfAg0BcylsbE+JEnMkMdmRsbKB1FHV7FXbFwMPhX/HRiUhBw90d9clqhjbOWRQCo4Kc+nmpVHoDFQrBBC8S6EvkWML/nqbbhVHAkDvICumKiBMFN3HD2CKXeKdBrfIAK5OMFJO8BeQguSzNhkQVFQrjyH4inrNBwtsl8XnUKd+lIWc1pUqosdsXCdcUTiLU3lfwp9VANjK0E/f9B5qfQJiCuESsr2AwO+e2zy9wLCWdsvzEYIpPPKBRlMo/2P7qIxVYWOuWyN7SUrGsDMx+XySr5D8ZlIIdBIx19rI8CMMdIOc0X7GShhVHkiAh0ONq9V81EE7s5cA== 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:(4636009)(136003)(376002)(346002)(396003)(366004)(39850400004)(478600001)(44832011)(52116002)(4326008)(33964004)(235185007)(6916009)(38350700002)(8936002)(38100700002)(2906002)(86362001)(186003)(5660300002)(956004)(8676002)(2616005)(66616009)(6666004)(36756003)(316002)(66556008)(66476007)(55016002)(7696005)(66946007)(44144004)(8886007)(26005)(4216001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GreIqfqB3LOqVaJd32E0kMQ1gQHt?= =?utf-8?q?99b7PdytgJMTeUibRhRNxoC9uGCp5GY9uhHlQi+rh93Sm+b+XFUZjJL0KxAVwyPAp?= =?utf-8?q?GkdgJZCZQ0+4GV2DLmw8GauPxXgYjTTY7CHpocZsgmLuVvJS00ahtuGfXdR76aJUW?= =?utf-8?q?G1PFQBDgXhL29YXQ8NJ8ZMjdqYaSil7ex3S2UCWr6e/ABa+OpCF//t/iIqfmOkvXm?= =?utf-8?q?0obHrX9WEwrBrC9Xi/SUP+BMW5nN7Xeq3nq30EjfQNDxHwXBKuIVgpqAeAMxd6g4F?= =?utf-8?q?FDOkB2c6OD9nRs9mTLtZcWbVEjyNl8mNYQVt8SwqLZtLKbjwM2GMqFen7BiGWzkr2?= =?utf-8?q?LFZGUWQqUECIp0oCp1825NZH4BaF0zSJVbPev2c+On477p9DRMQLTf1g5PCZEGXw7?= =?utf-8?q?fEVjPbeheqNIBIH/og8WtbD88rSmRP6NCagF6GpeONC2EbwUy6FNJi9ndncA6sBK+?= =?utf-8?q?VXWzecW09TweVkUskEkhE9mH9D+uRoi/od52pVszwTHHdPaWsRxue3+dpsxOoXL8I?= =?utf-8?q?cz7GEeRVeNRKfz+G8ejimJPal+iKbqwG6T1O7+/fEd9eD+w/tjYOzmnYrU47m3l8V?= =?utf-8?q?9v1QiW0wv7m1ya5KQ3WJeK+vqd3RMdW8ePlz0DQ/9VvPseQPAF6PjL3WPt36vCSc4?= =?utf-8?q?1h7/VCX2Q084yVBmu2X1yRCWFPqz7R+kLCFmT9dXsqQ9n6VSIK5kSLu/9gAeNWR26?= =?utf-8?q?aYmu93Jin+DHgY93uUttma4WKYboeIuHP6xzhIY7+Aaeyu2ISQ5wZ6irylKX9B1Ra?= =?utf-8?q?5Ot3y5F5s5mQIzgnnlemkGWtlPTvkRLyh86uGIDTE4+gar3iO7QtgbTFkgOaPfs9v?= =?utf-8?q?HdDxpZ+ypVj+5rDgGWF2T5lrOSIVgKB1SOAz3uo+51j7C8zrCSzOGB2E5BieqhT1n?= =?utf-8?q?d8CKpCy5x9qRgGCgY+8TwyeoO9B8+2mIrJYjxwqSY0eGI5yECH/H/BBaiuAovLR5v?= =?utf-8?q?szDOKLLCOYkCbA9RrB9aKDE/i9KhS91d5YbDjcEQya70O5Xrzjy1sJPGEGlqKOTXv?= =?utf-8?q?XA11xvNqd/VD8GPETQltoxidc3Z0Y27lf4RMwjweUl7/mpAeuaQcHhQcGJnbX8ut1?= =?utf-8?q?S86JhbFs/QuQdquxN7pDNJ127M5EdY/a5+4dkyQxmnXCwqqtcj+FBgi3BtMvemy51?= =?utf-8?q?5UYiv9+4rYWlosxaGkXrvZKj1F6x4Tr7DovpCfe/f/4N8QdD97Q/W2wccoiuEjBId?= =?utf-8?q?VbeAPPdqCt0XHeKobsGjv44y7XTuaMlGfJcehJqoKoydgzS79B/wmyJpXFZWMP+51?= =?utf-8?q?vbbDrDt/hguu5IT2?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3440 Original-Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 960fc36b-277a-4eb5-5b43-08d96c82fcc9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: teTr7jZsoai25/W1mH+P0McXqENPQAiEzCpiB13k3pkf7PoKDSstk4cyjCC68U7M/ByE9fT5RMe8Lj8RKk55m4MhAQ4dVpRn6sRiLxjtFNXSuEe4tcIFDzBW+OWgD6b39qHLK4C1icJfFBJTIe+thrt46TLcxdXIbB8s3XY6Ml9bmGaErrt1SFc29cG9JmPlxHaKYfm9gmZ06cbr4Q01D9ySPJ8mMAUGsEpzFV8rlxCNxd9czxpLRWi+oUN7EDvOTyKsSJPFQZovS8t0IeihCcdygCz7ZBFGJL71AqJD+fZ884qNRk/kApUK78DwEzqaa1X3AwHp83qHZD+Bx82ToQ/Vserl5NQ8av0eUfekcEG2qMVLF0epAxmaaTzDSdXVfLG7o36nXikoaco45CD7WLqPyAlDoxBdeSJiqAj6fTBnfyFXEsNgTedyGgIgKthvdgQUTXPFoyBe4Ly1eViVL/S8RR3Mc+VWewVfIMv8rVFLwqHnlIrySmkenTQfNH4a4RU2bNKw8IxZtBYkUH0Add/a7QjlKKDvqwzCYYVKR2rk+zgn4DWyjgmK4z9eWciwRokJhf+QWW04FsUfJASEAj0vQk5SdgEBU+07YtvkILOTrJjQH5m6fjwkRgNzyt1D0iC9n1f8zKhHxt1/u8Du+JrcfYFWpZBrGcLlY1VMecH17qsJ7CCOS9yNFUG+bCVmtplnl7ghGNjDBMrzf3E25A2JigrpRLGkWRZgfhstXm/pdyBW3bwE5C2zgvriM3ax 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:(4636009)(39860400002)(346002)(376002)(136003)(396003)(46966006)(36840700001)(82740400003)(6666004)(478600001)(36860700001)(2616005)(956004)(86362001)(4326008)(8676002)(235185007)(82310400003)(2906002)(5660300002)(186003)(8936002)(36756003)(55016002)(6916009)(8886007)(44832011)(356005)(316002)(70586007)(81166007)(70206006)(336012)(44144004)(47076005)(66616009)(7696005)(33964004)(26005)(4216001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2021 13:26:58.8295 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28dfc4c8-6875-4a06-2391-08d96c83028d 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: AM5EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3046 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, 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@arm.com, nd@arm.com, richard.sandiford@arm.com, Marcus.Shawcroft@arm.com Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi All, Consider the following case #include uint64_t test4 (uint8x16_t input) { uint8x16_t bool_input = vshrq_n_u8(input, 7); poly64x2_t mask = vdupq_n_p64(0x0102040810204080UL); poly64_t prodL = vmull_p64((poly64_t)vgetq_lane_p64((poly64x2_t)bool_input, 0), vgetq_lane_p64(mask, 0)); poly64_t prodH = vmull_high_p64((poly64x2_t)bool_input, mask); uint8x8_t res = vtrn2_u8((uint8x8_t)prodL, (uint8x8_t)prodH); return vget_lane_u16((uint16x4_t)res, 3); } which generates (after my CSE patches): test4: ushr v0.16b, v0.16b, 7 mov x0, 16512 movk x0, 0x1020, lsl 16 movk x0, 0x408, lsl 32 movk x0, 0x102, lsl 48 fmov d1, x0 pmull v2.1q, v0.1d, v1.1d dup v1.2d, v1.d[0] pmull2 v0.1q, v0.2d, v1.2d trn2 v2.8b, v2.8b, v0.8b umov w0, v2.h[3] re which is suboptimal since the constant is never needed on the genreg side and should have been materialized on the SIMD side since the constant is so big that it requires 5 instruction to create otherwise. 4 mov/movk and one fmov. The problem is that the choice of on which side to materialize the constant can only be done during reload. We may need an extra register (to hold the addressing) and so can't be done after reload. I have tried to support this with a pattern during reload, but the problem is I can't seem to find a way to tell reload it should spill a constant under condition x. Instead I tried with a split which reload selects when the condition hold. This has a couple of issues: 1. The pattern can be expanded late (could be fixed with !reload_completed). 2. Because it's split so late we can't seem to be able to share the anchors for the ADRP. 3. Because it's split so late and basically reload doesn't know about the spill and so the ADD lo12 isn't pushed into the addressing mode of the LDR. I don't know how to properly fix these since I think the only way is for reload to do the spill properly itself, but in this case not having the patter makes it avoid the mem pattern and pick r <- n instead followed by r -> w. Thanks, Tamar gcc/ChangeLog: * config/aarch64/aarch64.md (*movdi_aarch6): Add Dx -> W. * config/aarch64/constraints.md (Dx): New. --- inline copy of patch -- diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index eb8ccd4b97bbd4f0c3ff5791e48cfcfb42ec6c2e..a18886cb65c86daa16baa1691b1718f2d3a1be6c 100644 diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index eb8ccd4b97bbd4f0c3ff5791e48cfcfb42ec6c2e..a18886cb65c86daa16baa1691b1718f2d3a1be6c 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -1298,8 +1298,8 @@ (define_insn_and_split "*movsi_aarch64" ) (define_insn_and_split "*movdi_aarch64" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,k,r,r,r,r,r, r,w, m,m, r, r, w,r,w, w") - (match_operand:DI 1 "aarch64_mov_operand" " r,r,k,N,M,n,Usv,m,m,rZ,w,Usa,Ush,rZ,w,w,Dd"))] + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,k,r,r,r,r,w ,r ,r,w, m,m, r, r, w,r,w,w") + (match_operand:DI 1 "aarch64_mov_operand" " r,r,k,N,M,n,Dx,Usv,m,m,rZ,w,Usa,Ush,rZ,w,w,Dd"))] "(register_operand (operands[0], DImode) || aarch64_reg_or_zero (operands[1], DImode))" "@ @@ -1309,6 +1309,7 @@ (define_insn_and_split "*movdi_aarch64" mov\\t%x0, %1 mov\\t%w0, %1 # + # * return aarch64_output_sve_cnt_immediate (\"cnt\", \"%x0\", operands[1]); ldr\\t%x0, %1 ldr\\t%d0, %1 @@ -1321,17 +1322,27 @@ (define_insn_and_split "*movdi_aarch64" fmov\\t%d0, %d1 * return aarch64_output_scalar_simd_mov_immediate (operands[1], DImode);" "(CONST_INT_P (operands[1]) && !aarch64_move_imm (INTVAL (operands[1]), DImode)) - && REG_P (operands[0]) && GP_REGNUM_P (REGNO (operands[0]))" + && REG_P (operands[0]) + && (GP_REGNUM_P (REGNO (operands[0])) + || (can_create_pseudo_p () + && !aarch64_can_const_movi_rtx_p (operands[1], DImode)))" [(const_int 0)] "{ - aarch64_expand_mov_immediate (operands[0], operands[1]); + if (GP_REGNUM_P (REGNO (operands[0]))) + aarch64_expand_mov_immediate (operands[0], operands[1]); + else + { + rtx mem = force_const_mem (DImode, operands[1]); + gcc_assert (mem); + emit_move_insn (operands[0], mem); + } DONE; }" ;; The "mov_imm" type for CNTD is just a placeholder. - [(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,mov_imm,mov_imm,mov_imm, + [(set_attr "type" "mov_reg,mov_reg,mov_reg,mov_imm,mov_imm,mov_imm,mov_imm,mov_imm, load_8,load_8,store_8,store_8,adr,adr,f_mcr,f_mrc,fmov, neon_move") - (set_attr "arch" "*,*,*,*,*,*,sve,*,fp,*,fp,*,*,fp,fp,fp,simd")] + (set_attr "arch" "*,*,*,*,*,*,simd,sve,*,fp,*,fp,*,*,fp,fp,fp,simd")] ) (define_insn "insv_imm" diff --git a/gcc/config/aarch64/constraints.md b/gcc/config/aarch64/constraints.md index 3b49b452119c49320020fa9183314d9a25b92491..422d95b50a8e9608b57f0f39745c89d58ea1e8a4 100644 --- a/gcc/config/aarch64/constraints.md +++ b/gcc/config/aarch64/constraints.md @@ -474,6 +474,14 @@ (define_address_constraint "Dp" An address valid for a prefetch instruction." (match_test "aarch64_address_valid_for_prefetch_p (op, true)")) +(define_constraint "Dx" + "@internal + A constraint that matches an integer immediate operand not valid\ + for AdvSIMD scalar operations in DImode." + (and (match_code "const_int") + (match_test "!aarch64_can_const_movi_rtx_p (op, DImode)") + (match_test "!aarch64_move_imm (INTVAL (op), DImode)"))) + (define_constraint "vgb" "@internal A constraint that matches an immediate offset valid for SVE LD1B