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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
> I think we can go and for a generic V16QImode CTOR and SSE2 create two
> V8HImode vectors using pinsrw, for the first from zero-extended QImode
> values of the even elements and for the second from zero-extended and
> left-shifted values of the odd elements and then IOR the two vectors.

Or the backend can recognize as as a HImode(b,c) broadcast + HImode(d,e)
vec_set(the middle end can recognize it as VEC_DUPLICATE_EXPR +
.VEC_SET/BIT_INSERT_EXPR when available?)


void foo1(short* a, char *m)
{
  char d = *m;
  char e = m[2];
  short b = d | e << 8;
  a[0] = b;
  a[1] = b;
  a[2] = b;
  a[3] = b;
  a[4] = b;
  a[5] = b;
  a[6] = b;
  a[7] = b;
}

foo1:
        movsbw  2(%rsi), %ax
        movsbw  (%rsi), %dx
        sall    $8, %eax
        orl     %edx, %eax
        movd    %eax, %xmm0
        punpcklwd       %xmm0, %xmm0
        pshufd  $0, %xmm0, %xmm0
        movups  %xmm0, (%rdi)
        ret

Reply via email to