Tamar Christina <tamar.christ...@arm.com> writes: > diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c > index > 5df5a8b78439e69705e62845a4d1f86166a01894..59f03e688e58c1aab37629555c7b3f19e5075935 > 100644 > --- a/gcc/config/aarch64/aarch64.c > +++ b/gcc/config/aarch64/aarch64.c > @@ -3414,6 +3414,14 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm, > void > aarch64_emit_sve_pred_move (rtx dest, rtx pred, rtx src) > { > + /* Make sure that the address is legitimate. */ > + if (MEM_P (dest) > + && !aarch64_sve_struct_memory_operand_p (dest)) > + { > + rtx addr = force_reg (Pmode, XEXP (dest, 0)); > + dest = replace_equiv_address (dest, addr); > + } > + > emit_insn (gen_rtx_SET (dest, gen_rtx_UNSPEC (GET_MODE (dest), > gen_rtvec (2, pred, src), > UNSPEC_MERGE_PTRUE)));
I think the same thing could happen for the src as well as dest. The function is also used for single-vector modes, not just struct modes. This code predated the support for "@" patterns. Now that we have them, it might be better to make: (define_insn "*pred_mov<mode>" [(set (match_operand:SVE_ALL 0 "nonimmediate_operand" "=w, m") (unspec:SVE_ALL [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl") (match_operand:SVE_ALL 2 "nonimmediate_operand" "m, w")] UNSPEC_MERGE_PTRUE))] and: (define_insn_and_split "pred_mov<mode>" [(set (match_operand:SVE_STRUCT 0 "aarch64_sve_struct_nonimmediate_operand" "=w, Utx") (unspec:SVE_STRUCT [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl") (match_operand:SVE_STRUCT 2 "aarch64_sve_struct_nonimmediate_operand" "Utx, w")] UNSPEC_MERGE_PTRUE))] public as "@aarch64_pred_mov<mode>" ("aarch64_" so that we don't pollute the target-independent namespace). Then we can use something like: expand_operand ops[3]; create_output_operand (&ops[0], dest, mode); create_input_operand (&ops[1], pred, GET_MODE (pred)); create_input_operand (&ops[2], src, mode); expand_insn (code_for_aarch64_pred_mov (mode), 3, ops); (completely untested). Thanks, Richard