[Bug tree-optimization/97081] wrong code for rotate vectorization (x86 target)

2020-09-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97081

Richard Biener  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #3 from Richard Biener  ---
The following aborts with vectorization enabled:

#define EXEC_ROR2(a, b, sz) (a >> b) | (a << (64 - b))
#define TYPE unsigned long

void __attribute__((noipa))
exec_VRORudi_i(TYPE *__restrict__ pvd,
   TYPE *__restrict__ const pva, unsigned char IMM)
{
  unsigned char I2 = IMM & 63;

  for (unsigned i = 0; i < 4; i++)
pvd[i] = EXEC_ROR2(pva[i], I2, 8);
}

int main()
{
  TYPE pvd[4], pva[4] = { 0x0102030405060708, 0x0102030405060708,
0x0102030405060708, 0x0102030405060708 };
  exec_VRORudi_i (pvd, pva, 7);
  if (pvd[0] != 0x10020406080a0c0e)
__builtin_abort ();
  return 0;
}


creates

  patt_9 = -_25;
  patt_8 = patt_9 & 31;
  vect_patt_27.7_28 = vect__4.6_5 >> _25;
  vect_patt_22.8_29 = vect__4.6_5 << patt_8;
  vect_patt_23.9_30 = vect_patt_27.7_28 | vect_patt_22.8_29;
  _7 = _4 r>> _25;


I have a patch.

[Bug tree-optimization/97081] wrong code for rotate vectorization (x86 target)

2020-09-17 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97081

Richard Biener  changed:

   What|Removed |Added

   Last reconfirmed||2020-09-17
 Ever confirmed|0   |1
 Target||x86_64-*-* i?86-*-*
   Keywords||needs-bisection
 Status|UNCONFIRMED |NEW

--- Comment #2 from Richard Biener  ---
Would be nice to have a executable testcase that aborts when miscompiled. 
Sofar I can confirm your observation.

[Bug tree-optimization/97081] wrong code for rotate vectorization (x86 target)

2020-09-16 Thread igor at tachyum dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97081

--- Comment #1 from Igor Shevlyakov  ---
vect_recog_rotate_pattern()

seems to be the culprit