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

            Bug ID: 116971
           Summary: Some missed vec_perm_const
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Without SSSE3 (pshufb) we can only handle 'foo' and not the equivalent 'bar'.
I'm not sure the backend should be responsible here if it's about no support
vs. support but it might also be about cost - for example with SSE4.2 we use

foo:
.LFB0:
        .cfi_startproc
        movdqa  %xmm0, %xmm3
        pxor    %xmm2, %xmm2
        movdqa  %xmm2, %xmm0
        pblendw $85, %xmm3, %xmm0
        pblendw $85, %xmm1, %xmm2
        packusdw        %xmm2, %xmm0
        ret

but

bar:
.LFB1:
        .cfi_startproc
        pshufb  .LC0(%rip), %xmm0
        pshufb  .LC1(%rip), %xmm1
        por     %xmm1, %xmm0
        ret

--

typedef unsigned short v8hi __attribute__((vector_size(16)));

v8hi foo (v8hi a, v8hi b)
{
  return __builtin_shufflevector (a, b, 0, 2, 4, 6, 8, 10, 12, 14);
}

typedef unsigned char v16qi __attribute__((vector_size(16)));

v16qi bar (v16qi a, v16qi b)
{
  return __builtin_shufflevector (a, b, 0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20,
21, 24, 25, 28, 29);
}

Reply via email to