From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2074.outbound.protection.outlook.com [40.107.14.74]) by sourceware.org (Postfix) with ESMTPS id 1BAFE3858D33 for ; Thu, 11 May 2023 11:15:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BAFE3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2i5tvAge1V09H+KuXLzg8nlRxrOrRKGTYyU969++TT4=; b=zMCm1QYNWGbZarUuxkkvvG7kgtmYX429duK/hyopJnZLfPug5J8EMvbDbZQxC0KlwxesIMG2E4YZuXDqF8BebQTIDn7kESTHT1CCDylorA2+HzoEi2UMwoeSueQ3w0R0MnJRe/629RZbT5hC/YOptSoc7VQNwFwJs7KaS6ecH0M= Received: from AS9PR05CA0324.eurprd05.prod.outlook.com (2603:10a6:20b:491::18) by AM0PR08MB5361.eurprd08.prod.outlook.com (2603:10a6:208:18d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21; Thu, 11 May 2023 11:15:27 +0000 Received: from AM7EUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:491:cafe::39) by AS9PR05CA0324.outlook.office365.com (2603:10a6:20b:491::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21 via Frontend Transport; Thu, 11 May 2023 11:15:27 +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 AM7EUR03FT047.mail.protection.outlook.com (100.127.140.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21 via Frontend Transport; Thu, 11 May 2023 11:15:27 +0000 Received: ("Tessian outbound e13c2446394c:v136"); Thu, 11 May 2023 11:15:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d9998cfa9872bac5 X-CR-MTA-TID: 64aa7808 Received: from d7774e25100e.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4931AE3E-156C-4DFB-899A-A2D2075AF224.1; Thu, 11 May 2023 11:15:20 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d7774e25100e.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 11 May 2023 11:15:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gIUfoPsNkf4XugZLVr2TZrepuC2xMBMV9+1n7YfYHYPR+frT2aCsarrp+2gEswBV2/xSE6th2QR3GSo9u11URPQfqAL7/q/+cgT7Nk5APgcQJ2/p5xEvwROph+eq3ga9Qlff1fY105SwWblk4sDEqbUjcCmBksBqlbIJcEtKu6LIY1fQ9z8SRMuHbdQf/RXnwFK8oiYqovAuJcMYXWvdCfs1G/HQ+F0D/BJwcMBVZsjBHdMMpO/yUE12dP54nVLF4G5SqY+Fe0aLbkvdkhwp8VE4+rDp3t8N4L1yr1LdzR4b3pQ/46HQaxq11wVWS4MYFdDGyfrCvpQWh39FVQIVlA== 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=2i5tvAge1V09H+KuXLzg8nlRxrOrRKGTYyU969++TT4=; b=RiEFHOgO9czuGBR3yFxez13CU4R+VuuTVmr/wuFRXgAUgU0RR+VnzyxsqxWM4c+pxTF+h7eVfNl41ujyDuJE05Z1Pohhm3BLfgL3p0lhUs2gaO+kM0hRdAfuvfC9ZcbiSEdkjDQ8q+PhtcbOpjG9VpBZa6bujwFnTc8RJXJ8Nz6MgDadFwhVEJJbgpd0co2jw7k2YZZYzJF/DMawAAhMeACLf+6O9ZyHKqULIdxNCglAqqqooKxfDgfvB0NSsrwTRCxIg0MFfizD8GnMKnJSPeArWaz/Ap1OmMXGDOz3lhn60jQm8Wx/++f3OWEiV6LhgTwQGEwKzohIQRmYPMqPPA== 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=2i5tvAge1V09H+KuXLzg8nlRxrOrRKGTYyU969++TT4=; b=zMCm1QYNWGbZarUuxkkvvG7kgtmYX429duK/hyopJnZLfPug5J8EMvbDbZQxC0KlwxesIMG2E4YZuXDqF8BebQTIDn7kESTHT1CCDylorA2+HzoEi2UMwoeSueQ3w0R0MnJRe/629RZbT5hC/YOptSoc7VQNwFwJs7KaS6ecH0M= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB7212.eurprd08.prod.outlook.com (2603:10a6:10:2cf::23) by VE1PR08MB5789.eurprd08.prod.outlook.com (2603:10a6:800:1b3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21; Thu, 11 May 2023 11:15:18 +0000 Received: from DB9PR08MB7212.eurprd08.prod.outlook.com ([fe80::9161:fb84:1035:9475]) by DB9PR08MB7212.eurprd08.prod.outlook.com ([fe80::9161:fb84:1035:9475%5]) with mapi id 15.20.6387.020; Thu, 11 May 2023 11:15:17 +0000 Date: Thu, 11 May 2023 12:15:14 +0100 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Nick Clifton , Richard Earnshaw , Ramana Radhakrishnan , Kyrylo Tkachov Subject: [PATCH] arm: Fix ICE due to infinite splitting [PR109800] Message-ID: Content-Type: multipart/mixed; boundary="SVSckfmYJryr8Y4R" Content-Disposition: inline X-ClientProxiedBy: LNXP265CA0063.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5d::27) To DB9PR08MB7212.eurprd08.prod.outlook.com (2603:10a6:10:2cf::23) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR08MB7212:EE_|VE1PR08MB5789:EE_|AM7EUR03FT047:EE_|AM0PR08MB5361:EE_ X-MS-Office365-Filtering-Correlation-Id: ce617090-9a7d-490b-7a6e-08db5211065e X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr 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: 4rmohwZTHH5Pu8wvEmGkwy6RXU5ydFX0/lVTECkjX00IsPLLz0ruvONkxmkw8A+yY3YW4ICF/kszWS8JL/w4gf0iTeRE1dSUJ12o1MNCRC2LhrQJpuV5v8BU/FmCJdwhOcCswulDQROZVko2WOeqwrJ8uYg7Et7SZWpsftaKL8PlD6MIJkDzUDN9YKQpuzGQeutwwCvik6WMbzlHKSKhD3excpEXoNFJP40+BM9CxzCtVd8mUKTKe/trAAqrJGFf6kY8yFXmRftDkmSxU8KBiTKnpTLu6hLlXGvmgWkfqMMq6nA6z1w/OBG7H5RQtR3AeX01RS2DJIZ9RZy1m3svasN635h12WgRoZJT77WiNs8SAHn+Fx2ifHllqqFCTp/p2PKIszswwuQwzZ/x8q5/14CF51cUZUeVfDlYChSK7+ObDoej438pnv8FlDqeb/iHeyNf9pmX+Kt8OCchCCvqpUR7rHksNM0DIleKIPmb+g7+iPMJUXEI0kMaGtTe22lWYENCmQzl2MVMkibDKH0mQOhC57BSPhIOWtHCDi8vLVOqKTTUi0xF50RPjV/BcgiiojpSM3FoH4TVzc+15pc+fsIG5i1mz9Isgng3jrw8iI0= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB7212.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(366004)(376002)(346002)(39860400002)(451199021)(36756003)(38100700002)(86362001)(84970400001)(2616005)(8936002)(8676002)(33964004)(44144004)(478600001)(5660300002)(6512007)(6486002)(26005)(235185007)(44832011)(6506007)(21480400003)(186003)(2906002)(316002)(66556008)(6666004)(66476007)(66946007)(41300700001)(54906003)(6916009)(4326008)(2700100001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5789 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: AM7EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9c3b6fb3-5d54-4c74-e6a9-08db5211004a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hv93pt8Z16W2PlOZ3iAzr5a9J7pZ6b2kenwpMHh9L5b7uH7RpZEwBoKCFE250I8yLjLpDZ4DvXMtEqTqbqbnwJal4iIqf2CRLp+0ueuMC6IgalacuNZ9ifqLx6ZJcPWz7VAB0p5aRsw5akncaWFyt1B7TPG+iMfG1XKE/hrTdZ9PxLwW3fz0CVyuZue/5jxhNc/GMPtoopuYDyk2KBH+V8VjQmEZXzqZh0RwNzslIXgUr6W1TRPwypybwByvJzWN4w76crn18n0nL/UlvXsQbdHa19O98TaPJ6qma6Li4WSSjxlkMOI8Wub8MU43yc6Yvd93obr9KWTSeZoyQKlL+2ysIymsVbQk5CXaoM14/gr9E8tOUG7Np6ecIw4wHKh1mgbApcTZf79WxnQ/HUSQKIk2De874SXrEneYc1amfVwrYUvRHOWKiLwqdEZbfmaqsaTXQuc9kkybrPC/Lnf+FwPdJHn/0aD+qvYG3S/2dknL0/DiCp66Eg6yWYv/LULpJoYMNBAuxMe2Zpxv17E7yQuEQP5UQpbTyRX/0FOlQHgOWFN4WQKUK0GYYGAj4FLenI+6F3ND3FgkUROGzv/jzI2XIEJyRmRm1ONT36ed5UQHQ6Lxh21qK5uK66Bi/OTuL4Unc7hgitz7fGh3bdrfCGB+/AelO19N/BlzmQVafDqHviDqT5ioSM8G+I7dDEnS9XAoBN04NCemA8+HmNTmNIb66TSoSoEkEKpKeg0ArJWNUsF+qryERmyA+nEHkGWj8XqHKUoDEWLihfBV0OfUvw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199021)(40470700004)(36840700001)(46966006)(6916009)(4326008)(40460700003)(2906002)(21480400003)(47076005)(2616005)(336012)(6666004)(36860700001)(6486002)(44144004)(478600001)(70586007)(70206006)(33964004)(54906003)(6512007)(186003)(235185007)(44832011)(26005)(6506007)(8936002)(8676002)(5660300002)(41300700001)(316002)(40480700001)(82740400003)(81166007)(356005)(86362001)(36756003)(82310400005)(84970400001)(2700100001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 11:15:27.7365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce617090-9a7d-490b-7a6e-08db5211065e 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: AM7EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5361 X-Spam-Status: No, score=-12.3 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 List-Id: --SVSckfmYJryr8Y4R Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hi, In r11-966-g9a182ef9ee011935d827ab5c6c9a7cd8e22257d8 we introduce a simplification to emit_move_insn that attempts to simplify moves of the form: (set (subreg:M1 (reg:M2 ...)) (constant C)) where M1 and M2 are of equal mode size. That is problematic for the splitter vfp.md:no_literal_pool_df_immediate in the arm backend, which tries to pun an lvalue DFmode pseudo into DImode and assign a constant to it with emit_move_insn, as the new transformation simply undoes this, and we end up splitting indefinitely. This patch changes things around in the arm backend so that we use a DImode temporary (instead of DFmode) and first load the DImode constant into the pseudo, and then pun the pseudo into DFmode as an rvalue in a reg -> reg move. I believe this should be semantically equivalent but avoids the pathalogical behaviour seen in the PR. Bootstrapped/regtested on arm-linux-gnueabihf, regtested on arm-none-eabi and armeb-none-eabi. OK for trunk and backports? Thanks, Alex gcc/ChangeLog: PR target/109800 * config/arm/arm.md (movdf): Generate temporary pseudo in DImode instead of DFmode. * config/arm/vfp.md (no_literal_pool_df_immediate): Rather than punning an lvalue DFmode pseudo into DImode, use a DImode pseudo and pun it into DFmode as an rvalue. gcc/testsuite/ChangeLog: PR target/109800 * gcc.target/arm/pr109800.c: New test. --SVSckfmYJryr8Y4R Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="pr109800.txt" diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index cbfc4543531..40c4d848238 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -7555,7 +7555,7 @@ (define_expand "movdf" && !arm_const_double_rtx (operands[1]) && !(TARGET_VFP_DOUBLE && vfp3_const_double_rtx (operands[1]))) { - rtx clobreg = gen_reg_rtx (DFmode); + rtx clobreg = gen_reg_rtx (DImode); emit_insn (gen_no_literal_pool_df_immediate (operands[0], operands[1], clobreg)); DONE; diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md index 60e7ba35d8b..03514acc94f 100644 --- a/gcc/config/arm/vfp.md +++ b/gcc/config/arm/vfp.md @@ -2138,7 +2138,7 @@ (define_insn "get_fpscr" (define_insn_and_split "no_literal_pool_df_immediate" [(set (match_operand:DF 0 "s_register_operand" "=w") (match_operand:DF 1 "const_double_operand" "F")) - (clobber (match_operand:DF 2 "s_register_operand" "=r"))] + (clobber (match_operand:DI 2 "s_register_operand" "=r"))] "arm_disable_literal_pool && TARGET_VFP_BASE && !arm_const_double_rtx (operands[1]) @@ -2153,8 +2153,9 @@ (define_insn_and_split "no_literal_pool_df_immediate" unsigned HOST_WIDE_INT ival = zext_hwi (buf[order], 32); ival |= (zext_hwi (buf[1 - order], 32) << 32); rtx cst = gen_int_mode (ival, DImode); - emit_move_insn (simplify_gen_subreg (DImode, operands[2], DFmode, 0), cst); - emit_move_insn (operands[0], operands[2]); + emit_move_insn (operands[2], cst); + emit_move_insn (operands[0], + simplify_gen_subreg (DFmode, operands[2], DImode, 0)); DONE; } ) diff --git a/gcc/testsuite/gcc.target/arm/pr109800.c b/gcc/testsuite/gcc.target/arm/pr109800.c new file mode 100644 index 00000000000..71d1ede13dd --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr109800.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=armv7-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mbig-endian -mpure-code" } */ +double f() { return 5.0; } --SVSckfmYJryr8Y4R--