This is a proposed patch for the bug 79794 which I just submitted. This isn't a regression, so this can wait for after the gcc 7 branch if necessary. The problem here is that a reg+offset MEM target is passed to extract_bit_field with a vector register source. On aarch64, we have an instruction for this, but it accepts a reg address only, so the address gets loaded into a reg inside extract_bit_field. We then return to expand_expr which does ! rtx_equal_p (temp, target) which fails because of the address mode change, so we end up copying target into a reg and then back to itself. expand_expr has a solution for this problem. There is an alt_rtl variable that can be set when temp is logically the same as target. This variable is currently not passed into extract_bit_field. This patch does that. There is an additional complication that the actual address load into a reg occurs inside maybe_expand_insn, and it doesn't seem reasonable to pass alt_reg into that. However, I can grab a bit from the expand_operand structure to indicate when an operand is the target, and then clear it if target is replaced with a reg. The resulting patch works, but ends up a bit more invasive than I hoped. The patch has passed a bootstrap and make check test on x86_64 and aarch64. Jim