This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<<C))!=0 to (a>>C)&1
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Georg-Johann Lay <avr at gjlay dot de>
- Cc: Andrew Pinski <pinskia at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Denis Chertykov <chertykov at gmail dot com>, Eric Weddington <eric dot weddington at atmel dot com>
- Date: Fri, 9 Dec 2011 14:01:10 +0100
- Subject: Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<<C))!=0 to (a>>C)&1
- References: <CA+=Sn1=3gd=QfFaFm0r3KxHBySV6wLVCsGSNtMuMDrK6Dndz2Q@mail.gmail.com> <4EE2041D.90504@gjlay.de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Dec 09, 2011 at 01:50:37PM +0100, Georg-Johann Lay wrote:
> No, not OK.
>
> This leads to unacceptable code for devices that cannot shift easily like, e.g.
> AVR. This target can only shift by 1 and shifts with big offsets have to be
> performed by means of a loop at runtime.
Andrew's patch only restored what GCC has been doing before.
If this is too expensive on AVR, you should just arrange in the backend to
combine that
((x>>C)&1) != 0
into more efficient code sequence, otherwise people who write
if ((x >> 18) & 1)
bar ();
in the source will get suboptimal code.
Jakub