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

--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
The culprit assertion is based on one assumption, for one given VEC_PERM_EXPR
expression, if the type of permutation control vector and the type of
permutation operand is the same, and it's foldable, then it's done previously.
But from this case, this is not true.

For example, for the case

int8x8_t fn1(int8x8_t val20, char tmp) {
  int8x8_t __a = (int8x8_t){tmp};
  return __builtin_shuffle(__a, val20, (int8x8_t){0, 1, 2, 3, 4, 5, 6, 7});
}

we can get

int8x8_t fn1 (int8x8_t val20, char tmp)
{
  int8x8_t __a;

  <bb 2> :
  __a_2 = {tmp_1(D)};
  return __a_2;

}

before forwprop, while for the case

int8x8_t fn1(int8x8_t val20, char tmp) {
  int8x8_t __a = (int8x8_t){tmp};
  return __builtin_shuffle(__a, val20, (int8x8_t){0, 1, 2, 3, 0, 1, 2, 3});
}

we only get the below before forwprop,

int8x8_t fn1 (int8x8_t val20, char tmp)
{
  int8x8_t __a;
  int8x8_t _3;

  <bb 2> :
  __a_2 = {tmp_1(D)};
  _3 = VEC_PERM_EXPR <__a_2, __a_2, { 0, 1, 2, 3, 0, 1, 2, 3 }>;
  return _3;

}

After remove the assertion there, we can get below immediately at forwprop.

int8x8_t fn1 (int8x8_t val20, char tmp)
{
  int8x8_t __a;
  int8x8_t _3;

  <bb 2> :
  __a_2 = {tmp_1(D)};
  _3 = {tmp_1(D), 0, 0, 0, tmp_1(D), 0, 0, 0};
  return _3;

}

I think we should remove this assertion.

Reply via email to