From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2107.outbound.protection.outlook.com [40.107.14.107]) by sourceware.org (Postfix) with ESMTPS id 2687D389087D for ; Thu, 15 Dec 2022 15:26:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2687D389087D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=Syrmia.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Syrmia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ApNF5BOZVR8NdRWLYbPAUOdxyaULjDvlMFa3TKwuf3VXRHYY1+zRtd7vIYtqfY1eyXHsGn+T3kLLYE+i2aim8VJXlcIizGxbq9oX41bWCLlv0PcIpg2c7PL2RSpuuzm1Wa01C0DzhH80x1h/2GnzLXmBFFg0GK9oKrl5VabudsJnR15U5TwGei1cbRp3YSVDIoM15qB8YtmAmQyE4in7T/lEb3ACpd90uWicHWWO//lHN51IyLYoi856kS/hJ85aKuuZ7r8WOiP8HPaLVOPzF/XnSJfIZQ0el17KcjBb3o5VX291Qr5+j+wvUNtj/yRgLzpd+rIZn8kVTeI9/CeGpw== 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=3K6t9p+enCXKGcl4d0SSfyt3+TT86TcJxqlGXDEbyiM=; b=gMlT6MZv1B8gqeJb5FGW+tBsObnJ+RXJpboP1n72O6RXZc17vkpwTkuc+7WBI7RotmVuUXGqEAGJRvOUq80HYQGcFEZXOvoJOWlP8t3Gkpw8zBWg+STF2N4aYrmIrUmsvVtv8KOuQlYEKtbkXILSDjhbWNGmS9MDAdBulS7xJE75UT6fQgnb6n+fSI8ZeJwFGPjB5OPs4jBLhROzpqkoi07JJqVS/FcWhJTBRRCGBmoQpKWmwAjRqpsdLeeJrymwpWxua08JOGBKG/+r35Vi/delEiXKkr6snFbPubIhwoC6A52PZhZ996yY8gvfQFDYy9UwuLfhZKPH/7HBtB23Pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3K6t9p+enCXKGcl4d0SSfyt3+TT86TcJxqlGXDEbyiM=; b=UtRWk+9OnQZ8/NWZGaLtnuqMc4lFKd37pTJggerm2MjhF8HdYflj5uzDxplmkS85OSRDxz1dNXupXV8vTE0uATiZgcucZlB1oVoKxgp+sSfCFF8hbcQ/i+tK59r34XRvmHh02bvI2tboeVTeUoqq5eglfNmOj4gd1frH7HEMv3I= Received: from AM0PR03MB4882.eurprd03.prod.outlook.com (2603:10a6:208:fb::17) by DU0PR03MB9030.eurprd03.prod.outlook.com (2603:10a6:10:47d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Thu, 15 Dec 2022 15:26:51 +0000 Received: from AM0PR03MB4882.eurprd03.prod.outlook.com ([fe80::6d55:c3be:1328:429b]) by AM0PR03MB4882.eurprd03.prod.outlook.com ([fe80::6d55:c3be:1328:429b%7]) with mapi id 15.20.5880.019; Thu, 15 Dec 2022 15:26:50 +0000 From: Dimitrije Milosevic To: Richard Biener CC: Jeff Law , "gcc-patches@gcc.gnu.org" , Djordje Todorovic Subject: Re: [PATCH 1/2] ivopts: Revert computation of address cost complexity. Thread-Topic: [PATCH 1/2] ivopts: Revert computation of address cost complexity. Thread-Index: AQHY5VSpCkpNZ9wRE0qr2B1vutRVJa4i5Z0AgAB9V4aAAAhsgIAHDpgAgADoiyKACC5rgIA70MbW Date: Thu, 15 Dec 2022 15:26:50 +0000 Message-ID: References: <20221021135203.626255-1-dimitrije.milosevic@syrmia.com> <20221021135203.626255-2-dimitrije.milosevic@syrmia.com> <3c50de1f-c00b-9f8a-a604-a71bc546f1c2@gmail.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=Syrmia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM0PR03MB4882:EE_|DU0PR03MB9030:EE_ x-ms-office365-filtering-correlation-id: af947388-0553-42d9-fb76-08dadeb0c9d9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: X7C4VOVGvETCATn4lH5QTnCACY1fRPGvwaYy/u/uuwJ4DNruPGHwU6QO0kZN7LHx/jbBSUHGfGOhIW/T9VhIWOfekSuD4Rk9RsWgOBEmH6xqtkIGnh6zxubpbfbe6zbGcNI6+z+cJIl9hyhJhRGNtqxa4mcqpxV6t7sY2VBL9q9ISZOWkoTsMyq6Qj+uN26pew7x/VqLrlYWrhtdQhqxW3x80TuG3mcvcUUI7Vt3ENdWLgxsLTOdZ9esmM3HDxnA02ea3CmBIMtwDdYdnduZGDH5ABKCymCFliQUIZInlHW+oRgLT2WaVzxQCr653CGfqwdt0x6/QYBXBJjBY1D5YwaVDwU7BxV60xMXGV5Jo93lIwMqWUUhazZAiscy2IHPh7LfauEjLaeBMJkGx2gSEUrYBBdYcAQEdjPnQHaUIppZyyhym+MMBVA1M3jD3R/TmXvlcow4Ok20fiOjt8+ui89GxS7HJTXkfnRndYLsHq/WkP0S7SnGOIQnJ75Ox1aFkK2cJMn0l1+hih0wvKjcxPU/VEnLJVb1dJqEEjIfjhSxlzEy7h+4x7N4J8rIxEFqgFPyhNXvCAlqJgswgTgNcIxDELJrBQTiTyfo4x3y2usZzpnTTkh1H0Mr+6dAchy67c48txkSV9WIAVcNtYgk3IUK7UbBkphLcod6zT4SuDCCF2aMizs+C6p10x45SCotIlN8J+Qhep0Ygrm9BdVTnw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR03MB4882.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(366004)(396003)(136003)(346002)(39840400004)(451199015)(122000001)(33656002)(2906002)(52536014)(5660300002)(26005)(4326008)(8676002)(66446008)(91956017)(64756008)(66556008)(8936002)(76116006)(66946007)(41300700001)(66476007)(71200400001)(86362001)(478600001)(38100700002)(316002)(6916009)(6506007)(55016003)(107886003)(9686003)(7696005)(53546011)(38070700005)(54906003)(186003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?UFjSjw2iyJMa4kI150XzZ4v5YJfitqCGKp5Ze8Yr33jRqDbIxt7FW62VKs?= =?iso-8859-1?Q?vMMzoE6mP+krtlr7bmvUhwYWYLX5fiVfuEAV+u3vaW74U25/b9xr1fxy9W?= =?iso-8859-1?Q?pj+3XL8X4wlCfh/fuyfOfvVYobZhd92AUOBAk4JQHj38T16yAxVqkSPkhl?= =?iso-8859-1?Q?KfKvR0oh8mwEJZQdE/1qsKUqAH/P6X3V+5ezHbUcU4tjeqQ2bB9xsUWFIH?= =?iso-8859-1?Q?B4xFIb8vYYrndIs6bkSBVSltlZwIaogYuZrDx8s+8DNeAiMsbIKFefu6OG?= =?iso-8859-1?Q?wQv8UcLGphqjnSUNxFgVMawnztBiWPd0bZpxcYE+JarwYo8u5UfNnajiB6?= =?iso-8859-1?Q?XZBc6mdatJpimPBLoLQJ8tIbP9uU7R0OOvAKSkIoO/chlrV2p/uMtkwXv6?= =?iso-8859-1?Q?no7brDoolPeG+2XlOA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3PVd?= =?iso-8859-1?Q?Ss5O6B66yCmKhCD4dy6AhuCmy01cy/huSZrTKMX4T9uhlBQOEo8kruqvTW?= =?iso-8859-1?Q?FC/cqZeGSiz0fcXN9+nE5Yso4wzDWJZptS8mRSuBmEo19lXCXzw8aWngXn?= =?iso-8859-1?Q?hQqz3iaeTKg26w8HDNBacgKtgkFGZdJotGBT9rOn9eLEg2MF/s75AvSwpD?= =?iso-8859-1?Q?nE3WJtmztzlLHHjMo8Noe65ePJTqag+xwSdqNcXCw6hC1zJpaSWfHj14C1?= =?iso-8859-1?Q?oTyPyEgXFBNtS+ZqMOgGg/KMboEc3SNV72DpV2L6/k8VY22skD6/YkptDA?= =?iso-8859-1?Q?bV6zqNkTgv75S2pVB5otitV2TRhVpsrXJ8+3+2Fc1mJpR0glY4j6uQJg?= =?iso-8859-1?Q?=3D=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR03MB4882.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: af947388-0553-42d9-fb76-08dadeb0c9d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2022 15:26:50.8150 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QrQ32MnVoV+j0WE54cBBeTWZ/PoK4zA1oHmgoIRjOYY+lITm/j+UJ4wWDEwHPMTkExXtPa9lSY0BePFNchcRIN6Uu3scnhAjjnDBMwrIENA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB9030 X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP 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: Hi Richard,=0A= =0A= Sorry for the delayed response, I couldn't find the time to fully focus on = this topic.=0A= =0A= > I'm not sure this is accurate but at least the cost of using an unsupport= ed=0A= > addressing mode should be at least that of the compensating code to=0A= > mangle it to a supported form.=0A= =0A= I'm pretty sure IVOPTS does not filter out candidates which aren't supporte= d by=0A= the target architecture. It does, however, adjust the cost for a subset of = those.=0A= The adjustment code modifies only the cost part of the address cost (which= =0A= consists of a cost and a complexity).=0A= Having said this, I'd propose two approaches:=0A= 1. Cover all cases of unsupported addressing modes (if needed, I'm not = entirely=0A= sure they aren't already covered), leaving complexity for unsupport= ed=0A= addressing modes zero.=0A= 2. Revert the complexity calculation (which my initial patch does), lea= ving=0A= everything else as it is.=0A= 3. A combination of both - if the control path gets into the adjustment= code, we=0A= use the reverted complexity calculation.=0A= I'd love to get feedback regarding this, so I could focus on a concrete app= roach.=0A= =0A= Kind regards,=0A= Dimitrije=0A= =0A= From: Richard Biener =0A= Sent: Monday, November 7, 2022 2:35 PM=0A= To: Dimitrije Milosevic =0A= Cc: Jeff Law ; gcc-patches@gcc.gnu.org ; Djordje Todorovic =0A= Subject: Re: [PATCH 1/2] ivopts: Revert computation of address cost complex= ity. =0A= =A0=0A= On Wed, Nov 2, 2022 at 9:40 AM Dimitrije Milosevic=0A= wrote:=0A= >=0A= > Hi Jeff,=0A= >=0A= > > This is exactly what I was trying to get to.=A0=A0 If the addressing mo= de=0A= > > isn't supported, then we shouldn't be picking it as a candidate.=A0 If = it=0A= > > is, then we've probably got a problem somewhere else in this code and= =0A= > > this patch is likely papering over it.=0A= =0A= I'm not sure this is accurate but at least the cost of using an unsupported= =0A= addressing mode should be at least that of the compensating code to=0A= mangle it to a supported form.=0A= =0A= > I'll take a deeper look into the candidate selection algorithm then. Will= =0A= > get back to you.=0A= =0A= Thanks - as said the unfortunate situation is that both the original author= and=0A= the one who did the last bigger reworks of the code are gone.=0A= =0A= Richard.=0A= =0A= > Regards,=0A= > Dimitrije=0A= >=0A= > ________________________________________=0A= > From: Jeff Law =0A= > Sent: Tuesday, November 1, 2022 7:46 PM=0A= > To: Richard Biener; Dimitrije Milosevic=0A= > Cc: gcc-patches@gcc.gnu.org; Djordje Todorovic=0A= > Subject: Re: [PATCH 1/2] ivopts: Revert computation of address cost compl= exity.=0A= >=0A= >=0A= > On 10/28/22 01:00, Richard Biener wrote:=0A= > > On Fri, Oct 28, 2022 at 8:43 AM Dimitrije Milosevic=0A= > > wrote:=0A= > >> Hi Jeff,=0A= > >>=0A= > >>> THe part I don't understand is, if you only have BASE+OFF, why does= =0A= > >>> preventing the calculation of more complex addressing modes matter?= =A0 ie,=0A= > >>> what's the point of computing the cost of something like base + off += =0A= > >>> scaled index when the target can't utilize it?=0A= > >> Well, the complexities of all addressing modes other than BASE + OFFSE= T are=0A= > >> equal to 0. For targets like Mips, which only has BASE + OFFSET, it wo= uld still=0A= > >> be more complex to use a candidate with BASE + INDEX << SCALE + OFFSET= =0A= > >> than a candidate with BASE + INDEX, for example, as it has to compensa= te=0A= > >> the lack of other addressing modes somehow. If complexities for both o= f=0A= > >> those are equal to 0, in cases where complexities decide which candida= te is=0A= > >> to be chosen, a more complex candidate may be picked.=0A= > > But something is wrong then - it shouldn't ever pick a candidate with= =0A= > > an addressing=0A= > > mode that isn't supported?=A0 So you say that the cost of expressing=0A= > > 'BASE + INDEX << SCALE + OFFSET' as 'BASE + OFFSET' is not computed=0A= > > accurately?=0A= >=0A= > This is exactly what I was trying to get to.=A0=A0 If the addressing mode= =0A= > isn't supported, then we shouldn't be picking it as a candidate.=A0 If it= =0A= > is, then we've probably got a problem somewhere else in this code and=0A= > this patch is likely papering over it.=0A= >=0A= >=0A= > Jeff=0A= >=