pa.c (emit_move_sequence): Properly set the mode of the scratch register when...
authorJeffrey A Law <law@cygnus.com>
Thu, 16 Sep 1999 00:38:00 +0000 (00:38 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 16 Sep 1999 00:38:00 +0000 (18:38 -0600)
        * pa.c (emit_move_sequence): Properly set the mode of the scratch
        register when performing secondary reloads for the SAR register.

From-SVN: r29446

gcc/ChangeLog
gcc/config/pa/pa.c

index a6299be9d072f9c3976273cfa03764c6e11307e9..39930f970d807db5d0d6815ddcd64a5e4d338309 100644 (file)
@@ -1,3 +1,8 @@
+Wed Sep 15 18:35:38 1999  Jeffrey A Law  (law@cygnus.com)
+
+       * pa.c (emit_move_sequence): Properly set the mode of the scratch
+       register when performing secondary reloads for the SAR register.
+
 Wed Sep 15 15:51:52 1999  Mark Mitchell  <mark@codesourcery.com>
 
        * rtl.h (NOTE_BLOCK_NUMBER): Replace with ...
index 40054cf7281615688bd39757e19ad3594f9e3eb1..773c0c7bc0b7106001e25b316c4e3095db7afe83 100644 (file)
@@ -1288,16 +1288,15 @@ emit_move_sequence (operands, mode, scratch_reg)
                   && FP_REG_CLASS_P (REGNO_REG_CLASS (REGNO (operand1)))))
           && scratch_reg)
     {
-      /* SCRATCH_REG will hold an address and maybe the actual data.  We want
-        it in WORD_MODE regardless of what mode it was originally given
-        to us.  */
-      scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
-
       /* D might not fit in 14 bits either; for such cases load D into
         scratch reg.  */
       if (GET_CODE (operand1) == MEM
          && !memory_address_p (Pmode, XEXP (operand1, 0)))
        {
+         /* We are reloading the address into the scratch register, so we
+            want to make sure the scratch register is a full register.  */
+         scratch_reg = gen_rtx_REG (word_mode, REGNO (scratch_reg));
+
          emit_move_insn (scratch_reg, XEXP (XEXP (operand1, 0), 1));   
          emit_move_insn (scratch_reg, gen_rtx_fmt_ee (GET_CODE (XEXP (operand1,
                                                                        0)),
@@ -1305,11 +1304,27 @@ emit_move_sequence (operands, mode, scratch_reg)
                                                       XEXP (XEXP (operand1, 0),
                                                       0),
                                                       scratch_reg));
-         emit_move_insn (scratch_reg, gen_rtx_MEM (GET_MODE (operand1),
+
+         /* Now we are going to load the scratch register from memory,
+            we want to load it in the same width as the original MEM,
+            which must be the same as the width of the ultimate destination,
+            OPERAND0.  */
+         scratch_reg = gen_rtx_REG (GET_MODE (operand0), REGNO (scratch_reg));
+         
+         emit_move_insn (scratch_reg, gen_rtx_MEM (GET_MODE (operand0),
                                                    scratch_reg));
        }
       else
-       emit_move_insn (scratch_reg, operand1);
+       {
+         /* We want to load the scratch register using the same mode as
+            the ultimate destination.  */
+         scratch_reg = gen_rtx_REG (GET_MODE (operand0), REGNO (scratch_reg));
+         emit_move_insn (scratch_reg, operand1);
+       }
+
+      /* And emit the insn to set the ultimate destination.  We know that
+        the scratch register has the same mode as the destination at this
+        point.  */
       emit_move_insn (operand0, scratch_reg);
       return 1;
     }