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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
And with less convoluted vectorized code but still broken (avoids integer
promotions):

extern void abort (void);

static void
foo (int *out, const int *lp, const int *hp, unsigned samples)
{
  int x, target;
  for (x = 0, target = 0; x < (int)samples; x += 2, target++)
    {
      out[x + 0] = lp[target] - ((hp[target] + hp[target - 1] + 2) >> 2);
      out[x - 1] = hp[target - 1] + ((out[x - 2] + out[x]) >> 1);
    }
}

int main(void)
{
  const int lp[25] = {
      0, 2, 4, 6, 8,
      10, 12, 14, 16,
      18, 20, 22, 24,
      26, 28, 30, 32,
      34, 36, 38, 40,
      42, 44, 46, 48,
  };
  const int hp[25] = {0};
  int out[49] = {0};
  int s;

  out[0] = lp[0] - (((hp[0] << 1) + 2) >> 2);
  foo (out + 2, lp + 1, hp + 1, 48);

  for (s = 0; s < 49; s++)
    if (out[s] != s)
      abort ();

  return 0;
}

Reply via email to