diff options
-rw-r--r-- | gcc/fold-const.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr100887.c | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 33d64bf..6e5835a 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -15471,6 +15471,9 @@ fold_read_from_vector (tree arg, poly_uint64 idx) return VECTOR_CST_ELT (arg, i); else if (TREE_CODE (arg) == CONSTRUCTOR) { + if (CONSTRUCTOR_NELTS (arg) + && VECTOR_TYPE_P (TREE_TYPE (CONSTRUCTOR_ELT (arg, 0)->value))) + return NULL_TREE; if (i >= CONSTRUCTOR_NELTS (arg)) return build_zero_cst (TREE_TYPE (TREE_TYPE (arg))); return CONSTRUCTOR_ELT (arg, i)->value; diff --git a/gcc/testsuite/gcc.dg/pr100887.c b/gcc/testsuite/gcc.dg/pr100887.c new file mode 100644 index 0000000..de6b3ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr100887.c @@ -0,0 +1,14 @@ +/* PR target/100887 */ +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-additional-options "-mavx512f" { target { i?86-*-* x86_64-*-* } } } */ + +typedef unsigned long long __attribute__((__vector_size__ (2 * sizeof (long long)))) U; +typedef unsigned long long __attribute__((__vector_size__ (4 * sizeof (long long)))) V; +typedef unsigned long long __attribute__((__vector_size__ (8 * sizeof (long long)))) W; + +U +foo (V v) +{ + return __builtin_shufflevector ((W){}, v, 0, 8); +} |