common branch conditions - could optimize better
Jeffrey A Law
law@cygnus.com
Thu Dec 16 02:08:00 GMT 1999
In message <19991216113512.A31064@horac.ta.jcu.cz>you write:
> On Thu, Dec 16, 1999 at 02:11:45AM -0700, Jeffrey A Law wrote:
> > In message <Pine.LNX.4.10.9910160739260.1293-100000@first>you write:
> > > Hello GCC people
> > >
> > > Consider the following code:
> > >
> > > void f1(void), f2(void), f3(void);
> > > void foo (int x, int y)
> > > {
> > > if (x*x*x<y*y)
> > > f1();
> > > else
> > > f2();
> > > if (x*x*x<y*y)
> > > f3();
> > > }
> > >
> > > Here the condition x*x*x<y*y could be tested only once.
> > > GCC 2.95.1 does not optimize this - see below the asm,
> > > produced with gcc -O2 -S on i586-linux.
> > > Even x*x*x and y*y are computed twice... what is that gcse thing then
> ?
> > It's got to be something goofy about the ia32 target, they're removed jus
> t
> > fine on my PA target.
>
> It is because of gcse is unable to handle parallels used by x86 to model
> flags. I've made some progress in this path (for cprop only for now),
> but first part (to propagate from parallels) got refused (it is not issue
> for x86 after my mov patterns cleanups anyway) and second part (to propagat
> e
> to parallels) wasn't reviewed yet.
No. That is not the cause. Go back to gcc-2.95 and try it like the report
mentions. Remember gcc-2.95 did not have the new ia32 backend.
jeff
More information about the Gcc
mailing list