function.c (assign_parm_setup_block): Explicitly convert BLKmode parameters from...
authorRichard Sandiford <rsandifo@nildram.co.uk>
Sun, 23 Sep 2007 19:08:56 +0000 (19:08 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 23 Sep 2007 19:08:56 +0000 (19:08 +0000)
gcc/
* function.c (assign_parm_setup_block): Explicitly convert BLKmode
parameters from word_mode to the subword type if such a truncation
is not a no-op.

From-SVN: r128696

gcc/ChangeLog
gcc/function.c

index 0227acd0a751094c9da197f93cc628faa370b6b5..940e6b6b3c8d6d0f3200d81fa3ca46034da214a0 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-23  Richard Sandiford  <rsandifo@nildram.co.uk>
+
+       * function.c (assign_parm_setup_block): Explicitly convert BLKmode
+       parameters from word_mode to the subword type if such a truncation
+       is not a no-op.
+
 2007-09-23  Jakub Jelinek  <jakub@redhat.com>
 
        * configure.ac (MAKEINFO): Handle makeinfo version 4.10 and above.
index ffee5982071202d99f4af8aa1b96b48d441f0a25..5f2dd480d245002d458571042f8116ff00c84127 100644 (file)
@@ -2591,7 +2591,21 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
 #endif
              )
            {
-             rtx reg = gen_rtx_REG (mode, REGNO (entry_parm));
+             rtx reg;
+
+             /* We are really truncating a word_mode value containing
+                SIZE bytes into a value of mode MODE.  If such an
+                operation requires no actual instructions, we can refer
+                to the value directly in mode MODE, otherwise we must
+                start with the register in word_mode and explicitly
+                convert it.  */
+             if (TRULY_NOOP_TRUNCATION (size * BITS_PER_UNIT, BITS_PER_WORD))
+               reg = gen_rtx_REG (mode, REGNO (entry_parm));
+             else
+               {
+                 reg = gen_rtx_REG (word_mode, REGNO (entry_parm));
+                 reg = convert_to_mode (mode, copy_to_reg (reg), 1);
+               }
              emit_move_insn (change_address (mem, mode, 0), reg);
            }