From patchwork Fri Mar 19 16:45:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1455947 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@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=dXhbJS8c; 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F28sH45Skz9sVt for ; Sat, 20 Mar 2021 03:45:38 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C35893842402; Fri, 19 Mar 2021 16:45:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C35893842402 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1616172334; bh=Gibh5avTlMdW5fn7FRh8fZpCeLQRkTsFqc+EehPE6c8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=dXhbJS8c2VLWZWmNfbbKEeNDn0Bw1t90I53Ur77RdYsAAM9Bt2JyZDgFp3qi8MD+6 2Z7N43ts0OD/J0EZQkIKJLzrl5E/jotu1ohX70wSCakh7mdPXK6iQWvbyD656xhBN3 5EftRl5Zt4jyAXJo7hNpnvFrX6YOuHHGW5hP00Nw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) by sourceware.org (Postfix) with ESMTPS id EC0AD3857C7F for ; Fri, 19 Mar 2021 16:45:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EC0AD3857C7F Received: from AM6P193CA0126.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::31) by AM6PR08MB5288.eurprd08.prod.outlook.com (2603:10a6:20b:ac::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Fri, 19 Mar 2021 16:45:28 +0000 Received: from AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:85:cafe::8d) by AM6P193CA0126.outlook.office365.com (2603:10a6:209:85::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 16:45:28 +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 AM5EUR03FT031.mail.protection.outlook.com (10.152.16.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 16:45:28 +0000 Received: ("Tessian outbound 26664f7d619a:v87"); Fri, 19 Mar 2021 16:45:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e4d6b9b4ab8ff120 X-CR-MTA-TID: 64aa7808 Received: from b03c2edf168a.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4A101111-4F17-42FC-BD96-A6AD467A19FB.1; Fri, 19 Mar 2021 16:45:21 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b03c2edf168a.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 19 Mar 2021 16:45:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RGROV1JOnFiif2ewzTGzbf2psDC9WZAYcXvHgXYr+ox2zaM5mxqMMQc6CLUIAAyrR+dOlCwAylK2YBKpkS31yiHT51y1wPEqNiST1LHnrYYDcG6BIoNEQJlT9CRJvfk78szTKcAld4zs3VEF7aU44ZrMo1dHMt2IuK9wGrOP1W1n05ugKINaeMPRf1fXOFb+UzvqUvC9PIwnHQl2LSijRmn6yBm6h4tHBeEBAZf5AVFEzjhIDlipRKo6M4gpogOXPaad+2C0GiCsC8pisNI91okPEPBB5J5IgXVELceS8Mru3DSltIdbJszDhieJoPLEroujGT1Zw4y8d7Rh3d4X6g== 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=Gibh5avTlMdW5fn7FRh8fZpCeLQRkTsFqc+EehPE6c8=; b=WmmZnXbIUVqM/aOo36WkwzxXkRU4Qxgf89ZLxFJiFa+jrgGs55zAHj4WOY8dRzSfM6F9W8jXBLfpMJycRbMNIAJNGDtZJqhW9Ab0evfs4e/aonIgQpQIbKooApGBIsMDr5L9GeuWX1jnMlT/Jc/mhs9vUstIAQuh3b7l2HEENBVYx7CZLMM3HK24KSlxRQObl4EyABNfPe5wV5Ay0vTNc1T80+4klOvGwO8s/Z0VEmIcXnUYMhyNfT09laXKeVL0DyHSRioG5PKeSSU6qLT7DRpPPB2EVPFgGtOnTeHNTFchPP6Pjx213+1QNWWA9xgsdExm6e+Ig8ZiTsZInVAtew== 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 VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) by VI1PR08MB2991.eurprd08.prod.outlook.com (2603:10a6:803:40::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31; Fri, 19 Mar 2021 16:45:18 +0000 Received: from VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::91e5:a54c:eda6:49b2]) by VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::91e5:a54c:eda6:49b2%4]) with mapi id 15.20.3955.018; Fri, 19 Mar 2021 16:45:17 +0000 Date: Fri, 19 Mar 2021 16:45:14 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH] arm: Fix MVE ICEs with vector moves and -mpure-code [PR97252] Message-ID: <20210319164512.rooqdq2jegl5gmb2@arm.com> Content-Disposition: inline User-Agent: NeoMutt/20171215 X-Originating-IP: [217.140.106.49] X-ClientProxiedBy: CWXP123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:73::32) To VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.49) by CWXP123CA0020.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:73::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32 via Frontend Transport; Fri, 19 Mar 2021 16:45:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 27b0a4b1-40d2-4991-8f60-08d8eaf666e7 X-MS-TrafficTypeDiagnostic: VI1PR08MB2991:|AM6PR08MB5288: X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5797;OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: v8aXZaS0kmEnhZGko7JU5reJ3pv1mCNrjWsue9IYvYXlTf6SIy+d7i2Sr+xA9ogwSUXh1pPIdaGTwT8Cix7h4Uh9VaEyZIGu1py2VDNJ/QQWMNHmL6rKWcNhYa+q9IX6P1Z7iI7lkDAxsHpscXdaqTaUafGMOFN9V48nfohcBJVmfhrYw0vB4GQuUmuxv6G6F9w/k1qL0C05/cNND7CuSqrwSx3WGv7hlQX6I3Habg3M4wWaJiu3UkiGEc1BZ32aXzUblsL7IhL93Cj7wQ3rM+ajrA7udEEvbzAYc4eBXGqI16NuEXGxg+lGHcvPGjG5FyteZDk7VIXA7Il8USKf9d/uguwPRHcAOHME87aEmMtRb7D99qHio/9ZmEzlNUf4RGlPUXv2bit8MpW/yX73u7JyRqIZpo6vjvkRc7IqZpaH5XOd/CGoKZ6tYu4qtvunp0sbDwX8Xr6uEDpz7XT/RHcn1XFQAsgTANVDF+nxq8Ialng38dxQNO9dboI2FtCeYttLKiC/HL363ie4DwePaHG54IqRZHVRifumHr2omFSpbl12bJa3I4jqEukJk02dNYPUxQWGpHbHHb9wlWpSmdL02XW1wzpLqRuEiwPg2g8SnFmzUnGth674w38YEMvWT5beHzps+Cqea0DB1unY4FJvlX8/YavjMjT4klMOGNYAk6+/eWp9BRS/DOS6ATAX X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB4029.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(346002)(366004)(39860400002)(136003)(5660300002)(8886007)(54906003)(956004)(26005)(235185007)(21480400003)(8676002)(66476007)(316002)(16526019)(44144004)(6916009)(186003)(38100700001)(66556008)(44832011)(66946007)(1076003)(2616005)(86362001)(7696005)(478600001)(36756003)(33964004)(55016002)(52116002)(8936002)(2906002)(66616009)(83380400001)(4326008)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?gw8JWZDRkADc8A4+RpmaABYHgaFaIw?= =?utf-8?q?K8VpE6Qtb/Y3MnkzbnnbLPhuEGKsny8AXAptNwWgJWQpyl+HNoqYhHZcQuJregADh?= =?utf-8?q?wEnKasn7MCLIcZeG175vRhKMvKXcp6F2W+cblC7PK+nGcCXfks1z3SCDFoZNDPlk3?= =?utf-8?q?jlrCWd8sr9+9y5ozUQuY/9y8pr1RTsngGHtQKru88e6JRYLkNvObbhyTXzc7gPuXr?= =?utf-8?q?s3YRJhmB9fI7qJJfgdsIChpXzdIpS1aqJy8EqoRG5OL1x4mfheCMWuGFav8a5TLt4?= =?utf-8?q?+IoxA+a4zi1tN2Lp3T8K4i5iqYTUsGDvuX9EipEPN10Mte5lKHzV3BJr8LAV3XWlm?= =?utf-8?q?kBCjlmrnqaYP+xlVJrJ0uVADu13ZGiIBBj42rBJAYC0PHB0uvUywYVyiq05ps2aUO?= =?utf-8?q?dq2nHc8eIVPzO12oaRfoeQv0AAcQZXgbEUJwQdcXWZi+F5lSINh0FbA1GcM8LCdGj?= =?utf-8?q?lcncnGE8afd4XCM1bSjKowJxaZp8ECdjocsX5w/yyyqi+l1SNpM/SkdL+IO4GCxHw?= =?utf-8?q?IHSDVFOwoGxqaCVtkntq0PAw+4dsTMfNjI6KWogE/RpulbZC+Avu9tY/KB/Md7kTK?= =?utf-8?q?4UzZJfJPntLnxbEjccNE4W4f0yGjQr/5O+7mUx6laRTKC97cNlgzCE6GKG/uMRYm8?= =?utf-8?q?d0liV6s78ZAVVjR4RNIvo30oSivdPyClOxxuZzZ1a38HYvospHno4IV7jv90ba/nB?= =?utf-8?q?nGY+pIBBppqSwMmM2NTcxORU0MQcE+Z6cNR5tCO6N4GVSoidS9nZRUDdKJ3jwC3NU?= =?utf-8?q?UiJV8DWZHQBLzx4ZWgW8OrZmmTUIwDmo67MGsfnAw1hYY1cZ7r+c7Lk/ZHPHXaczE?= =?utf-8?q?XZmkqkYLlvt0gKH4gybNzMS1B/5qEbKdgiP9qpcEfanC6zthT8fNcd2xZqvsyOMwB?= =?utf-8?q?HF4YZgdpeDqHtz3ECE/AWwZ0qPZhIvFyS8T4r0ybKZaNHsbRLNvTlDJeDcAfFX/+u?= =?utf-8?q?cpdgzpCV+hZr1LTZ7pgfJCT7XSUWyD6XppKhmO2kmA6MDQUs/irWHBXvJUJmKCT6f?= =?utf-8?q?B/YUlyJas6PzL+tzcstwqDOJ0DYv/nbPyCi5gvxC24AjutHsZzqKPrguHWuJPNutd?= =?utf-8?q?d7FSQYpjAp+7JRHR9VTfBJ6/fgJYodRN4qjbOR7HRvGTeL8aqMbsk2icSZiX1+TzQ?= =?utf-8?q?QAYfzrVZ4qZ8IcrI9K09MyPknukQbHOVmz2NTGXNM6L0dETqvBRYRbelcmJrwzSVF?= =?utf-8?q?phDoryO2j4HO2mtyCfyNkXpw3CYbryiibjKUQTz9TAIxM3B1Z1w1B8A8UZjimDKck?= =?utf-8?q?ti3hW+Hj1L6ILH?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2991 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: AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 0c31d31e-ec1c-4af5-aa79-08d8eaf6601f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PIBEOe2NFoIb9UCreGC+yq1YfUBK9FOLQSx4yn/RHll7lsy5PVP+pe/v1rC4EvFQs8vmf545GTj2VNOjk78QWmBp4gz5uSU00iSutzY/ddOY1Cjz/yzYiUUCGV6Z4xGnPid5PyZVa3qoZPSjM7ST6fNJLuzu4K5Z6C+jSFimfLrgq1tRE3YJ/Tb2ZBwxmApkT9OkDCqsCIbHs3P3a7OP4bGSzYiK0CbI2OPNkjE3YM/wmz3oboZTw2/kvBXCvonBPsGZk8VeRxrO3BhwKLLmJLgIB2ZYkpT6uV1Qi36uE2yD6bGrnSxaqBkMe3pF6lK3xHFc1L6F6RL1Xgho8l2ivrI3udNG29f5YkMCcoosr0XCaGX+vLdjIZ3ya8XvlE+iCf66zGzANV2gtEty3AnrA8KqA83R6mxLpaTB6me8Q3/vMflacbPoToQ1RWsa/L9KBhWtgn41J0eD3y67dzs53URqDCMPyN8WZ63tusGam00JysGD2UcV6Dh7JCrNt1bK/wS2zaWSjT1e4CFowzKrs0DA4WgHWj8xFWSy/CpjhdD+Xy+stkJ6E9FqPMGtKUH5MxvSn9UXkx5t6IPnWp1bRkosWOEW1ATr8U4q9W6H3Ydrb5EylYvNLhNPtOkjsupmy64INuV6LKgI1jiyRMm+USyYEJsazwV+9+sIRtgyZvgRQCoA7PPz752vIvcoKPlv 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)(36840700001)(46966006)(8676002)(316002)(26005)(956004)(82310400003)(336012)(86362001)(2616005)(54906003)(6916009)(235185007)(186003)(16526019)(47076005)(8936002)(70586007)(2906002)(1076003)(83380400001)(70206006)(7696005)(8886007)(36860700001)(66616009)(55016002)(4326008)(21480400003)(5660300002)(478600001)(44832011)(44144004)(356005)(81166007)(36756003)(33964004)(82740400003)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2021 16:45:28.1261 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27b0a4b1-40d2-4991-8f60-08d8eaf666e7 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: AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5288 X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Alex Coplan via Gcc-patches From: Alex Coplan Reply-To: Alex Coplan Cc: Richard Earnshaw , Ramana Radhakrishnan Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi all, This patch fixes around 500 ICEs in the testsuite which can be seen when testing with -march=armv8.1-m.main+mve -mfloat-abi=hard -mpure-code (leaving the testsuite free of ICEs in this configuration). All of the ICEs are in arm_print_operand (which is expecting a mem and gets another rtx, e.g. a const_vector) when running the output code for *mve_mov in alternative 4. The issue is that MVE vector moves were relying on the arm_reorg pass to move constant vectors that we can't easily synthesize to the literal pool. This doesn't work for -mpure-code where the literal pool is disabled. LLVM puts these in .rodata: I've chosen to do the same here. With this change, for -mpure-code, we no longer want to allow a constant on the RHS of a vector load in RA. To achieve this, I added a new constraint which matches constants only if the literal pool is available. Testing: * Bootstrapped and regtested on arm-linux-gnueabihf, no regressions. * Regression tested a cross compiler configured with --with-arch=armv8.1-m.main+mve --with-float=hard with -mpure-code in RUNTESTFLAGS. The results here are: 539 FAIL->PASS 1 PASS->FAIL 594 UNRESOLVED->FAIL 1705 UNRESOLVED->PASS On manual inspection the PASS->FAIL is really an UNRESOLVED->FAIL and the UNRESOLVED->FAILs appear to be testisms (scan-assemblers that weren't written with -mpure-code in mind). * Similarly, using --with-arch=armv8.1-m.main+mve.fp: 602 FAIL->PASS 1 PASS->FAIL 594 UNRESOLVED->FAIL 1715 UNRESOLVED->PASS * Regression tested a cross compiler configured with --with-arch=armv8.1-m.main+mve --with-float=hard (without -mpure-code). The results here are: FAIL->PASS: gcc.target/arm/pure-code/pr94538-2.c -O0 (test for excess errors) FAIL->PASS: gcc.target/arm/pure-code/pr94538-2.c -O1 (test for excess errors) FAIL->PASS: gcc.target/arm/pure-code/pr94538-2.c -O2 -flto -fno-use-linker-plugin -flto-partition=none -ffat-lto-objects (test for excess errors) FAIL->PASS: gcc.target/arm/pure-code/pr94538-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -ffat-lto-objects (test for excess errors) FAIL->PASS: gcc.target/arm/pure-code/pr94538-2.c -O2 (test for excess errors) FAIL->PASS: gcc.target/arm/pure-code/pr94538-2.c -O3 -g (test for excess errors) FAIL->PASS: gcc.target/arm/pure-code/pr94538-2.c -Os (test for excess errors) with no regressions. OK for trunk and eventual backport to GCC 10? Thanks, Alex gcc/ChangeLog: PR target/97252 * config/arm/arm-protos.h (neon_make_constant): Add new check_only_p argument, default to false. * config/arm/arm.c (arm_legitimate_constant_p_1): Reject COST_VECTORs which neon_make_constant can't handle. (neon_vdup_constant): Add check_only_p, avoid emitting insns if it's set. (neon_make_constant): Plumb new check_only_p argument through. * config/arm/constraints.md (Ui): New. Use it... * config/arm/mve.md (*mve_mov): ... here. * config/arm/vec-common.md (movv8hf): Use neon_make_constant to synthesize constants. diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index bb5d3a2b133..a290e7fc7dc 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -101,7 +101,7 @@ extern char *neon_output_shift_immediate (const char *, char, rtx *, machine_mode, int, bool); extern void neon_pairwise_reduce (rtx, rtx, machine_mode, rtx (*) (rtx, rtx, rtx)); -extern rtx neon_make_constant (rtx); +extern rtx neon_make_constant (rtx, bool check_only_p = false); extern tree arm_builtin_vectorized_function (unsigned int, tree, tree); extern void neon_expand_vector_init (rtx, rtx); extern void neon_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT, const_tree); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 49635bc2d86..022e0403334 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -9461,6 +9461,9 @@ arm_tls_referenced_p (rtx x) static bool arm_legitimate_constant_p_1 (machine_mode, rtx x) { + if (GET_CODE (x) == CONST_VECTOR && !neon_make_constant (x, true)) + return false; + return flag_pic || !label_mentioned_p (x); } @@ -13030,7 +13033,7 @@ neon_pairwise_reduce (rtx op0, rtx op1, machine_mode mode, assign to the register. Otherwise return NULL_RTX. */ static rtx -neon_vdup_constant (rtx vals) +neon_vdup_constant (rtx vals, bool check_only_p) { machine_mode mode = GET_MODE (vals); machine_mode inner_mode = GET_MODE_INNER (mode); @@ -13046,6 +13049,9 @@ neon_vdup_constant (rtx vals) vdup.i16). */ return NULL_RTX; + if (check_only_p) + return x; + /* We can load this constant by using VDUP and a constant in a single ARM register. This will be cheaper than a vector load. */ @@ -13060,7 +13066,7 @@ neon_vdup_constant (rtx vals) for a PARALLEL that cannot be converted into a CONST_VECTOR. */ rtx -neon_make_constant (rtx vals) +neon_make_constant (rtx vals, bool check_only_p) { machine_mode mode = GET_MODE (vals); rtx target; @@ -13092,7 +13098,7 @@ neon_make_constant (rtx vals) && simd_immediate_valid_for_move (const_vec, mode, NULL, NULL)) /* Load using VMOV. On Cortex-A8 this takes one cycle. */ return const_vec; - else if ((target = neon_vdup_constant (vals)) != NULL_RTX) + else if ((target = neon_vdup_constant (vals, check_only_p)) != NULL_RTX) /* Loaded using VDUP. On Cortex-A8 the VDUP takes one NEON pipeline cycle; creating the constant takes one or two ARM pipeline cycles. */ @@ -13102,7 +13108,7 @@ neon_make_constant (rtx vals) (for either double or quad vectors). We cannot take advantage of single-cycle VLD1 because we need a PC-relative addressing mode. */ - return const_vec; + return arm_disable_literal_pool ? NULL_RTX : const_vec; else /* A PARALLEL containing something not valid inside CONST_VECTOR. We cannot construct an initializer. */ diff --git a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md index 919f2995f1b..46c1eb57800 100644 --- a/gcc/config/arm/constraints.md +++ b/gcc/config/arm/constraints.md @@ -498,6 +498,13 @@ (define_memory_constraint "Ux" && mve_vector_mem_operand (GET_MODE (op), XEXP (op, 0), true)"))) +(define_constraint "Ui" + "@internal + Match a constant (as per the 'i' constraint) provided that we have the + literal pool available. This is useful for load insns that would need + to move such constants to the literal pool after RA." + (match_test "!arm_disable_literal_pool && satisfies_constraint_i (op)")) + (define_memory_constraint "Uq" "@internal In ARM state an address valid in ldrsb instructions." diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index ec0ef7b8f71..440fd6adbac 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -19,7 +19,7 @@ (define_insn "*mve_mov" [(set (match_operand:MVE_types 0 "nonimmediate_operand" "=w,w,r,w,w,r,w,Ux,w") - (match_operand:MVE_types 1 "general_operand" "w,r,w,Dn,Uxi,r,Dm,w,Ul"))] + (match_operand:MVE_types 1 "general_operand" "w,r,w,Dn,UxUi,r,Dm,w,Ul"))] "TARGET_HAVE_MVE || TARGET_HAVE_MVE_FLOAT" { if (which_alternative == 3 || which_alternative == 6) diff --git a/gcc/config/arm/vec-common.md b/gcc/config/arm/vec-common.md index 345ada05523..ebf9e449b61 100644 --- a/gcc/config/arm/vec-common.md +++ b/gcc/config/arm/vec-common.md @@ -74,6 +74,11 @@ (define_expand "movv8hf" { if (!REG_P (operands[0])) operands[1] = force_reg (E_V8HFmode, operands[1]); + else if (TARGET_HAVE_MVE_FLOAT && CONSTANT_P (operands[1])) + { + operands[1] = neon_make_constant (operands[1]); + gcc_assert (operands[1] != NULL_RTX); + } } })