From: Richard Henderson Date: Mon, 12 Feb 2007 18:46:16 +0000 (-0800) Subject: calls.c (emit_library_call_value_1): If PROMOTE_MODE modifed the result mode of the... X-Git-Tag: releases/gcc-4.3.0~6856 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7ab0aca2fecff07dbc2dd3cf01e6288bf4a18454;p=thirdparty%2Fgcc.git calls.c (emit_library_call_value_1): If PROMOTE_MODE modifed the result mode of the libcall, convert back to outmode. * calls.c (emit_library_call_value_1): If PROMOTE_MODE modifed the result mode of the libcall, convert back to outmode. From-SVN: r121852 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 486cd9358f8a..e23a321898a9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-02-12 Richard Henderson + + * calls.c (emit_library_call_value_1): If PROMOTE_MODE modifed the + result mode of the libcall, convert back to outmode. + 2007-02-12 Roger Sayle * config/i386/i386.md (*bswapdi2_rex): Renamed from bswapdi2. diff --git a/gcc/calls.c b/gcc/calls.c index 53e4d3f073d5..1f8ed60bf12c 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -3916,10 +3916,25 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, value = gen_reg_rtx (outmode); emit_group_store (value, valreg, NULL_TREE, GET_MODE_SIZE (outmode)); } - else if (value != 0) - emit_move_insn (value, valreg); else - value = valreg; + { + /* Convert to the proper mode if PROMOTE_MODE has been active. */ + if (GET_MODE (valreg) != outmode) + { + int unsignedp = TYPE_UNSIGNED (tfom); + + gcc_assert (targetm.calls.promote_function_return (tfom)); + gcc_assert (promote_mode (tfom, outmode, &unsignedp, 0) + == GET_MODE (valreg)); + + valreg = convert_modes (outmode, GET_MODE (valreg), valreg, 0); + } + + if (value != 0) + emit_move_insn (value, valreg); + else + value = valreg; + } } if (ACCUMULATE_OUTGOING_ARGS)