https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790
--- Comment #12 from YunQiang Su <syq at gcc dot gnu.org> --- You are right: the decision to use $6 is too late. So let's force to use it in expand pass. ``` diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index b63d40a357b..84ff29cd62b 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -3318,7 +3318,11 @@ mips16_gp_pseudo_reg (void) { rtx_insn *scan; - cfun->machine->mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode); + if (TARGET_USE_GOT) + cfun->machine->mips16_gp_pseudo_rtx + = gen_rtx_REG (Pmode, POST_CALL_TMP_REG); + else + cfun->machine->mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode); push_topmost_sequence (); ```