i386: Use movss to implement V2SImode VEC_PERM.
commit4bcc3b5cc87505d13cda82846db2e223a9b41f79
authorUros Bizjak <ubizjak@gmail.com>
Tue, 14 Mar 2023 17:41:06 +0000 (14 18:41 +0100)
committerUros Bizjak <ubizjak@gmail.com>
Tue, 14 Mar 2023 17:41:06 +0000 (14 18:41 +0100)
treeeaf8e52311c230948c2f014b3ca3519e1e400815
parent7f22d1c83e74c41116300bebac2e4c492c90b03d
i386: Use movss to implement V2SImode VEC_PERM.

Perform V2SI vector permutation in the same way as existing V2SF for
TARGET_MMX_WITH_SSE targets. The testcase:

typedef unsigned int v2si __attribute__((vector_size(8)));
v2si foo(v2si x, v2si y) { return (v2si){y[0], x[1]}; }

is currently compiled to (-O2):

foo:
movdqa  %xmm0, %xmm2
movdqa  %xmm1, %xmm0
pshufd  $0xe5, %xmm2, %xmm2
punpckldq %xmm2, %xmm0
ret

and with the patched compiler:

foo:
movss   %xmm1, %xmm0
ret

The functionality is already tested in gcc.target/i386/vperm-v2si.c

gcc/ChangeLog:

* config/i386/i386-expand.cc (expand_vec_perm_movs):
Handle V2SImode for TARGET_MMX_WITH_SSE.
* config/i386/mmx.md (*mmx_movss_<mode>): Rename from *mmx_movss
using V2FI mode iterator to handle both V2SI and V2SF modes.
gcc/config/i386/i386-expand.cc
gcc/config/i386/mmx.md