insn_code icode = CODE_FOR_nothing;
tree elt;
tree elttype = TREE_TYPE (type);
- int elt_size = tree_to_uhwi (TYPE_SIZE (elttype));
+ int elt_size = vector_element_bits (type);
machine_mode eltmode = TYPE_MODE (elttype);
HOST_WIDE_INT bitsize;
HOST_WIDE_INT bitpos;
}
}
+ /* Compute the size of the elements in the CTOR. It differs
+ from the size of the vector type elements only when the
+ CTOR elements are vectors themselves. */
+ tree val_type = TREE_TYPE (CONSTRUCTOR_ELT (exp, 0)->value);
+ if (VECTOR_TYPE_P (val_type))
+ bitsize = tree_to_uhwi (TYPE_SIZE (val_type));
+ else
+ bitsize = elt_size;
+
/* If the constructor has fewer elements than the vector,
clear the whole array first. Similarly if this is static
constructor of a non-BLKmode object. */
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value)
{
- tree sz = TYPE_SIZE (TREE_TYPE (value));
- int n_elts_here
- = tree_to_uhwi (int_const_binop (TRUNC_DIV_EXPR, sz,
- TYPE_SIZE (elttype)));
-
+ int n_elts_here = bitsize / elt_size;
count += n_elts_here;
if (mostly_zeros_p (value))
zero_count += n_elts_here;
HOST_WIDE_INT eltpos;
tree value = ce->value;
- bitsize = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (value)));
if (cleared && initializer_zerop (value))
continue;
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-mavx512vl -mavx512bw" } */
+/* { dg-require-effective-target avx512bw } */
+/* { dg-require-effective-target avx512vl } */
+
+typedef unsigned char __attribute__ ((__vector_size__ (32))) V;
+
+void
+test (void)
+{
+ V x = ((V){8} > 0) == 0;
+ for (unsigned i = 0; i < sizeof (x); i++)
+ if (x[i] != (i ? 0xff : 0)) __builtin_abort();
+}
+
+#define DO_TEST test
+#define AVX512VL
+#define AVX512BW
+#include "avx512-check.h"