From: Jim Wilson Date: Thu, 27 Apr 1995 22:50:50 +0000 (-0700) Subject: (expand_return): When returning BLKmode structure... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af55da56a5b64e4e043933007dea8ad1e90a7659;p=gcc.git (expand_return): When returning BLKmode structure... (expand_return): When returning BLKmode structure, use operand_subword instead of doing arithmetic on the register number. Also, for structures smaller than word_mode, copy it into a word_mode temporary and then subreg it. From-SVN: r9516 --- diff --git a/gcc/stmt.c b/gcc/stmt.c index ac8683b8c85..6b2e80b6ba3 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2694,7 +2694,7 @@ expand_return (retval) rtx *result_pseudos = (rtx *) alloca (sizeof (rtx) * n_regs); rtx result_reg; rtx result_val = expand_expr (retval_rhs, NULL_RTX, VOIDmode, 0); - enum machine_mode tmpmode; + enum machine_mode tmpmode, result_reg_mode; /* Structures smaller than a word are aligned to the least significant byte (to the right). On a BYTES_BIG_ENDIAN machine, this means we @@ -2751,16 +2751,24 @@ expand_return (retval) if (tmpmode == MAX_MACHINE_MODE) abort (); - result_reg = gen_reg_rtx (tmpmode); PUT_MODE (DECL_RTL (DECL_RESULT (current_function_decl)), tmpmode); + if (GET_MODE_SIZE (tmpmode) < GET_MODE_SIZE (word_mode)) + result_reg_mode = word_mode; + else + result_reg_mode = tmpmode; + result_reg = gen_reg_rtx (result_reg_mode); + /* Now that the value is in pseudos, copy it to the result reg(s). */ emit_queue (); free_temp_slots (); for (i = 0; i < n_regs; i++) - emit_move_insn (gen_rtx (REG, word_mode, REGNO (result_reg) + i), + emit_move_insn (operand_subword (result_reg, i, 0, result_reg_mode), result_pseudos[i]); + if (tmpmode != result_reg_mode) + result_reg = gen_lowpart (tmpmode, result_reg); + expand_value_return (result_reg); } else if (cleanups