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

            Bug ID: 115813
           Summary: missing constant evaluation for vectors
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andi-gcc at firstfloor dot org
  Target Milestone: ---

typedef int v4si __attribute__((vector_size(16)));

v4si v(v4si x)
{
        x = (x <<  1) | 1;
        x = (x <<  1) | 1;
        return x;
}

gives

        movdqa  .LC0(%rip), %xmm1
        pslld   $1, %xmm0
        por     %xmm1, %xmm0
        pslld   $1, %xmm0
        por     %xmm1, %xmm0
        ret


but I would have expected the compiler to combine the two shifts and ors, like
it happens for scalar operations.

Reply via email to