+2017-11-09 Richard Sandiford <richard.sandiford@linaro.org>
+
+ * doc/rtl.texi (const_vector): Say that elements can be
+ const_wide_ints too.
+ * emit-rtl.h (valid_for_const_vec_duplicate_p): Declare.
+ * emit-rtl.c (valid_for_const_vec_duplicate_p): New function.
+ (gen_vec_duplicate): Use it instead of CONSTANT_P.
+ * optabs.c (expand_vector_broadcast): Likewise.
+
2017-11-09 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
@item (const_vector:@var{m} [@var{x0} @var{x1} @dots{}])
Represents a vector constant. The square brackets stand for the vector
containing the constant elements. @var{x0}, @var{x1} and so on are
-the @code{const_int}, @code{const_double} or @code{const_fixed} elements.
+the @code{const_int}, @code{const_wide_int}, @code{const_double} or
+@code{const_fixed} elements.
The number of units in a @code{const_vector} is obtained with the macro
@code{CONST_VECTOR_NUNITS} as in @code{CONST_VECTOR_NUNITS (@var{v})}.
#endif
}
+/* Return true if X is a valid element for a duplicated vector constant
+ of the given mode. */
+
+bool
+valid_for_const_vec_duplicate_p (machine_mode, rtx x)
+{
+ return (CONST_SCALAR_INT_P (x)
+ || CONST_DOUBLE_AS_FLOAT_P (x)
+ || CONST_FIXED_P (x));
+}
+
/* Like gen_const_vec_duplicate, but ignore const_tiny_rtx. */
static rtx
rtx
gen_vec_duplicate (machine_mode mode, rtx x)
{
- if (CONSTANT_P (x))
+ if (valid_for_const_vec_duplicate_p (mode, x))
return gen_const_vec_duplicate (mode, x);
return gen_rtx_VEC_DUPLICATE (mode, x);
}
return crtl->emit.x_cur_insn_uid;
}
+extern bool valid_for_const_vec_duplicate_p (machine_mode, rtx);
extern rtx gen_const_vec_duplicate (machine_mode, rtx);
extern rtx gen_vec_duplicate (machine_mode, rtx);
gcc_checking_assert (VECTOR_MODE_P (vmode));
- if (CONSTANT_P (op))
+ if (valid_for_const_vec_duplicate_p (vmode, op))
return gen_const_vec_duplicate (vmode, op);
/* ??? If the target doesn't have a vec_init, then we have no easy way