This is the mail archive of the gcc@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]

Re: common branch conditions - could optimize better


  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


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