calls.c (load_register_parameters): When shifting reg sized values to the msb, move the value to a reg first.

* calls.c (load_register_parameters): When shifting reg sized values
	to the msb, move the value to a reg first.

From-SVN: r69953
This commit is contained in:
Alan Modra 2003-07-30 07:30:16 +00:00 committed by Alan Modra
parent 9074464c14
commit 9206d7362f
2 changed files with 26 additions and 22 deletions

View File

@ -1,3 +1,8 @@
2003-07-30 Alan Modra <amodra@bigpond.net.au>
* calls.c (load_register_parameters): When shifting reg sized values
to the msb, move the value to a reg first.
2003-07-29 Geoffrey Keating <geoffk@apple.com>
* cppfiles.c (stack_file): Leave filename as "" rather than "<stdin>".

View File

@ -1622,14 +1622,27 @@ load_register_parameters (struct arg_data *args, int num_actuals,
has already loaded the register for us. In all other cases,
load the register(s) from memory. */
else if (nregs == -1
else if (nregs == -1)
{
emit_move_insn (reg, args[i].value);
#ifdef BLOCK_REG_PADDING
&& !(size < UNITS_PER_WORD
&& (args[i].locate.where_pad
== (BYTES_BIG_ENDIAN ? upward : downward)))
/* Handle case where we have a value that needs shifting
up to the msb. eg. a QImode value and we're padding
upward on a BYTES_BIG_ENDIAN machine. */
if (size < UNITS_PER_WORD
&& (args[i].locate.where_pad
== (BYTES_BIG_ENDIAN ? upward : downward)))
{
rtx ri = gen_rtx_REG (word_mode, REGNO (reg));
rtx x;
int shift = (UNITS_PER_WORD - size) * BITS_PER_UNIT;
x = expand_binop (word_mode, ashl_optab, ri,
GEN_INT (shift), ri, 1, OPTAB_WIDEN);
if (x != ri)
emit_move_insn (ri, x);
}
#endif
)
emit_move_insn (reg, args[i].value);
}
/* If we have pre-computed the values to put in the registers in
the case of non-aligned structures, copy them in now. */
@ -1644,23 +1657,9 @@ load_register_parameters (struct arg_data *args, int num_actuals,
rtx mem = validize_mem (args[i].value);
#ifdef BLOCK_REG_PADDING
/* Handle case where we have a value that needs shifting
up to the msb. eg. a QImode value and we're padding
upward on a BYTES_BIG_ENDIAN machine. */
if (nregs == -1)
{
rtx ri = gen_rtx_REG (word_mode, REGNO (reg));
rtx x;
int shift = (UNITS_PER_WORD - size) * BITS_PER_UNIT;
x = expand_binop (word_mode, ashl_optab, mem,
GEN_INT (shift), ri, 1, OPTAB_WIDEN);
if (x != ri)
emit_move_insn (ri, x);
}
/* Handle a BLKmode that needs shifting. */
else if (nregs == 1 && size < UNITS_PER_WORD
&& args[i].locate.where_pad == downward)
if (nregs == 1 && size < UNITS_PER_WORD
&& args[i].locate.where_pad == downward)
{
rtx tem = operand_subword_force (mem, 0, args[i].mode);
rtx ri = gen_rtx_REG (word_mode, REGNO (reg));