{
unsigned HOST_WIDE_INT idx;
constructor_elt *ce;
- int i;
bool need_to_clear;
insn_code icode = CODE_FOR_nothing;
tree elt;
tree elttype = TREE_TYPE (type);
int elt_size = vector_element_bits (type);
machine_mode eltmode = TYPE_MODE (elttype);
- HOST_WIDE_INT bitsize;
- HOST_WIDE_INT bitpos;
+ poly_int64 bitsize;
+ poly_int64 bitpos;
rtvec vector = NULL;
poly_uint64 n_elts;
unsigned HOST_WIDE_INT const_n_elts;
? TREE_TYPE (CONSTRUCTOR_ELT (exp, 0)->value)
: elttype);
if (VECTOR_TYPE_P (val_type))
- bitsize = tree_to_uhwi (TYPE_SIZE (val_type));
+ bitsize = tree_to_poly_uint64 (TYPE_SIZE (val_type));
else
bitsize = elt_size;
need_to_clear = true;
else
{
- unsigned HOST_WIDE_INT count = 0, zero_count = 0;
+ poly_uint64 count = 0, zero_count = 0;
tree value;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value)
{
- int n_elts_here = bitsize / elt_size;
+ poly_int64 n_elts_here = exact_div (bitsize, elt_size);
count += n_elts_here;
if (mostly_zeros_p (value))
zero_count += n_elts_here;
/* Clear the entire vector first if there are any missing elements,
or if the incidence of zero elements is >= 75%. */
need_to_clear = (maybe_lt (count, n_elts)
- || 4 * zero_count >= 3 * count);
+ || maybe_gt (4 * zero_count, 3 * count));
}
if (need_to_clear && maybe_gt (size, 0) && !vector)
/* Store each element of the constructor into the corresponding
element of TARGET, determined by counting the elements. */
- for (idx = 0, i = 0;
- vec_safe_iterate (CONSTRUCTOR_ELTS (exp), idx, &ce);
- idx++, i += bitsize / elt_size)
+ HOST_WIDE_INT chunk_size = 0;
+ bool chunk_multiple_p = constant_multiple_p (bitsize, elt_size,
+ &chunk_size);
+ gcc_assert (chunk_multiple_p || vec_vec_init_p);
+
+ for (idx = 0; vec_safe_iterate (CONSTRUCTOR_ELTS (exp), idx, &ce);
+ idx++)
{
HOST_WIDE_INT eltpos;
tree value = ce->value;
if (ce->index)
eltpos = tree_to_uhwi (ce->index);
else
- eltpos = i;
+ eltpos = idx * chunk_size;
if (vector)
{
if (size_tree != 0)
{
- if (! tree_fits_uhwi_p (size_tree))
+ if (!poly_int_tree_p (size_tree, pbitsize))
mode = BLKmode, *pbitsize = -1;
- else
- *pbitsize = tree_to_uhwi (size_tree);
}
*preversep = reverse_storage_order_for_component_p (exp);