------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2004-05-27 
22:59 -------
(In reply to comment #7)
> Note on the mainline now the loops are empty which is correct.
> This testcase will produce code but I cannot reproduce this on PPC or on x86:
[snip]

> Does this still happen on SPARC also?

Not with this example, tree-ssa is too smart and sees almost everything as dead
code, here is a slightly modified one: 

#ifdef MY_PURE
extern  double mycos (double) __attribute__ ((pure));
extern  double mysin (double) __attribute__ ((pure));
#elif defined MY_CONST
extern  double mycos (double) __attribute__ ((const));
extern  double mysin (double) __attribute__ ((const));
#else
extern  double mycos (double);
extern  double mysin (double);
#endif
struct my_complex
{
  double re;
  double im;
};

void
foo (struct my_complex u[])
{
  int i;
  for (i = 0; i < 2048; ++i)
    {
      u[i].re = 1.0;
      u[i].im = 0.0;
    }

  for (i = 0; i < 2048; ++i) {
    struct my_complex *p = u;
    unsigned int j;
    for (j = 0; j < 2048; ++j) {
      double ur = p->re;
      double ui = p->im;
      double u2 = ur * ur + ui * ui;
      double cosv = mycos (u2);
      double sinv = mysin (u2);
      p->re = p->re * cosv - p->im * sinv;
      p->im = p->im * sinv +  p->re * cosv;
      ++p;
    }
  }
}

the difference between the MY_CONST/PURE code and the one without is smaller,
but it _still_ exists, the MY_CONST/PURE code has 2 extra stores. 




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5739

Reply via email to