This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: common branch conditions - could optimize better
- To: Sergei Ivanov <svivanov at pdmi dot ras dot ru>
- Subject: Re: common branch conditions - could optimize better
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Thu, 16 Dec 1999 02:11:45 -0700
- cc: gcc at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
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 just
fine on my PA target.
jeff