https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96918
Bug ID: 96918
Summary: Failure to optimize vector shift left+shift right+or
to pshuf
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
typedef __INT16_TYPE__ v8i16 __attribute__((vector_size(16)));
typedef char v16i8 __attribute__((vector_size(16)));
v8i16 bswap_epi16(v8i16 x)
{
return __builtin_ia32_psllwi128(x, 8) | __builtin_ia32_psrlwi128(x, 8);
}
This can be optimized to `return (v8i16)__builtin_ia32_pshufb128((v16i8)x,
v16i8{1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14});`. This
transformation is done by LLVM, but not by GCC.