sh.c (force_into): New function.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Tue, 2 Mar 1999 16:42:59 +0000 (16:42 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Tue, 2 Mar 1999 16:42:59 +0000 (16:42 +0000)
* sh.c (force_into): New function.
(expand_block_move): Use it.

From-SVN: r25540

gcc/ChangeLog
gcc/config/sh/sh.c

index c50fc7294b1c422c9c3b6e8c8783cf02b8900d94..03315c63f8cb2564833bd4d881fb16fd2a1a215a 100644 (file)
@@ -1,3 +1,8 @@
+Wed Mar  3 00:00:37 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * sh.c (force_into): New function.
+       (expand_block_move): Use it.
+
 Tue Mar  2 10:39:43 1999  Nick Clifton  <nickc@cygnus.com>
 
        * cccp.c (struct default_include): Add 'included' field.
index 6ddf43958b0ec47a565810c1172c46b647e1dd12..180cce2b2aa9724e9fe2eacbc5d766fe13f8547c 100644 (file)
@@ -305,6 +305,18 @@ print_operand (stream, x, code)
     }
 }
 \f
+static void force_into PROTO ((rtx, rtx));
+
+/* Like force_operand, but guarantees that VALUE ends up in TARGET.  */
+static void
+force_into (value, target)
+     rtx value, target;
+{
+  value = force_operand (value, target);
+  if (! rtx_equal_p (value, target))
+    emit_insn (gen_move_insn (target, value));
+}
+
 /* Emit code to perform a block move.  Choose the best method.
 
    OPERANDS[0] is the destination.
@@ -342,8 +354,8 @@ expand_block_move (operands)
            = copy_to_mode_reg (Pmode,
                                gen_rtx_SYMBOL_REF (Pmode,
                                                    IDENTIFIER_POINTER (entry_name)));
-         emit_insn (gen_move_insn (r4, XEXP (operands[0], 0)));
-         emit_insn (gen_move_insn (r5, XEXP (operands[1], 0)));
+         force_into (XEXP (operands[0], 0), r4);
+         force_into (XEXP (operands[1], 0), r5);
          emit_insn (gen_block_move_real_i4 (func_addr_rtx));
          return 1;
        }
@@ -363,8 +375,8 @@ expand_block_move (operands)
            = copy_to_mode_reg (Pmode,
                                gen_rtx_SYMBOL_REF (Pmode,
                                                    IDENTIFIER_POINTER (entry_name)));
-         emit_insn (gen_move_insn (r4, XEXP (operands[0], 0)));
-         emit_insn (gen_move_insn (r5, XEXP (operands[1], 0)));
+         force_into (XEXP (operands[0], 0), r4);
+         force_into (XEXP (operands[1], 0), r5);
 
          dwords = bytes >> 3;
          emit_insn (gen_move_insn (r6, GEN_INT (dwords - 1)));
@@ -389,8 +401,8 @@ expand_block_move (operands)
        = copy_to_mode_reg (Pmode,
                            gen_rtx (SYMBOL_REF, Pmode,
                                     IDENTIFIER_POINTER (entry_name)));
-      emit_insn (gen_move_insn (r4, XEXP (operands[0], 0)));
-      emit_insn (gen_move_insn (r5, XEXP (operands[1], 0)));
+      force_into (XEXP (operands[0], 0), r4);
+      force_into (XEXP (operands[1], 0), r5);
       emit_insn (gen_block_move_real (func_addr_rtx));
       return 1;
     }
@@ -411,8 +423,8 @@ expand_block_move (operands)
        = copy_to_mode_reg (Pmode,
                            gen_rtx (SYMBOL_REF, Pmode,
                                     IDENTIFIER_POINTER (entry_name)));
-      emit_insn (gen_move_insn (r4, XEXP (operands[0], 0)));
-      emit_insn (gen_move_insn (r5, XEXP (operands[1], 0)));
+      force_into (XEXP (operands[0], 0), r4);
+      force_into (XEXP (operands[1], 0), r5);
 
       /* r6 controls the size of the move.  16 is decremented from it
         for each 64 bytes moved.  Then the negative bit left over is used