Update vec_duplicate to allow to fail so that backend can only allow
broadcasting an integer constant to a vector when broadcast instruction
is available.
* expr.c (store_constructor): Replace expand_insn with
maybe_expand_insn for vec_duplicate_optab.
* doc/md.texi: Update vec_duplicate.
---
gcc/doc/md.texi | 2 --
gcc/expr.c | 10 ++++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 00caf3844cc..e66c41c4779 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -5077,8 +5077,6 @@ the mode appropriate for one element of @var{m}.
This pattern only handles duplicates of non-constant inputs. Constant
vectors go through the @code{mov@var{m}} pattern instead.
-This pattern is not allowed to @code{FAIL}.
-
@cindex @code{vec_series@var{m}} instruction pattern
@item @samp{vec_series@var{m}}
Initialize vector output operand 0 so that element @var{i} is equal to
diff --git a/gcc/expr.c b/gcc/expr.c
index e4660f0e90a..3107c32f259 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7075,10 +7075,12 @@ store_constructor (tree exp, rtx target, int cleared,
poly_int64 size,
class expand_operand ops[2];
create_output_operand (&ops[0], target, mode);
create_input_operand (&ops[1], expand_normal (elt), eltmode);
- expand_insn (icode, 2, ops);
- if (!rtx_equal_p (target, ops[0].value))
- emit_move_insn (target, ops[0].value);
- break;
+ if (maybe_expand_insn (icode, 2, ops))
+ {
+ if (!rtx_equal_p (target, ops[0].value))
+ emit_move_insn (target, ops[0].value);
+ break;
+ }
}
n_elts = TYPE_VECTOR_SUBPARTS (type);
--
2.31.1