https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101529
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Patch which I am testing: diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 2c00583e12c..d5b0cb7ae2f 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -23084,11 +23084,15 @@ aarch64_evpc_ins (struct expand_vec_perm_d *d) } gcc_assert (extractindex < nelt); - emit_move_insn (d->target, insv); + /* Use a new reg instead of target as one of the + operands might be target. */ + rtx original = gen_reg_rtx (GET_MODE (insv)); + + emit_move_insn (original, insv); insn_code icode = code_for_aarch64_simd_vec_copy_lane (mode); expand_operand ops[5]; create_output_operand (&ops[0], d->target, mode); - create_input_operand (&ops[1], d->target, mode); + create_input_operand (&ops[1], original, mode); create_integer_operand (&ops[2], 1 << idx); create_input_operand (&ops[3], extractv, mode); create_integer_operand (&ops[4], extractindex);