This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<<C))!=0 to (a>>C)&1


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]