This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Add missing popcount simplifications (PR90693)
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, Andrew Pinski <pinskia at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Wed, 21 Aug 2019 13:57:25 +0000
- Subject: Re: [PATCH] Add missing popcount simplifications (PR90693)
- 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
- 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=rEUpTXGf2s9G0A2KXp7nMJF0DhMYEX4fVBouPz3sARc=; b=hxvQvYaIeglB1YoJzHSqzSwKnVyqGeqVidD2k+CPj4Cc9bWtc83n/9zUeZXOWMKOh1DH8t3gQ+p5QP3WRHg5KvZud+2JrNwvmIFrRO6gzWTv1Uvs3RrPlsVpRoXsEbQmPj5fTwNeixC23P1txi6YczRAImsta5L025SmjNPKsEPcwEd+H0PQgxT8bXihA8jd2BUVGq7AA9Sq6oQ3X65gTqC+hEnV3PewajdzxhLmdtwsM4gN1WQMj0ofxv41TEC6HIqIplD5cL5GTwwN0889mEME9BBlZUSwh0iYs8iEpdtbOl3NdQNcVzt8PEafMSki66DKbGszv7v2Me6fGqZTpg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RnkmRSNbQMEugDfYDYOlZ5u5xemS7fiywvPVX4B4qUfa8rm/Y+e1G09IJA4w5R7DRn1U9G5c0k9JGpMGjeInlYF1lGyAyX4vhtonNeiLaqt0UUe5ThBGcMTFIChDzS0YnexrBZR8t585bWV5ZJ+SoSe8SxAmFOqXwgUqepz3DpROO4oVSzuwT/wlk9j1+rNEk76oryKPP6vQ2vRG0LmKKD9lXT7NzIY/15/Xt+0qlRxeyNg2dUiFLHhX4JujKut1ViLPkieEm41Ux5luu92DBlsHbtD5MwY7NcZbHKymVnE5z2u77wz8ALSi3OfnLMjh1SMfosZBcKQFJ2ytRD3Tnw==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco dot Dijkstra at arm dot com;
- References: <VI1PR0801MB21278052E2DDC128FD0D01EF83D20@VI1PR0801MB2127.eurprd08.prod.outlook.com> <CA+=Sn1nx9B5aVY-bPz6G6oMOE5=2EYwpWVJ4X_8-L+LgokvZvg@mail.gmail.com>,<CAFiYyc2HVdHg_m5xXMksN_ukw8ukA7e36ovYizAV46ttfoOfYw@mail.gmail.com>
> > I think this should be in expand stage where there could be comparison
> > of the cost of the RTLs.
> I tend to agree here, if not then for the reason the "simplified" variants
> have more GIMPLE stmts which means they are not "simpler". In
> fact I'd argue for canonicalization we'd want to have the reverse
> "simplifications" on GIMPLE and expansion based on target cost.
So how would this work? Expand works on one statement at a time, but
we are dealing with more complex expressions here. When we get a
popcount (x) > 1 in expand_gimple_cond, the popcount has already been
expanded. And the code in builtins.c that emits popcount doesn't see or
consider the comparison, so it would be difficult to change it at that point.
None of the infrastructure in expand seems to be set up to do complex
pattern matches and replacements at expand time...
Costing would be difficult too since rtx_cost doesn't support builtins or
calls, so each backend would need to be modified to add costs for these.
So what is the best place to do pattern matches? I thought it was all
moving to match.pd.