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

            Bug ID: 92923
           Summary: __builtin_vec_xor() causes subregs to be used when not
                    using V4SImode vectors
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bergner at gcc dot gnu.org
  Target Milestone: ---

The following shows a problem when expanding the __builtin_vec_xor() builtin
function.  We seems to always use V4SImode rather than the vector integer mode
being used.  That causes subregs to be used in the rtl passes, which is
hindering optimiations:

bergner@pike:~/gcc/BUGS$ cat bug.i
typedef __attribute__((altivec(vector__))) unsigned char vec_t;

vec_t
foo (vec_t x, vec_t y)
{
  return __builtin_vec_xor (x, y);
}

vec_t
bar (vec_t x, vec_t y)
{
  return x ^ y;
}
bergner@pike:~/gcc/BUGS$ gcc -S -O2 bug.i -fdump-tree-all
bergner@pike:~/gcc/BUGS$ cat bug.i.005t.gimple 
foo (vec_t x, vec_t y)
{
  vec_t D.2848;

  _1 = VIEW_CONVERT_EXPR<__vector signed int>(x);
  _2 = VIEW_CONVERT_EXPR<__vector signed int>(y);
  _3 = __builtin_altivec_vxor (_1, _2);
  D.2848 = VIEW_CONVERT_EXPR<vec_t>(_3);
  return D.2848;
}


bar (vec_t x, vec_t y)
{
  vec_t D.2850;

  D.2850 = x ^ y;
  return D.2850;
}

Reply via email to