--- /dev/null
+// PR target/95528
+// { dg-do compile { target c++11 } }
+// { dg-options "-O3" }
+// { dg-additional-options "-march=skylake-avx512" { target i?86-*-*- x86_64-*-* } }
+
+template <typename a> struct b {
+ typedef a c __attribute__((vector_size(sizeof(a) * 4)));
+ union {
+ c d;
+ struct {
+ a e, f, g, h;
+ };
+ };
+ b();
+ b(const b &i) : d(i.d) {}
+ static b j(c);
+ template <typename k> operator b<k>() {
+ b<k>::j(typename b<k>::c{k(e), k(f), k(g), k(h)});
+ return b<k>();
+ }
+};
+template <typename a> using l = b<a>;
+using m = l<char>;
+using n = l<short>;
+m o(n i) { return i; }
+b<short> q;
+void p() { o(q); }
&& (dblvectype
= build_vector_type (TREE_TYPE (TREE_TYPE (orig[0])),
nelts * 2))
+ /* Only use it for vector modes or for vector booleans represented
+ as scalar bitmasks. See PR95528. */
+ && (VECTOR_MODE_P (TYPE_MODE (dblvectype))
+ || VECTOR_BOOLEAN_TYPE_P (dblvectype))
&& (optab = optab_for_tree_code (FLOAT_TYPE_P (TREE_TYPE (type))
? VEC_UNPACK_FLOAT_LO_EXPR
: VEC_UNPACK_LO_EXPR,
&& (halfvectype
= build_vector_type (TREE_TYPE (TREE_TYPE (orig[0])),
nelts / 2))
+ /* Only use it for vector modes or for vector booleans
+ represented as scalar bitmasks, or allow halfvectype
+ be the element mode. See PR95528. */
+ && (VECTOR_MODE_P (TYPE_MODE (halfvectype))
+ || VECTOR_BOOLEAN_TYPE_P (halfvectype)
+ || (TYPE_MODE (halfvectype)
+ == TYPE_MODE (TREE_TYPE (halfvectype))))
&& (optab = optab_for_tree_code (VEC_PACK_TRUNC_EXPR,
halfvectype,
optab_default))