From patchwork Mon Oct 31 11:54: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: 1697135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.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=qoWIeBL7; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N1BR54z59z23l6 for ; Mon, 31 Oct 2022 22:54:57 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8FAE83853818 for ; Mon, 31 Oct 2022 11:54:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8FAE83853818 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667217294; bh=0DZXhWtWLz6oeqsbOq7rX7eKDrBDnhSGo4rXas+z8zc=; h=Date:To:Subject:In-Reply-To:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=qoWIeBL72YCvU4yELKLkmEkPjZuyKmmEMQctEkDmRRvF1QM05939JGkaXcdG+aCWJ nb5lPVooCp4/vKxE1kp6sR5CZ74NtIxmW8VWblUXRaw2D+tUb082qio/uAFUIoJ0H6 zJi1lBM1i3nGkAgvFNvK1btDXxv9I9/NYJe7n7bs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60089.outbound.protection.outlook.com [40.107.6.89]) by sourceware.org (Postfix) with ESMTPS id BA3F6385DC14 for ; Mon, 31 Oct 2022 11:54:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BA3F6385DC14 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=cCgbjO/EkZxeagA+qNwJMGt0tXuXdg4G2xKnQ6LYvHUXkr7wwP2VMLslRs+a49s/IzGqzQskbz0imr3kCwuLiaPhSgXrH+7kMev94igFNQNY+gcchZMZ2CQL+AQLu1RsPvxN1QyUqj2vLotnyt1XAb809KOEHVIEPwAwS4MPURLOsImwnrK9+vDCgm32xyreccDz4OtClmYXR1+1rBmbgU8yAU8jkYyxVdySxV5g3Iarc9BzaJZXCHTG6W7ivx4uozAwGjsaqZ0eVO6o7BWdwlz3q9eRpxkvIEVX1YiXrUc+7/Rdie4LYRzBRkwdC8rUZsr4ZWz0HblMr5y1sNGnVw== ARC-Message-Signature: i=2; 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=0DZXhWtWLz6oeqsbOq7rX7eKDrBDnhSGo4rXas+z8zc=; b=Lxs04TM6ssHUB7ldhQqdION6YJK8X9MKNnevVyiWiAeP/+dgvqZbp8ETX5ZVVWLCrtXEy6Nt5s5aSBqC33BQ2okUN0AvE1Af+QViZL3wU/gje8TLiRRmE99DAjuBXSymSfV6P7zeeM08vIU3HDlgwl9pPMs1BW6ILwfEb/6EI7ijQbV/uikKZoLGlOi/BOvsNDqeDh8dd7YTS3fdVlT2fW8KzvIDMvLTjBgE2UDnMWEkzS0iILNq2FCZoP1d/opDwElxZGS1NlLKWVJNlAnGTj6WrgYphj2DbunYYSU8GMrHLYkwUQQyCYJ6NT/0Zjxp18pRCRBL/gvpgm6KS+OGpg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AM6PR02CA0019.eurprd02.prod.outlook.com (2603:10a6:20b:6e::32) by DB9PR08MB6539.eurprd08.prod.outlook.com (2603:10a6:10:23f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Mon, 31 Oct 2022 11:54:28 +0000 Received: from AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:6e:cafe::3e) by AM6PR02CA0019.outlook.office365.com (2603:10a6:20b:6e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Mon, 31 Oct 2022 11:54:28 +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 AM7EUR03FT031.mail.protection.outlook.com (100.127.140.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Mon, 31 Oct 2022 11:54:28 +0000 Received: ("Tessian outbound aeae1c7b66fd:v130"); Mon, 31 Oct 2022 11:54:28 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f959b7e44b32e290 X-CR-MTA-TID: 64aa7808 Received: from b56c495944c1.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E1451EE1-FEDC-40CC-A674-68CBEDE42C6B.1; Mon, 31 Oct 2022 11:54:16 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b56c495944c1.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 31 Oct 2022 11:54:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IbEcDUMB72bHWPFZkTZvwQF49Bo1Y1FLbIEOIbeC2bIkv8dfesZABqcQhzHqvWTowihlBgewEWFgB3Kv9H7ZmTEkOPr+CXymS+TU0ldKraMxV03sbfSlxPWZ41P3laPWQWfRGVQa1euhmzIiYLfvrogBOJnc4XJ1Z1ZBZ/1c8q1sXf68I6TB0otnTHUaPvUd1+4lEW0S5Cg/MQdExmQDrcdkPAc1cWHzWPHjUD0Co2/LnfHTirm/tupvDbsFdPHl9fjc6SglV6ht0aTpQZ3uPrZTqTO4T7/zN8uPjkU0UD7d7OJODxqRE6687daUMgDKAjWHPn/6EK+MSqDwzYQBfQ== 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=0DZXhWtWLz6oeqsbOq7rX7eKDrBDnhSGo4rXas+z8zc=; b=CjQdoMRGOpaDQbqmPMub6T3LxRWgqbSRKR4UL+5uxOKuyYlwj5Nm18IgC9hqBmy4ips9ufr5Ff6k14d2ecfn8rBflKqwubVfIrConkwgkZvc5+HItrRew5t+Qklq0xgHVaf/0Ui3Np6/rE64FpbefnfPxWbedWP1mmyC/M9bzZlm5a3IfZ9wVw52uzd4BAy237WXmCpwmQdQ+DHkeMKw7zdAXt1I3GW1OHhvAB6oqE088vQ0uh54e205pIFcvdRibHVYGczVtDBt0jortcN+pC74ZcB6AcIo3e0l8EWhIInvrcymKYS/tfElEHkDzMWuXRIauNoiRiqhA+urfZ88Pw== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by DB9PR08MB8385.eurprd08.prod.outlook.com (2603:10a6:10:3da::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.16; Mon, 31 Oct 2022 11:54:14 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::c57d:50c2:3502:a52]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::c57d:50c2:3502:a52%4]) with mapi id 15.20.5769.019; Mon, 31 Oct 2022 11:54:14 +0000 Date: Mon, 31 Oct 2022 11:54:11 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH]AArch64 Extend umov and sbfx patterns. Message-ID: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO2P265CA0364.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::16) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|DB9PR08MB8385:EE_|AM7EUR03FT031:EE_|DB9PR08MB6539:EE_ X-MS-Office365-Filtering-Correlation-Id: 8239f00f-f02a-44cd-58c6-08dabb36aa2b 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: OEPAKPFkNEmuY72AJ6JT0nLJr42n0uu2duMcmuHMpMS976iuO7WS0GpPl2FdJvE6aQa5VmlfcHyKS8LoHYLqTFta+mhibxqxTa+b2ovrZrf6hLW8Wx0VtM4CZYiLvbRsQMww3bUAR2pV48MYZNf47f0wOxD7sFuiPSsFOCLDl31CyALzClRuabAqqEMSKP3WcyqkeM0izrAsfVj5iE96Jp4R5/X79WGndgsx5LIM6bhoqhpSWiN1vvgXzcxD5Se60Nlp7umazaXHfLYqene/7X4sk0fOAlQbN2up9PgNf/58AjVJ8cghx0cusAhyMZ+ehyOXoaqLJCfPyA0pwCpU7mIyaYc7Ay1+MFcXBh9DgE0xdOUCP2JktJVtgIMd6nKaj5WxuGZQgX9GLjR3TNZtQy6IkRSyXaRBXHbbmnGNT/m1K1k0HM7Tp02cau7TN5wjDvmDfQIwXZoUClt7CWstE2hYsYgLxVfACCo0wPPLvwGfvMUSNSjLWjuK5D6j/QHRHcV69KowNH10jrZvJ7srnEizWcSq6OFD3KpBSeOZ4whNTi7YJ0paaWYfICx2jvLJQ7wIUElyXg9WXRlqViDMYM+UiDppIuyfC4dXYMXMUZSfXkSD/rO7wA/DTpjwpHPtdofflvqmlmhgCIUYPW7wuHXVnGDJroBd8UNdhNJFCDyP5mDy3TOE4k2bCDOZ3O9ECWqHx472eyKIyIhmZDfL+VIfvdc88E1jA73A1LbBvxP/4AKeTKMnLbQxViRD8aBz9xVpaCspmspUJv+ZGElCBSenzsS4UXpnn7FfuE4kPCP5VxsRG1/AeckVG0hMq4Gosx3fVK26jOmMNy9OfnpGMXol/38KqGHqGAXnZGlc2Wk= 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:(13230022)(4636009)(346002)(366004)(136003)(396003)(39860400002)(376002)(451199015)(36756003)(84970400001)(38100700002)(5660300002)(44832011)(2906002)(235185007)(186003)(83380400001)(86362001)(4326008)(6916009)(2616005)(478600001)(6666004)(8676002)(316002)(6486002)(66476007)(66556008)(66946007)(41300700001)(8936002)(26005)(33964004)(6512007)(44144004)(6506007)(67856001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8385 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: AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 2f039725-34db-4dec-78fe-08dabb36a179 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZPz3IKTB1fnJpMyv18mt+bJm96GUVkEAUGA2Gz1KYcUKXKk20l37pr6trYM4r0adUeHqAdfta3x41oharhUaaStQCqS1LPiYCRD/5odYFs0bO2RhnbJU6INAIL5wiDk/Ds9jEQT5Y1urU9FP07LVkVFHVeyuMW93RIWQhCP8UlnEYnJBQZhA64PWEwdPS8PDe4yZEcUpcfzTmlnFnaRMpQbkV/jwhwnGRtdzaEnIPafQA9wzkN8tQaNcmhp+7I4/NBjf3K+4QOgFmmRLSbfED3CaWxzKAkQEdI+FQZ+U5wjFuXbcpE+FRk2SwFF1DAzZkESZRmfV0d/q7+5Ra6OrJ3r9mVJmFRRLavNQ0FDcTyetiWzy7q+dQ7+g6eQtDBbC0Zfj5aeEnSwowgznL4llz/PucKpKx1rienSyxz6RCOCMH+RR5nvsdRFipeU0/4ehqzFNeI+F1T76oPhQhl+gP5r7IBsnbrE/EonZK1z/MIfTxsNaf5CM5ErNg+3OH3DBxPamGGXyI89SKBOPGdEqOMSXRvpg/NVS1Dm7mCApk11bNgo1BwBEyQ1HlINAGTVpa/UJq5tOweosMsWkHp5c1u1WY10bWoq/41Zz+vqKhmmHF18n4ZnNplwMYIZrFmZeE67TbBaGV/OtOR7DrXIK4Wvx5GPZh2LODU+PYWXSu4kMtwd9lWeKNlukTY30xSLvxjeTBqGv0iiSHdVPZlQPXfBVWWOFNU4GFXcpXNQL5LuHDC6AedHQSDrmHHPObng5+h04PkWAi9+AEnQY9+D+bkkU/pSY9fLJQlfgRDGfeyjPqoUi+7WxCTsf5CRQ+6JjJ+hirfDChNQT/2zpetl1hkGReoY1MZGj4SlMBiR2cIAKAIQj7qICqgboNKloEm3SQCdt0Hrc//fwDN6ylXu+Rg== 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:(13230022)(4636009)(376002)(39860400002)(346002)(396003)(136003)(451199015)(46966006)(40470700004)(36840700001)(478600001)(44144004)(33964004)(6512007)(6506007)(2616005)(6666004)(186003)(36860700001)(47076005)(336012)(83380400001)(26005)(44832011)(2906002)(40480700001)(40460700003)(82310400005)(6916009)(316002)(41300700001)(70206006)(6486002)(235185007)(8936002)(70586007)(5660300002)(4326008)(8676002)(86362001)(36756003)(82740400003)(356005)(81166007)(84970400001)(2700100001)(67856001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2022 11:54:28.3317 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8239f00f-f02a-44cd-58c6-08dabb36aa2b 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: AM7EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6539 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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, Our zero and sign extend and extract patterns are currently very limited and only work for the original register size of the instructions. i.e. limited by GPI patterns. However these instructions extract bits and extend. This means that any register size can be used as an input as long as the extraction makes logical sense. The majority of the attached testcases fail currently to optimize. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * config/aarch64/aarch64-simd.md (aarch64_get_lane): Drop reload penalty. * config/aarch64/aarch64.md (*_ashl): Renamed to... (*_ashl): ...this. (*zero_extend_lshr): Renamed to... (*zero_extend_): ...this. (*extend_ashr): Rename to... (*extend_): ...this. gcc/testsuite/ChangeLog: * gcc.target/aarch64/bitmove_1.c: New test. * gcc.target/aarch64/bitmove_2.c: New test. --- inline copy of patch -- diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 8bcc9e76b1cad4a2591fb176175db72d7a190d57..23909c62638b49722568da4555b33c71fd21337e 100644 --- diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 8bcc9e76b1cad4a2591fb176175db72d7a190d57..23909c62638b49722568da4555b33c71fd21337e 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -4259,7 +4259,7 @@ (define_insn "*aarch64_get_lane_zero_extend" ;; Extracting lane zero is split into a simple move when it is between SIMD ;; registers or a store. (define_insn_and_split "aarch64_get_lane" - [(set (match_operand: 0 "aarch64_simd_nonimmediate_operand" "=?r, w, Utv") + [(set (match_operand: 0 "aarch64_simd_nonimmediate_operand" "=r, w, Utv") (vec_select: (match_operand:VALL_F16_FULL 1 "register_operand" "w, w, w") (parallel [(match_operand:SI 2 "immediate_operand" "i, i, i")])))] diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 85b400489cb382a01b0c469eff2b600a93805e31..3116feda4fe54e2a21dc3f990b6976d216874260 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -5629,13 +5629,13 @@ (define_insn "*si3_insn2_uxtw" ) (define_insn "*3_insn" - [(set (match_operand:SHORT 0 "register_operand" "=r") - (ASHIFT:SHORT (match_operand:SHORT 1 "register_operand" "r") + [(set (match_operand:ALLI 0 "register_operand" "=r") + (ASHIFT:ALLI (match_operand:ALLI 1 "register_operand" "r") (match_operand 2 "const_int_operand" "n")))] "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" { operands[3] = GEN_INT ( - UINTVAL (operands[2])); - return "\t%w0, %w1, %2, %3"; + return "\t%0, %1, %2, %3"; } [(set_attr "type" "bfx")] ) @@ -5710,40 +5710,40 @@ (define_insn "*extrsi5_insn_di" [(set_attr "type" "rotate_imm")] ) -(define_insn "*_ashl" +(define_insn "*_ashl" [(set (match_operand:GPI 0 "register_operand" "=r") (ANY_EXTEND:GPI - (ashift:SHORT (match_operand:SHORT 1 "register_operand" "r") + (ashift:ALLX (match_operand:ALLX 1 "register_operand" "r") (match_operand 2 "const_int_operand" "n"))))] - "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" + "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" { - operands[3] = GEN_INT ( - UINTVAL (operands[2])); + operands[3] = GEN_INT ( - UINTVAL (operands[2])); return "bfiz\t%0, %1, %2, %3"; } [(set_attr "type" "bfx")] ) -(define_insn "*zero_extend_lshr" +(define_insn "*zero_extend_" [(set (match_operand:GPI 0 "register_operand" "=r") (zero_extend:GPI - (lshiftrt:SHORT (match_operand:SHORT 1 "register_operand" "r") - (match_operand 2 "const_int_operand" "n"))))] - "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" + (LSHIFTRT_ONLY:ALLX (match_operand:ALLX 1 "register_operand" "r") + (match_operand 2 "const_int_operand" "n"))))] + "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" { - operands[3] = GEN_INT ( - UINTVAL (operands[2])); + operands[3] = GEN_INT ( - UINTVAL (operands[2])); return "ubfx\t%0, %1, %2, %3"; } [(set_attr "type" "bfx")] ) -(define_insn "*extend_ashr" +(define_insn "*extend_" [(set (match_operand:GPI 0 "register_operand" "=r") (sign_extend:GPI - (ashiftrt:SHORT (match_operand:SHORT 1 "register_operand" "r") - (match_operand 2 "const_int_operand" "n"))))] - "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" + (ASHIFTRT_ONLY:ALLX (match_operand:ALLX 1 "register_operand" "r") + (match_operand 2 "const_int_operand" "n"))))] + "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" { - operands[3] = GEN_INT ( - UINTVAL (operands[2])); + operands[3] = GEN_INT ( - UINTVAL (operands[2])); return "sbfx\\t%0, %1, %2, %3"; } [(set_attr "type" "bfx")] diff --git a/gcc/testsuite/gcc.target/aarch64/bitmove_1.c b/gcc/testsuite/gcc.target/aarch64/bitmove_1.c new file mode 100644 index 0000000000000000000000000000000000000000..8b0aa8af49cd070928bacc4995a321c7bfde58a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/bitmove_1.c @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3 -std=c99" } */ +/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ + +#include + +/* +** sfoo6: +** asr x0, x0, 16 +** ret +*/ +int64_t sfoo6 (int32_t x) +{ + return x >> 16; +} + +/* +** ufoo6: +** lsr w0, w0, 30 +** ret +*/ +uint64_t ufoo6 (uint32_t x) +{ + return x >> 30; +} + +/* +** ufoo6s: +** ubfx w0, w0, 7, 9 +** ret +*/ +uint32_t ufoo6s (uint16_t x) +{ + return x >> 7; +} + +/* +** ufoo6h: +** ubfx w0, w0, 4, 4 +** ret +*/ +uint16_t ufoo6h (uint8_t x) +{ + return x >> 4; +} + +/* +** sfoo62: +** asr x0, x0, 10 +** ret +*/ +int64_t sfoo62 (int32_t x) +{ + return x >> 10; +} + +/* +** ufoo62: +** lsr w0, w0, 10 +** ret +*/ +uint64_t ufoo62 (uint32_t x) +{ + return x >> 10; +} + +/* +** sfoo63: +** asr x0, x0, 10 +** ret +*/ +int64_t sfoo63 (int32_t x) +{ + return x >> 10; +} + diff --git a/gcc/testsuite/gcc.target/aarch64/bitmove_2.c b/gcc/testsuite/gcc.target/aarch64/bitmove_2.c new file mode 100644 index 0000000000000000000000000000000000000000..54b3071a3b4e2001f83337837e712c381683d23a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/bitmove_2.c @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3 -std=c99" } */ +/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ + +#include + +/* +** sfoo6: +** sbfiz x0, x0, 16, 16 +** ret +*/ +int64_t sfoo6 (int32_t x) +{ + return x << 16; +} + +/* +** ufoo6: +** lsl w0, w0, 30 +** ret +*/ +uint64_t ufoo6 (uint32_t x) +{ + return x << 30; +} + +/* +** ufoo6s: +** ubfiz w0, w0, 7, 16 +** ret +*/ +uint32_t ufoo6s (uint16_t x) +{ + return x << 7; +} + +/* +** ufoo6h: +** uxtb w0, w0 +** ubfiz w0, w0, 4, 12 +** ret +*/ +uint16_t ufoo6h (uint8_t x) +{ + return x << 4; +} + +/* +** sfoo62: +** sbfiz x0, x0, 10, 22 +** ret +*/ +int64_t sfoo62 (int32_t x) +{ + return x << 10; +} + +/* +** ufoo62: +** lsl w0, w0, 10 +** ret +*/ +uint64_t ufoo62 (uint32_t x) +{ + return x << 10; +} + +/* +** sfoo63: +** sbfiz x0, x0, 10, 22 +** ret +*/ +int64_t sfoo63 (int32_t x) +{ + return x << 10; +} --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -4259,7 +4259,7 @@ (define_insn "*aarch64_get_lane_zero_extend" ;; Extracting lane zero is split into a simple move when it is between SIMD ;; registers or a store. (define_insn_and_split "aarch64_get_lane" - [(set (match_operand: 0 "aarch64_simd_nonimmediate_operand" "=?r, w, Utv") + [(set (match_operand: 0 "aarch64_simd_nonimmediate_operand" "=r, w, Utv") (vec_select: (match_operand:VALL_F16_FULL 1 "register_operand" "w, w, w") (parallel [(match_operand:SI 2 "immediate_operand" "i, i, i")])))] diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 85b400489cb382a01b0c469eff2b600a93805e31..3116feda4fe54e2a21dc3f990b6976d216874260 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -5629,13 +5629,13 @@ (define_insn "*si3_insn2_uxtw" ) (define_insn "*3_insn" - [(set (match_operand:SHORT 0 "register_operand" "=r") - (ASHIFT:SHORT (match_operand:SHORT 1 "register_operand" "r") + [(set (match_operand:ALLI 0 "register_operand" "=r") + (ASHIFT:ALLI (match_operand:ALLI 1 "register_operand" "r") (match_operand 2 "const_int_operand" "n")))] "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" { operands[3] = GEN_INT ( - UINTVAL (operands[2])); - return "\t%w0, %w1, %2, %3"; + return "\t%0, %1, %2, %3"; } [(set_attr "type" "bfx")] ) @@ -5710,40 +5710,40 @@ (define_insn "*extrsi5_insn_di" [(set_attr "type" "rotate_imm")] ) -(define_insn "*_ashl" +(define_insn "*_ashl" [(set (match_operand:GPI 0 "register_operand" "=r") (ANY_EXTEND:GPI - (ashift:SHORT (match_operand:SHORT 1 "register_operand" "r") + (ashift:ALLX (match_operand:ALLX 1 "register_operand" "r") (match_operand 2 "const_int_operand" "n"))))] - "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" + "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" { - operands[3] = GEN_INT ( - UINTVAL (operands[2])); + operands[3] = GEN_INT ( - UINTVAL (operands[2])); return "bfiz\t%0, %1, %2, %3"; } [(set_attr "type" "bfx")] ) -(define_insn "*zero_extend_lshr" +(define_insn "*zero_extend_" [(set (match_operand:GPI 0 "register_operand" "=r") (zero_extend:GPI - (lshiftrt:SHORT (match_operand:SHORT 1 "register_operand" "r") - (match_operand 2 "const_int_operand" "n"))))] - "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" + (LSHIFTRT_ONLY:ALLX (match_operand:ALLX 1 "register_operand" "r") + (match_operand 2 "const_int_operand" "n"))))] + "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" { - operands[3] = GEN_INT ( - UINTVAL (operands[2])); + operands[3] = GEN_INT ( - UINTVAL (operands[2])); return "ubfx\t%0, %1, %2, %3"; } [(set_attr "type" "bfx")] ) -(define_insn "*extend_ashr" +(define_insn "*extend_" [(set (match_operand:GPI 0 "register_operand" "=r") (sign_extend:GPI - (ashiftrt:SHORT (match_operand:SHORT 1 "register_operand" "r") - (match_operand 2 "const_int_operand" "n"))))] - "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" + (ASHIFTRT_ONLY:ALLX (match_operand:ALLX 1 "register_operand" "r") + (match_operand 2 "const_int_operand" "n"))))] + "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" { - operands[3] = GEN_INT ( - UINTVAL (operands[2])); + operands[3] = GEN_INT ( - UINTVAL (operands[2])); return "sbfx\\t%0, %1, %2, %3"; } [(set_attr "type" "bfx")] diff --git a/gcc/testsuite/gcc.target/aarch64/bitmove_1.c b/gcc/testsuite/gcc.target/aarch64/bitmove_1.c new file mode 100644 index 0000000000000000000000000000000000000000..8b0aa8af49cd070928bacc4995a321c7bfde58a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/bitmove_1.c @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3 -std=c99" } */ +/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ + +#include + +/* +** sfoo6: +** asr x0, x0, 16 +** ret +*/ +int64_t sfoo6 (int32_t x) +{ + return x >> 16; +} + +/* +** ufoo6: +** lsr w0, w0, 30 +** ret +*/ +uint64_t ufoo6 (uint32_t x) +{ + return x >> 30; +} + +/* +** ufoo6s: +** ubfx w0, w0, 7, 9 +** ret +*/ +uint32_t ufoo6s (uint16_t x) +{ + return x >> 7; +} + +/* +** ufoo6h: +** ubfx w0, w0, 4, 4 +** ret +*/ +uint16_t ufoo6h (uint8_t x) +{ + return x >> 4; +} + +/* +** sfoo62: +** asr x0, x0, 10 +** ret +*/ +int64_t sfoo62 (int32_t x) +{ + return x >> 10; +} + +/* +** ufoo62: +** lsr w0, w0, 10 +** ret +*/ +uint64_t ufoo62 (uint32_t x) +{ + return x >> 10; +} + +/* +** sfoo63: +** asr x0, x0, 10 +** ret +*/ +int64_t sfoo63 (int32_t x) +{ + return x >> 10; +} + diff --git a/gcc/testsuite/gcc.target/aarch64/bitmove_2.c b/gcc/testsuite/gcc.target/aarch64/bitmove_2.c new file mode 100644 index 0000000000000000000000000000000000000000..54b3071a3b4e2001f83337837e712c381683d23a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/bitmove_2.c @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3 -std=c99" } */ +/* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ + +#include + +/* +** sfoo6: +** sbfiz x0, x0, 16, 16 +** ret +*/ +int64_t sfoo6 (int32_t x) +{ + return x << 16; +} + +/* +** ufoo6: +** lsl w0, w0, 30 +** ret +*/ +uint64_t ufoo6 (uint32_t x) +{ + return x << 30; +} + +/* +** ufoo6s: +** ubfiz w0, w0, 7, 16 +** ret +*/ +uint32_t ufoo6s (uint16_t x) +{ + return x << 7; +} + +/* +** ufoo6h: +** uxtb w0, w0 +** ubfiz w0, w0, 4, 12 +** ret +*/ +uint16_t ufoo6h (uint8_t x) +{ + return x << 4; +} + +/* +** sfoo62: +** sbfiz x0, x0, 10, 22 +** ret +*/ +int64_t sfoo62 (int32_t x) +{ + return x << 10; +} + +/* +** ufoo62: +** lsl w0, w0, 10 +** ret +*/ +uint64_t ufoo62 (uint32_t x) +{ + return x << 10; +} + +/* +** sfoo63: +** sbfiz x0, x0, 10, 22 +** ret +*/ +int64_t sfoo63 (int32_t x) +{ + return x << 10; +}