From patchwork Wed Dec 13 21:00:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1875875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=ThofO17Z; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=ThofO17Z; dkim-atps=neutral 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=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sr7FT1h3cz20LX for ; Thu, 14 Dec 2023 08:01:31 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DD258385C407 for ; Wed, 13 Dec 2023 21:01:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2040.outbound.protection.outlook.com [40.107.8.40]) by sourceware.org (Postfix) with ESMTPS id 37E933858003 for ; Wed, 13 Dec 2023 21:01:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37E933858003 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 37E933858003 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.8.40 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702501276; cv=pass; b=MUKsFJpTcDaT3dX+XTslvj0kfPuWQ23IyCJrmiBCMTuF7NP2Hx4hQ9l5qEYcYKe4C2z822YAsfadladdsVT/+XrJy+DGZEM178H6v3qFgG0T/oJSQrUZSIdwBJHwUV6G7vJLkGVfw60+8diSFWyXxY8XBFh9Xaf7kmEQ7+nzIy8= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702501276; c=relaxed/simple; bh=Zwz3FRYIYuHyebIpsWpbdLycqGV/FYvdhflwbYLmJiI=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=XxZPdUxI4RxvILlUnd8c6JfTml/yM+pER4bQyVjUGfLBeM8t+RFax0eQrRFk67YuSCbjPnoTW/Z3TvUg5DG/s2xMjWU2sTuRLj0amBgrvAqIgXOQnD1D5RgBOQrsenLvDAzzwBs5bOi2gtLi8IkR26A+WqXDrh1nDE836+DXAE4= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ghRLXXSt7/pX2hJOgLqXAJSUDtfo9xKrG0x+ZL214D40/pFGu+2pN4wv4cuTr0pslKVjvg9ciyDMQJCLuW6dvmLenG4NCBV8lskiiS1SGTS7Lx1fJoaGcQys24/2/aE9XfHlcNiiC2onUhealCVprUwNtZf+3Omkwd04I3r/lmTK/oSpI7eGA8WGFib6W9T8kcgSBfgegr63KuwuslPBSECx0Q6FTaUUh7X1eg399uv0Ao4XvyDVzh/MB0E1fINiO6riZfqUHq+oUrBPgogShcmsGya8Wkk6WhG/Q09cWb3q4q8NlbYF+Cw1YbxrQKTujRnl+cSKEgQxZELpl++erw== 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=Z/nUvqFHQ5vHw489/CBsnLwpt+Z8iZ2m4Yey0YFcCr0=; b=KjuFqV8eoaYNBg4n1y1kI05vhbC+Rzm8iBvcD7oQW+ga28mBpJee+jyQ2Ycw8aghzhoe144TQGKv7FqW25Meonw4cr9FoWTsVqNGvl7ci5hYJakZKbU1c98KNPDpo/rKAUd6WfMMeU+IU1tgAZe/hvx0OMI0zLJk9paED5tTxXcxxTNlqN53p3FGhW3/hu+irpB/dYBzT+PB876AePt94Ba5JGZ2Lh6neZ8NaQyCaCFN8w+saBxpTlNSzIcDZm9m8/wB8x1ViSow7bINBA5X2isHPFNdiXfGzF5vqiseJxWYsgViXBvGi06hmEkKda6O6DJzOOdTSeKxG/dbyLD7OA== 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]) 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=Z/nUvqFHQ5vHw489/CBsnLwpt+Z8iZ2m4Yey0YFcCr0=; b=ThofO17ZK6rW64tgMlKZuHCFGJN2bph8cq5sgLyOakuKP3uTImUPW4pIi4vs9L438B0NTlp/dDzbjYE0s0+MC+lqmsb93iJuiTaZOPbYwIlOZixsav9GU1EUjzkRb1xpkZ0k8yM/NFz2Bs5cQV52OquYotdWQRFS80UQqwK8nJg= Received: from DUZPR01CA0102.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::9) by AS8PR08MB9268.eurprd08.prod.outlook.com (2603:10a6:20b:5a4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 21:01:10 +0000 Received: from DU6PEPF00009524.eurprd02.prod.outlook.com (2603:10a6:10:4bb:cafe::a8) by DUZPR01CA0102.outlook.office365.com (2603:10a6:10:4bb::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 21:01:10 +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 DU6PEPF00009524.mail.protection.outlook.com (10.167.8.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 21:01:10 +0000 Received: ("Tessian outbound 20615a7e7970:v228"); Wed, 13 Dec 2023 21:01:10 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 02609eaa3d1e0827 X-CR-MTA-TID: 64aa7808 Received: from 4adc00b533dc.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6B62E49B-FFB7-4533-B9A8-9A70C5FE5392.1; Wed, 13 Dec 2023 21:01:03 +0000 Received: from EUR02-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4adc00b533dc.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Dec 2023 21:01:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gxxfHwZurV22kZzj23OJAZzcvcjoC8PRymchn46Beg2hvEJxoxefxIy9xUbA+H4Px4R6GUe4K9eVacAw5JlDN+k/42IIE4hIht6ztq+OJ/BzgigDRCuGsvrjtIj/HZZ/rqK1inTxU6xwMeW+2ERMgQb5K8xAUBnpyv4vyW+pBXpkzHlB+YQttCKPe7JP1+FQbSUtpqrs+uA8lCNylUSWAJFxpjKZYqA5jZAYiUbc9lKLUU0mr/A38AEAgnll85vNynBgw5kiQiSCAbgiU9DZYJP9zQmKzUeoqhDwwf2FTmRRxf1nSOpTFk9VGp3tJQOCYODTFDwh+IeIu/MZwiQdVQ== 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=Z/nUvqFHQ5vHw489/CBsnLwpt+Z8iZ2m4Yey0YFcCr0=; b=obpL9Ytc69wqnl+R/9TuL9hGY97Zi/SQauxaM8dfYf2dlkgJ8fgOEw8jdJjWqyCoIyhrtss5oj1HU6uN4+J0fsdSACRpsSgXdh+0Nj6vvVYkHpb1oMtBMfE14Cq+R1QY0o/M2haTgKutG95zqrKvB5RIAksUIRASxqVAmJx4TCIs8MjZGNPxsxx/sPiKAujGP3uH/PAxaIyJQV35ebPPTpB6gW+mL+cUxxHOTr084YGcGHzmiZ9iWL8kz3yuFiSTXGq1Zm2SA6yI7i2zjNE+zNckqSWqHaJQAiOV1R9FLIW8rlcpE364C93f8c77bTlIvOAr4wPHgXiY4KiyulRlJg== 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=Z/nUvqFHQ5vHw489/CBsnLwpt+Z8iZ2m4Yey0YFcCr0=; b=ThofO17ZK6rW64tgMlKZuHCFGJN2bph8cq5sgLyOakuKP3uTImUPW4pIi4vs9L438B0NTlp/dDzbjYE0s0+MC+lqmsb93iJuiTaZOPbYwIlOZixsav9GU1EUjzkRb1xpkZ0k8yM/NFz2Bs5cQV52OquYotdWQRFS80UQqwK8nJg= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) by DU0PR08MB9727.eurprd08.prod.outlook.com (2603:10a6:10:445::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 21:01:01 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::8512:cc10:24d4:1919]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::8512:cc10:24d4:1919%5]) with mapi id 15.20.7091.028; Wed, 13 Dec 2023 21:01:01 +0000 Date: Wed, 13 Dec 2023 21:00:57 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Vladimir Makarov , Richard Sandiford Subject: [PATCH 1/2] emit-rtl, lra: Move lra's emit_inc to emit-rtl.cc Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P123CA0013.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:150::18) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|DU0PR08MB9727:EE_|DU6PEPF00009524:EE_|AS8PR08MB9268:EE_ X-MS-Office365-Filtering-Correlation-Id: 64d1770e-4dec-4c9a-41d4-08dbfc1ea280 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: cVgEE/ajd7zNYrIwUanQ/7R6e9AA7cNqq58XrvJDDkzJXOzczDrHbufQg8kyVfoJnCj6gvS2VIQrfST5vqftWy2/Kiuk/8zmUhfXcGeSsDg8oCur0VdM+ZDXZxU6SZNznQVhstg6lC324lGUdYFfE9UTIgz7uBA4+RHnahF32+mhhRSR6aNQ7n/IoDVkRWXQ+lqh3ysMkviXYwEou0U9LzQSAFCRxG09xdhgGXC8rUzWZYfo21phoSfDVUINyNHyP2bvyc2+BNR62Fw/Zd707dMFyVSjfRGViI1LCL2pK/q3DMj44GKpIs9f1LMnxkUYCdApiupI909u1Jk6dauzgAgbwdm+Zip0sQoRaIYFsuC67txyJOfLuKFqsDkg/kSi1KIMfdi22IP4Jq0tjHrIYKLCgCcApTtEyjpSDe5kCcKxg6/PuPEEsYV/EzLujtOXaMFpfw7/WM5cEUX5M25SPa5ltW9K6ERlp4+RhnkOwsN+ORx50YIdJnEJWERCn6DgUtV2yVdBIt7HgehoYzgeFnPeOBPWIiw4Vp6XnyiBxl4fAtGBxzsrXvH/SuUwgMiKVy1DINf/ZSjvOa6S3nXTpmZNBKFYrcrSHKZ0eK8+8KF6HdUfbgraR9JmFx5njPLq X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8958.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(366004)(136003)(396003)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(26005)(2616005)(6512007)(6666004)(6506007)(86362001)(44832011)(66476007)(66556008)(6916009)(54906003)(316002)(66946007)(478600001)(21480400003)(6486002)(33964004)(44144004)(8936002)(8676002)(4326008)(38100700002)(235185007)(5660300002)(2906002)(36756003)(41300700001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9727 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: DU6PEPF00009524.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 33136797-d8f2-442e-0029-08dbfc1e9cb5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SCYq9MofHfGGD+WaKPfVKMTTmxmwSSM7cCiSUrD6JFUwORmqzBmTM5k2sBgrA0d1H7trJMCtBzb9zAEuswxruGIFeYkkzxRI4FLrZlEkzb5ezCgt08bmr/S53AcvKDascnBrNiLEqOUqqB9/aCelne+bOSvncvqWGBpsubH266jtKXnbiC4alqPLey+faw/V7cCXGcgR4jI5OPXDh7cJSiEBvLUVIWCRd00UrBMNTmSRFNKes6t4MZEpH/PgoTmLHgq8KEd/h7WQeaLsn56dS7CiMl1JT/3m/66Jh4H57IPDVvHrPk5XVJD1VWP2srG+gqZZNm+mHzV3EZtIC4rskHl0k6dwE0/ZF6vbzwJPRUTGyJPNdBjOYlEdEzhsFurc/MUneVwUhu4mVBdmHg4DNbnwuIt3xPVyghJsu1r3wKrxugWkcZkoWrANVth6MVVGrN052CebZ64Z0eiCriMVa118pPzb8hNOYN212+0xHFMusTiM1sOGt+l9YSz6xmpAT4rpcOgB3Nd4+mY4yLC9k14B5qJceqQlmB3FhIqUNsIBoc+7Lpf0OrNLZrFwlgi7TOvR9ewDLAL8/4XAFZ7DIqeoUvUhmaTkGFo9l2AKsnfGW+QrFH60Lxra/nllzNnxTmzXOVJCmc59fXm7TkjZju/Rc1nZ8tRJGX15xYRGrsH9Gi0h3tollV58kVcy3fIRi4eyCwTUXS3gW1viNjB0hQqTzjgWh+o6UoPBMG8WtNLAHDfPyuUaTuMOT3w3qhPFii5fWN9Lz/MUwsSIPIq/Kg== 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:(13230031)(4636009)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(82310400011)(36840700001)(46966006)(40470700004)(40480700001)(26005)(336012)(6506007)(2616005)(21480400003)(33964004)(40460700003)(356005)(82740400003)(36756003)(86362001)(81166007)(44144004)(47076005)(235185007)(5660300002)(4326008)(44832011)(6512007)(36860700001)(6666004)(70206006)(70586007)(316002)(6916009)(8676002)(6486002)(8936002)(54906003)(2906002)(41300700001)(478600001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 21:01:10.8433 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64d1770e-4dec-4c9a-41d4-08dbfc1ea280 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: DU6PEPF00009524.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9268 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, 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=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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, In PR112906 we ICE because we try to use force_reg to reload an auto-increment address, but force_reg can't do this. With the aim of fixing the PR by supporting reloading arbitrary addresses in pre-RA splitters, this patch generalizes lra-constraints.cc:emit_inc and makes it available to the rest of the compiler by moving the generalized version to emit-rtl.cc. We observe that the separate IN parameter to LRA's emit_inc is redundant, since the function is static and is only (statically) called once in lra-constraints.cc, with in == value. As such, we drop the IN parameter and simplify the code accordingly. We wrap the emit_inc code in a virtual class to allow LRA to override how reload pseudos are created, thereby preserving the existing LRA behaviour as much as possible. We then add a second (higher-level) routine to emit-rtl.cc, force_reload_address, which can reload arbitrary addresses. This uses the generalized emit_inc code to handle the RTX_AUTOINC case. The second patch in this series uses force_reload_address to fix PR112906. Since we intend to call address_reload_context::emit_autoinc from within splitters, and the code lifted from LRA calls recog, we have to avoid clobbering recog_data. We do this by introducing a new RAII class for saving/restoring recog_data on the stack. Bootstrapped/regtested on aarch64-linux-gnu, bootstrapped on x86_64-linux-gnu, OK for trunk? Thanks, Alex gcc/ChangeLog: PR target/112906 * emit-rtl.cc (address_reload_context::emit_autoinc): New. (force_reload_address): New. * emit-rtl.h (struct address_reload_context): Declare. (force_reload_address): Declare. * lra-constraints.cc (class lra_autoinc_reload_context): New. (emit_inc): Drop IN parameter, invoke code moved to emit-rtl.cc:address_reload_context::emit_autoinc. (curr_insn_transform): Drop redundant IN parameter in call to emit_inc. * recog.h (class recog_data_saver): New. diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc index 4a7e420e7c0..ce7b98bf006 100644 --- a/gcc/emit-rtl.cc +++ b/gcc/emit-rtl.cc @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "rtl-iter.h" #include "stor-layout.h" #include "opts.h" +#include "optabs.h" #include "predict.h" #include "rtx-vector-builder.h" #include "gimple.h" @@ -2576,6 +2577,140 @@ replace_equiv_address_nv (rtx memref, rtx addr, bool inplace) return change_address_1 (memref, VOIDmode, addr, 0, inplace); } + +/* Emit insns to reload VALUE into a new register. VALUE is an + auto-increment or auto-decrement RTX whose operand is a register or + memory location; so reloading involves incrementing that location. + + INC_AMOUNT is the number to increment or decrement by (always + positive and ignored for POST_MODIFY/PRE_MODIFY). + + Return a pseudo containing the result. */ +rtx +address_reload_context::emit_autoinc (rtx value, poly_int64 inc_amount) +{ + /* Since we're going to call recog, and might be called within recog, + we need to ensure we save and restore recog_data. */ + recog_data_saver recog_save; + + /* REG or MEM to be copied and incremented. */ + rtx incloc = XEXP (value, 0); + + const rtx_code code = GET_CODE (value); + const bool post_p + = code == POST_DEC || code == POST_INC || code == POST_MODIFY; + + bool plus_p = true; + rtx inc; + if (code == PRE_MODIFY || code == POST_MODIFY) + { + gcc_assert (GET_CODE (XEXP (value, 1)) == PLUS + || GET_CODE (XEXP (value, 1)) == MINUS); + gcc_assert (rtx_equal_p (XEXP (XEXP (value, 1), 0), XEXP (value, 0))); + plus_p = GET_CODE (XEXP (value, 1)) == PLUS; + inc = XEXP (XEXP (value, 1), 1); + } + else + { + if (code == PRE_DEC || code == POST_DEC) + inc_amount = -inc_amount; + + inc = gen_int_mode (inc_amount, GET_MODE (value)); + } + + rtx result; + if (!post_p && REG_P (incloc)) + result = incloc; + else + { + result = get_reload_reg (); + /* First copy the location to the result register. */ + emit_insn (gen_move_insn (result, incloc)); + } + + /* See if we can directly increment INCLOC. */ + rtx_insn *last = get_last_insn (); + rtx_insn *add_insn = emit_insn (plus_p + ? gen_add2_insn (incloc, inc) + : gen_sub2_insn (incloc, inc)); + const int icode = recog_memoized (add_insn); + if (icode >= 0) + { + if (!post_p && result != incloc) + emit_insn (gen_move_insn (result, incloc)); + return result; + } + delete_insns_since (last); + + /* If couldn't do the increment directly, must increment in RESULT. + The way we do this depends on whether this is pre- or + post-increment. For pre-increment, copy INCLOC to the reload + register, increment it there, then save back. */ + if (!post_p) + { + if (incloc != result) + emit_insn (gen_move_insn (result, incloc)); + if (plus_p) + emit_insn (gen_add2_insn (result, inc)); + else + emit_insn (gen_sub2_insn (result, inc)); + if (incloc != result) + emit_insn (gen_move_insn (incloc, result)); + } + else + { + /* Post-increment. + + Because this might be a jump insn or a compare, and because + RESULT may not be available after the insn in an input + reload, we must do the incrementing before the insn being + reloaded for. + + We have already copied INCLOC to RESULT. Increment the copy in + RESULT, save that back, then decrement RESULT so it has + the original value. */ + if (plus_p) + emit_insn (gen_add2_insn (result, inc)); + else + emit_insn (gen_sub2_insn (result, inc)); + emit_insn (gen_move_insn (incloc, result)); + /* Restore non-modified value for the result. We prefer this + way because it does not require an additional hard + register. */ + if (plus_p) + { + poly_int64 offset; + if (poly_int_rtx_p (inc, &offset)) + emit_insn (gen_add2_insn (result, + gen_int_mode (-offset, + GET_MODE (result)))); + else + emit_insn (gen_sub2_insn (result, inc)); + } + else + emit_insn (gen_add2_insn (result, inc)); + } + return result; +} + +/* Return a memory reference like MEM, but with the address reloaded into a + pseudo register. */ + +rtx +force_reload_address (rtx mem) +{ + rtx addr = XEXP (mem, 0); + if (GET_RTX_CLASS (GET_CODE (addr)) == RTX_AUTOINC) + { + const auto size = GET_MODE_SIZE (GET_MODE (mem)); + addr = address_reload_context ().emit_autoinc (addr, size); + } + else + addr = force_reg (Pmode, addr); + + return replace_equiv_address (mem, addr); +} + /* Return a memory reference like MEMREF, but with its mode widened to MODE and offset by OFFSET. This would be used by targets that e.g. cannot issue QImode memory operations and have to use SImode memory diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index c11a6f3eb62..0829851ed66 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -519,6 +519,28 @@ extern rtx adjust_address_1 (rtx, machine_mode, poly_int64, int, int, extern rtx adjust_automodify_address_1 (rtx, machine_mode, rtx, poly_int64, int); +/* Class wrapping emit_autoinc which allows derived classes to control + how reload pseudos are created. */ +struct address_reload_context +{ + /* Can be overriden by derived classes. */ + virtual rtx get_reload_reg () const { return gen_reg_rtx (Pmode); } + + /* Emit insns to reload VALUE into a new register. VALUE is an + auto-increment or auto-decrement RTX whose operand is a register or + memory location; so reloading involves incrementing that location. + + AMOUNT is the number to increment or decrement by (always + positive and ignored for POST_MODIFY/PRE_MODIFY). + + Return a pseudo containing the result. */ + rtx emit_autoinc (rtx value, poly_int64 amount); +}; + +/* Return a memory reference like MEM, but with the address reloaded into a + pseudo register. */ +extern rtx force_reload_address (rtx mem); + /* Return a memory reference like MEMREF, but whose address is changed by adding OFFSET, an RTX, to it. POW2 is the highest power of two factor known to be in OFFSET (possibly 1). */ diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index 177c765ca13..da7e1748d75 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -3951,133 +3951,36 @@ process_address (int nop, bool check_only_p, return res; } +/* Override the generic address_reload_context in order to + control the creation of reload pseudos. */ +class lra_autoinc_reload_context : public address_reload_context +{ + machine_mode mode; + enum reg_class rclass; + +public: + lra_autoinc_reload_context (machine_mode mode, enum reg_class new_rclass) + : mode (mode), rclass (new_rclass) {} + + rtx get_reload_reg () const override final + { + return lra_create_new_reg (mode, NULL_RTX, rclass, NULL, "INC/DEC result"); + } +}; + /* Emit insns to reload VALUE into a new register. VALUE is an auto-increment or auto-decrement RTX whose operand is a register or memory location; so reloading involves incrementing that location. - IN is either identical to VALUE, or some cheaper place to reload - value being incremented/decremented from. INC_AMOUNT is the number to increment or decrement by (always positive and ignored for POST_MODIFY/PRE_MODIFY). - Return pseudo containing the result. */ + Return a pseudo containing the result. */ static rtx -emit_inc (enum reg_class new_rclass, rtx in, rtx value, poly_int64 inc_amount) +emit_inc (enum reg_class new_rclass, rtx value, poly_int64 inc_amount) { - /* REG or MEM to be copied and incremented. */ - rtx incloc = XEXP (value, 0); - /* Nonzero if increment after copying. */ - int post = (GET_CODE (value) == POST_DEC || GET_CODE (value) == POST_INC - || GET_CODE (value) == POST_MODIFY); - rtx_insn *last; - rtx inc; - rtx_insn *add_insn; - int code; - rtx real_in = in == value ? incloc : in; - rtx result; - bool plus_p = true; - - if (GET_CODE (value) == PRE_MODIFY || GET_CODE (value) == POST_MODIFY) - { - lra_assert (GET_CODE (XEXP (value, 1)) == PLUS - || GET_CODE (XEXP (value, 1)) == MINUS); - lra_assert (rtx_equal_p (XEXP (XEXP (value, 1), 0), XEXP (value, 0))); - plus_p = GET_CODE (XEXP (value, 1)) == PLUS; - inc = XEXP (XEXP (value, 1), 1); - } - else - { - if (GET_CODE (value) == PRE_DEC || GET_CODE (value) == POST_DEC) - inc_amount = -inc_amount; - - inc = gen_int_mode (inc_amount, GET_MODE (value)); - } - - if (! post && REG_P (incloc)) - result = incloc; - else - result = lra_create_new_reg (GET_MODE (value), value, new_rclass, NULL, - "INC/DEC result"); - - if (real_in != result) - { - /* First copy the location to the result register. */ - lra_assert (REG_P (result)); - emit_insn (gen_move_insn (result, real_in)); - } - - /* We suppose that there are insns to add/sub with the constant - increment permitted in {PRE/POST)_{DEC/INC/MODIFY}. At least the - old reload worked with this assumption. If the assumption - becomes wrong, we should use approach in function - base_plus_disp_to_reg. */ - if (in == value) - { - /* See if we can directly increment INCLOC. */ - last = get_last_insn (); - add_insn = emit_insn (plus_p - ? gen_add2_insn (incloc, inc) - : gen_sub2_insn (incloc, inc)); - - code = recog_memoized (add_insn); - if (code >= 0) - { - if (! post && result != incloc) - emit_insn (gen_move_insn (result, incloc)); - return result; - } - delete_insns_since (last); - } - - /* If couldn't do the increment directly, must increment in RESULT. - The way we do this depends on whether this is pre- or - post-increment. For pre-increment, copy INCLOC to the reload - register, increment it there, then save back. */ - if (! post) - { - if (real_in != result) - emit_insn (gen_move_insn (result, real_in)); - if (plus_p) - emit_insn (gen_add2_insn (result, inc)); - else - emit_insn (gen_sub2_insn (result, inc)); - if (result != incloc) - emit_insn (gen_move_insn (incloc, result)); - } - else - { - /* Post-increment. - - Because this might be a jump insn or a compare, and because - RESULT may not be available after the insn in an input - reload, we must do the incrementing before the insn being - reloaded for. - - We have already copied IN to RESULT. Increment the copy in - RESULT, save that back, then decrement RESULT so it has - the original value. */ - if (plus_p) - emit_insn (gen_add2_insn (result, inc)); - else - emit_insn (gen_sub2_insn (result, inc)); - emit_insn (gen_move_insn (incloc, result)); - /* Restore non-modified value for the result. We prefer this - way because it does not require an additional hard - register. */ - if (plus_p) - { - poly_int64 offset; - if (poly_int_rtx_p (inc, &offset)) - emit_insn (gen_add2_insn (result, - gen_int_mode (-offset, - GET_MODE (result)))); - else - emit_insn (gen_sub2_insn (result, inc)); - } - else - emit_insn (gen_add2_insn (result, inc)); - } - return result; + lra_autoinc_reload_context context (GET_MODE (value), new_rclass); + return context.emit_autoinc (value, inc_amount); } /* Return true if the current move insn does not need processing as we @@ -4669,7 +4572,7 @@ curr_insn_transform (bool check_only_p) rclass = base_reg_class (GET_MODE (op), MEM_ADDR_SPACE (op), MEM, SCRATCH, curr_insn); if (GET_RTX_CLASS (code) == RTX_AUTOINC) - new_reg = emit_inc (rclass, *loc, *loc, + new_reg = emit_inc (rclass, *loc, /* This value does not matter for MODIFY. */ GET_MODE_SIZE (GET_MODE (op))); else if (get_reload_reg (OP_IN, Pmode, *loc, rclass, diff --git a/gcc/recog.h b/gcc/recog.h index 5c801e7bb81..bf0b809a44b 100644 --- a/gcc/recog.h +++ b/gcc/recog.h @@ -398,6 +398,16 @@ struct recog_data_d extern struct recog_data_d recog_data; +/* RAII class for saving/restoring recog_data. */ + +class recog_data_saver +{ + recog_data_d m_saved_data; +public: + recog_data_saver () : m_saved_data (recog_data) {} + ~recog_data_saver () { recog_data = m_saved_data; } +}; + #ifndef GENERATOR_FILE extern const operand_alternative *recog_op_alt; From patchwork Wed Dec 13 21:02:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1875876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=vSzaU7wO; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=vSzaU7wO; dkim-atps=neutral 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=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sr7Hm5rpqz20LX for ; Thu, 14 Dec 2023 08:03:32 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D2FE6385C306 for ; Wed, 13 Dec 2023 21:03:30 +0000 (GMT) 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-db3eur04on2042.outbound.protection.outlook.com [40.107.6.42]) by sourceware.org (Postfix) with ESMTPS id D509C385841F for ; Wed, 13 Dec 2023 21:03:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D509C385841F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D509C385841F Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.6.42 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702501400; cv=pass; b=NcERY3tuhMmYzBSjZkjrBQUDSfXLOyipPQINcpPfXOhfRfLy7kX7kC/H8xE1A6ib4rQavp5IopxvkrtKBNAP+MKQ7Di2BVyFZtlyqgCGmVXopKXl4LGi5+plhwbnDLn7yCjRk7RUqCBpHczsoN4+OMdcjUmVMLN1kt/DSrngR+c= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702501400; c=relaxed/simple; bh=0OCJ/GNVtsro2x+d3hE3LmIokmGfsiImMxJY84lcA6I=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=rc+TaXibWdOM81qiP/T534njEOM+cn8parFKUeZB//bsPg2tm2hYGU7Q+YASjpJPsQ0JKHL+CK85+OrLyikxk/3OIyI225GvBS6MnL8r8p1Hsc946AbEPeoC74apaX0NZ+shKJWmRpbB3khOeP0utp3grHjCtgnUnX5pwqVITtk= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=P54kjHctpY922E82G1FPL4OkrXs8iYPEwYblgPOWGoTiA+t9O5V13ITP6lyclpc2sfuXY63AsteVzBI/sR9tst6KiW4jO96QRbFH3SG33umuHH1kenq2gPlB2cwv8dqeHQszs2Ne8Lx755SjuUPI6ypW/8rGiesEuW16fbqe6ldPF6aBP5zqAlOlTZXhSZjoJk+nOIiFiYFRtp0DfwcU4D4fZG26UDZTHCM3usVrzK7b8TWhRbrcHwoIW+9/T7wtpNV6YYyWnMbMzvCqNh3KvsZX/wv0zEDGhvxkiJWcp61llcU4+d8Z1zvO6L8UDyCjy+Fyd6NSbXHer2UlO9QSAA== 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=NPTKpYUV/ZpqdTrZh05/OFhyIDSwZG0KuuR4j0cmIf8=; b=OBdIgcjPuxPQkNf1flKGf5TMsJDBY3LCxYvYQOVVSojNI2H41XOjIJRdDHeaQmO/WW3aE/8KKvb7Cd3S4XrjkdE0ly0b4kqTElzn80tvJzuH05slrmKrQI7u3x9kF5PD73k1w5GJsqdRj9pV4GfVrTjNF4zChOMqVtZYUbZUKbepui00M7aUXwZ2gf3NqI6M4L5TPBHwV/aayPGHjC+BHJ+VTUrEivgYSMTCkW5ruK1CKz02oxBwjkjQ54NqmBh4lhXIMFyzHKQg1yftxIeB1WhhI1YqEDTTGITk2ktGz8go3AUJTC1o7FKQXiGDeh467mGbky+7S2t3aK/W1Q20eQ== 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]) 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=NPTKpYUV/ZpqdTrZh05/OFhyIDSwZG0KuuR4j0cmIf8=; b=vSzaU7wOTPszQmxz27rpE4ho8sDXDHUuAYwgVvq6ONmveMFLhKwaVzHo9TYlWQ6hBaeejntlG59/4Dgq0JZTFc7PBdsaJM06YqfVabXyTt0Ie9uEGLIBSwodrR1KxvKL76wLa30vMIMcnGkEu++kdrVK5trFrnSQgQFqOwcY3JY= Received: from AM7PR02CA0024.eurprd02.prod.outlook.com (2603:10a6:20b:100::34) by DB5PR08MB10116.eurprd08.prod.outlook.com (2603:10a6:10:4a1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 21:03:03 +0000 Received: from AMS1EPF00000040.eurprd04.prod.outlook.com (2603:10a6:20b:100:cafe::20) by AM7PR02CA0024.outlook.office365.com (2603:10a6:20b:100::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.28 via Frontend Transport; Wed, 13 Dec 2023 21:03:03 +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 AMS1EPF00000040.mail.protection.outlook.com (10.167.16.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 21:03:03 +0000 Received: ("Tessian outbound 7671e7ddc218:v228"); Wed, 13 Dec 2023 21:03:03 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7859a34db2320fb3 X-CR-MTA-TID: 64aa7808 Received: from c5599212168e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 314B4845-D5E9-4F38-95E9-3040A212D558.1; Wed, 13 Dec 2023 21:02:56 +0000 Received: from EUR02-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c5599212168e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Dec 2023 21:02:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ao4K0f9WG8XRRa/UMaC3z/2uu9E73snI/TqEhMR1HmlJ6jm+vsxklAuh/EbmctBA0MmwYhrOGbpUYaR2X+jJwLToVrM6XopAfysXcCWQdfAwLNBimu4E9KD7G2ZsuCDfuMyj0o7/lEVyrbdo4wqy3RIuen/1crQzt+qV2JTz+YUd5ey08eHNT++3AbjlIfFJqsMvvHZ82D+GfLJvfJo7FGBj4fjaUQJz0KJBOx90h1F0zuxLjwtgSIrZkd9NaH98mlo/SU0X70L/PsC4q/sKBVZfpSLNz3ytIwJIWlIvuFZ71p++CCbrCYJGYDebhw8eOJbBzMHU0AwKjXb4uPfc4g== 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=NPTKpYUV/ZpqdTrZh05/OFhyIDSwZG0KuuR4j0cmIf8=; b=CEmpETGuSnf8tN2nsQHzNAAkzYwc4I26Hth985ZO+xuxBu29ibWCMIMDR/YjmmZj8pE2R09qECKcNZcEnujpIGGnOdsUQfz5PwTZCra2VoZva+dlE8r9B5sU0rkxrrI2IngA5tZuvcsnpwOiPxzEsGK7S6FTSmcCzGBG+5SKRDtZQjc98dZT6yGF7n/Rix9zIaMEjuzU+SakY8mjb0g7bNVMXI8AHLwzYc5TlRu1eYg3KGOD9Za/vh4i3uv4fQqPnBZFCksf5/P3vfUze7p0KO27fpLC++43JrzEo9UgSufV7mOIhLBEBk6pLOso0xXrk+DLGQMaMnbesKfcMhD29w== 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=NPTKpYUV/ZpqdTrZh05/OFhyIDSwZG0KuuR4j0cmIf8=; b=vSzaU7wOTPszQmxz27rpE4ho8sDXDHUuAYwgVvq6ONmveMFLhKwaVzHo9TYlWQ6hBaeejntlG59/4Dgq0JZTFc7PBdsaJM06YqfVabXyTt0Ie9uEGLIBSwodrR1KxvKL76wLa30vMIMcnGkEu++kdrVK5trFrnSQgQFqOwcY3JY= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) by DU0PR08MB9727.eurprd08.prod.outlook.com (2603:10a6:10:445::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 21:02:54 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::8512:cc10:24d4:1919]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::8512:cc10:24d4:1919%5]) with mapi id 15.20.7091.028; Wed, 13 Dec 2023 21:02:54 +0000 Date: Wed, 13 Dec 2023 21:02:52 +0000 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [PATCH 2/2] aarch64: Handle autoinc addresses in ld1rq splitter [PR112906] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO4P265CA0307.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:391::15) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|DU0PR08MB9727:EE_|AMS1EPF00000040:EE_|DB5PR08MB10116:EE_ X-MS-Office365-Filtering-Correlation-Id: af511dde-e9cf-4766-3fc1-08dbfc1ee59b 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: UFrhaonrmtci8+ieESnY5zN9RxgFj7PK850IwOzqWezURIAMuKSdSiYI/DNa4ZoT0L9S4PA/XyfNLVARuFql/VSZz50/wdhjcrkdw1BW8IE8kCe0gMLKN0Be7NOKSLX/G1FLfQ3URsVjgCjKnZ73vsRi/x2Uiwl0fBPF5f4iBwNgzr/cX3LyukIJNT2BBOdsi8gPyi8hoi/oqK9ZdaXzczXog3qEN9wtenQLD7kE33MgFbVzHOu/LHIG8Xur6JJXd2hcvnqEGoYIPHVvCxKlzkyekEzV+KrOuL6Ogb/fTFlzW8JphrZXKWSjV43P3GHBbW9zwKxaRyh88WZ7OeGv+W4XX5gv3mr24ro9ZdRx8JUUJ+WW8hJN5FVvmQ9GwEqxOEBjprhVbC3hlmce1Us9KiXoWXDvCuLrq0eIj4qfWGXPd+FbO3AQReex/TbRdXw2/XeKpllbtFowPGoZ/2+eyYtJJCvYbpu85Dis5ca9LJofaCVWl4xKmtPyDmO4kdXx+vUIqTzqImQQuRK3+aysNZxR2OTQsIrlcktas6sELI32r+i8SmbmxEsAjIGsIGNGZtcoln2tt7KtsoOpajf3pMfmqDJjRtB9Vge97lVLecQ29AQ5HTTQzODvTRgcZqWEVQ3fH3H/v9mEpIFTiJc8kKUC0qX+P1L3i9p89TsxYMA= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8958.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(136003)(366004)(376002)(346002)(39860400002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(36756003)(41300700001)(2906002)(5660300002)(235185007)(6506007)(26005)(2616005)(6512007)(84970400001)(44144004)(33964004)(478600001)(6486002)(21480400003)(38100700002)(4326008)(8676002)(8936002)(44832011)(86362001)(66946007)(316002)(66556008)(66476007)(6916009)(32563001)(2700100001)(473944003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9727 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: AMS1EPF00000040.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: cd2394ba-ab78-430f-0dae-08dbfc1ee044 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PBJHri2OJUdMHeO9MJmby3SxTNGyStO34dpGGL3kZ3Bzl2mYWT3zsIC8uvBgHQ7M4PkYphXcTCsLX5vSG2UASlGhIWz4nPaU4CayxtwBvQ2H/StzTgQUSSl5Ea7IFawxl29e4xhU+FLC8AdzZq/Gyrem52ZrcLCFfjGhpLDiXxrEzhtIof7vdsEM2LR4ZpjTopnIWrAoq83CzA+7V213sfVTJVKGi77ijyILQIRyQwTEuaEKZS0JNX5Rdb7SF+6Lhki7o6v9LBEC6nzqaHjLIMVIQC0jk8i/mZ7cup1E026xenupNNL2TPhPLBxuINZkviRJBlDB9KZkBRn1PKTOZbCsx53rO+0ewe31V4RzrOufRHRrXRFtNDIYoWSWuRdnk0AaAWOwnBq14roBG7DF/nKotyAZHAKH0Pj+loZCFlXMnOGLdabbKd2wRrgcmGe6zT+IHsAdSpv1WHa5vVvRJ9wXCs1KmR0FNQOEbRH1/DJETbh2u3YuoY1mGoxRnFRBqNCcnvBI6r6KMgK1rBCe8gmTpVE8udQR3F6zEAxERtW2MF/Hem6Eld4KLePRz7l0mrgSPylbq11amXkeIV8Dz69XU3JVJN4RZ0K2A3zYTf2w3yOb/Bjo827jFiXfJgv80LMMVDkBD20CIVkiYKZY4jcB1SD8jYcj8NcNFhew229Z6sclOqU8XPv/nGVEFwQnMgFSWeEg5wRjOe30ASZ6Z/j34Xp/4ShPOmXtfvKkd6TOLTR/7zcW79lwDr/71ifyDI/J3B36z9Eec16o0FHayyKjJxbQleysGtScCllZxcVwvLimOoWRaXebV3Uz9d79 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:(13230031)(4636009)(396003)(136003)(376002)(39850400004)(346002)(230922051799003)(82310400011)(64100799003)(451199024)(1800799012)(186009)(40470700004)(36840700001)(46966006)(36756003)(86362001)(40480700001)(40460700003)(84970400001)(2616005)(33964004)(6512007)(6506007)(70206006)(44144004)(41300700001)(70586007)(82740400003)(6486002)(336012)(26005)(356005)(81166007)(21480400003)(47076005)(235185007)(5660300002)(8676002)(2906002)(478600001)(4326008)(36860700001)(44832011)(8936002)(316002)(6916009)(32563001)(2700100001)(473944003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 21:03:03.3807 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af511dde-e9cf-4766-3fc1-08dbfc1ee59b 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: AMS1EPF00000040.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB10116 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, 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=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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org This patch uses the new force_reload_address routine added by the previous patch to fix PR112906. Bootstrapped/regtested on aarch64-linux-gnu, OK for trunk? Thanks, Alex gcc/ChangeLog: PR target/112906 * config/aarch64/aarch64-sve.md (@aarch64_vec_duplicate_vq_le): Use force_reload_address to reload addresses that aren't suitable for ld1rq in the pre-RA splitter. gcc/testsuite/ChangeLog: PR target/112906 * gcc.target/aarch64/sve/acle/general/pr112906.c: New test. diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index fdd14d15096..319bc01cae9 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -2690,10 +2690,7 @@ (define_insn_and_split "@aarch64_vec_duplicate_vq_le" { if (can_create_pseudo_p () && !aarch64_sve_ld1rq_operand (operands[1], mode)) - { - rtx addr = force_reg (Pmode, XEXP (operands[1], 0)); - operands[1] = replace_equiv_address (operands[1], addr); - } + operands[1] = force_reload_address (operands[1]); if (GET_CODE (operands[2]) == SCRATCH) operands[2] = gen_reg_rtx (VNx16BImode); emit_move_insn (operands[2], CONSTM1_RTX (VNx16BImode)); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr112906.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr112906.c new file mode 100644 index 00000000000..69b653f1a71 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr112906.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O2" } */ +#include +unsigned c; +long d; +void f() { + unsigned char *b; + svbool_t x = svptrue_b8(); + svuint32_t g; + svuint8_t h, i; + d = 0; + for (; (unsigned *)d < &c; d += 16) { + h = svld1rq(x, &b[d]); + g = svdot_lane(g, i, h, 3); + } + svst1_vnum(x, &c, 8, g); +}