https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92658
Bug ID: 92658
Summary: x86 lacks vector extend / truncate
Product: gcc
Version: 10.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: ---
After
2019-11-14 Richard Sandiford <[email protected]>
* tree-cfg.c (verify_gimple_assign_unary): Handle conversions
between vector types.
* tree-vect-stmts.c (vectorizable_conversion): Extend the
non-widening and non-narrowing path to handle standard
conversion codes, if the target supports them.
* expr.c (convert_move): Try using the extend and truncate optabs
for vectors.
* optabs-tree.c (supportable_convert_operation): Likewise.
* config/aarch64/iterators.md (Vnarroqw): New iterator.
* config/aarch64/aarch64-simd.md (<optab><Vnarrowq><mode>2)
(trunc<mode><Vnarrowq>2): New patterns.
it would now be possible to BB vectorize the following but the x86 backend
lacks appropriate patterns for the vector mode variants (here V8HI -> V8QI
narrowing).
typedef unsigned char v16qi __attribute__((vector_size(16)));
typedef unsigned short v8hi __attribute__((vector_size(16)));
void bar (v8hi *dst, v16qi * __restrict src)
{
unsigned short tem[8];
tem[0] = (*src)[0];
tem[1] = (*src)[1];
tem[2] = (*src)[2];
tem[3] = (*src)[3];
tem[4] = (*src)[4];
tem[5] = (*src)[5];
tem[6] = (*src)[6];
tem[7] = (*src)[7];
dst[0] = *(v8hi *)tem;
}
void foo (v8hi *dst, v16qi src)
{
unsigned short tem[8];
tem[0] = src[0];
tem[1] = src[1];
tem[2] = src[2];
tem[3] = src[3];
tem[4] = src[4];
tem[5] = src[5];
tem[6] = src[6];
tem[7] = src[7];
dst[0] = *(v8hi *)tem;
}