https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91293

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Equivalent testcase that doesn't run into the operator swapping and thus works:

long long a;
unsigned b, c;
int d = 62;
void e(long long *f, int p2) { *f = p2; }
int xx = 5, yy = 4;
int main()
{
  for (int g = 2; g <= d; g++)
    {
      c += xx - g;
      b += yy + g;
    }
  e(&a, b);
  if (a != 2196)
    __builtin_abort ();
  return 0;
}

swapping operands confuses reduction code-generation.  It would probably
be "easiest" to not swap operands in this case. This results in no longer
vectorizing this in an optimal way but is probably the way to go for release
branches.

Reply via email to