and operand 1 is parallel containing values for individual fields. The
@var{n} mode is the mode of the elements, should be either element mode of
the vector mode @var{m}, or a vector mode with the same element mode and
-smaller number of elements.
+smaller number of elements. If @var{m} specifies a scalable vector mode,
+then operand 1 only specifies the minimum number of elements implied
+by @var{m} and elements beyond are zero initialized.
@mdindex vec_duplicate@var{m}
@item @samp{vec_duplicate@var{m}}
return count;
}
-
/* Store the value of constructor EXP into the rtx TARGET.
TARGET is either a REG or a MEM; we know it cannot conflict, since
safe_from_p has been called.
CLEARED is true if TARGET is known to have been zero'd.
+ If the constructor EXP has a vector type then elements of TARGET for which
+ there is no corresponding element in EXP are zero'd. For a variable-length
+ vector type, only elements up to the minimum number of subparts of the type
+ are explicitly zero'd; any elements beyond that are implicitly zero.
SIZE is the number of bytes of TARGET we are allowed to modify: this
may not be the same as the size of EXP if we are assigning to a field
which has been packed to exclude padding bits.
similarly non-const type vectors. */
icode = convert_optab_handler (vec_init_optab, mode, eltmode);
}
+ else
+ {
+ /* Handle variable-length vector types. */
+ icode = convert_optab_handler (vec_init_optab, mode, eltmode);
+ const_n_elts = constant_lower_bound (n_elts);
+ }
- if (const_n_elts && icode != CODE_FOR_nothing)
- {
- vector = rtvec_alloc (const_n_elts);
- for (unsigned int k = 0; k < const_n_elts; k++)
- RTVEC_ELT (vector, k) = CONST0_RTX (eltmode);
- }
+ if (const_n_elts && icode != CODE_FOR_nothing)
+ {
+ vector = rtvec_alloc (const_n_elts);
+ for (unsigned int k = 0; k < const_n_elts; k++)
+ RTVEC_ELT (vector, k) = CONST0_RTX (eltmode);
+ }
}
+ else
+ gcc_assert (n_elts.is_constant ());
/* Compute the size of the elements in the CTOR. It differs
from the size of the vector type elements only when the
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#include <arm_sve.h>
+
+/*
+** func_init4:
+** mov z0\.d, x1
+** insr z0\.d, x0
+** ret
+*/
+svint64_t __attribute__ ((noipa))
+func_init4 (int64_t a, int64_t b)
+{
+ svint64_t temp = { a, b };
+ return temp;
+}
+
+/*
+** func_init3:
+** fmov s0, w2
+** fmov s0, s0
+** insr z0\.s, w1
+** insr z0\.s, w0
+** ret
+*/
+svint32_t __attribute__ ((noipa))
+func_init3 (int32_t a, int32_t b, int32_t c)
+{
+ svint32_t temp = { a, b, c };
+ return temp;
+}