Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<

2011-12-12 Thread Michael Matz
Hi, On Fri, 9 Dec 2011, Georg-Johann Lay wrote: > This is pretty much straight forward, and I don't understand the problems with > - canonicalize stuff > - optimize on canonicalized representation > - lower canonicalized representation to best RTL I don't think anyone would reject patches that d

Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<

2011-12-09 Thread Georg-Johann Lay
Jakub Jelinek wrote: > 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

Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<

2011-12-09 Thread Jakub Jelinek
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

Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<

2011-12-09 Thread Georg-Johann Lay
Andrew Pinski wrote: > Hi, > After SSA-expand, the code which did the optimization for > (a&(1<>C)&1 became not working because BIT_AND_EXPR > would no longer be in there. This patch fixes the problem by using > get_def_for_expr to get the BIT_AND_EXPR. > > OK? Bootstrapped and tested on x86_6

Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<

2011-12-08 Thread Andrew Pinski
On Thu, Dec 8, 2011 at 1:32 PM, Richard Henderson wrote: > On 12/06/2011 08:17 PM, Andrew Pinski wrote: >> +   if (a & (long long) 0x400) >> +      return 1; >> +   return 0; >> +} >> + >> +/* { dg-final { scan-assembler "andl" { target i?86-*-linux* >> x86_64-*-linux* } } } " */ >> +/* { dg-fina

Re: [PATCH] Fix PR middle-end/45416, missing opt for (a&(1<

2011-12-08 Thread Richard Henderson
On 12/06/2011 08:17 PM, Andrew Pinski wrote: > + if (a & (long long) 0x400) > + return 1; > + return 0; > +} > + > +/* { dg-final { scan-assembler "andl" { target i?86-*-linux* x86_64-*-linux* > } } } " */ > +/* { dg-final { scan-assembler "setne" { target i?86-*-linux* > x86_64-*-linux*

[PATCH] Fix PR middle-end/45416, missing opt for (a&(1<

2011-12-06 Thread Andrew Pinski
Hi, After SSA-expand, the code which did the optimization for (a&(1<>C)&1 became not working because BIT_AND_EXPR would no longer be in there. This patch fixes the problem by using get_def_for_expr to get the BIT_AND_EXPR. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. T