return true;
}
+/* Returns true if the vector's elements are all duplicates in
+ range -16 ~ 15 integer or 0.0 floating-point. */
+
+bool
+valid_vec_immediate_p (rtx x)
+{
+ return (satisfies_constraint_vi (x) || satisfies_constraint_Wc0 (x));
+}
+
/* Return a const vector of VAL. The VAL can be either const_int or
const_poly_int. */
{
/* Element in range -16 ~ 15 integer or 0.0 floating-point,
we use vmv.v.i instruction. */
- if (satisfies_constraint_vi (src) || satisfies_constraint_Wc0 (src))
+ if (valid_vec_immediate_p (src))
{
rtx ops[] = {result, src};
emit_vlmax_insn (code_for_pred_mov (mode), UNARY_OP, ops);
unsigned int m_inner_bytes_size;
};
+extern bool valid_vec_immediate_p(rtx);
+
} // namespace riscv_vector
#endif // GCC_RISCV_V_H
if (maybe_gt (GET_MODE_SIZE (smode), UNITS_PER_WORD)
&& !immediate_operand (elt, Pmode))
return 0;
- /* Constants from -16 to 15 can be loaded with vmv.v.i.
- The Wc0, Wc1 constraints are already covered by the
- vi constraint so we do not need to check them here
- separately. */
- if (satisfies_constraint_vi (x))
+ /* Constants in range -16 ~ 15 integer or 0.0 floating-point
+ can be emitted using vmv.v.i. */
+ if (valid_vec_immediate_p (x))
return 1;
/* Any int/FP constants can always be broadcast from a