OSDN Git Service

New define_splits to recombine output from LEGITIMIZE_ADDRESS.
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Sep 1996 19:08:58 +0000 (19:08 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 Sep 1996 19:08:58 +0000 (19:08 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12729 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/config/sh/sh.md

index 9e9fd94..729884c 100644 (file)
     FAIL;
 }")
 
+;; If a base address generated by LEGITIMIZE_ADDRESS for SImode is
+;; used only once, let combine add in the index again.
+
+(define_split
+  [(set (match_operand:SI 0 "register_operand" "")
+       (match_operand:SI 1 "" ""))
+   (clobber (match_operand 2 "register_operand" ""))]
+  "! reload_in_progress && ! reload_completed"
+  [(use (reg:SI 0))]
+  "
+{
+  rtx addr, reg, const_int;
+
+  if (GET_CODE (operands[1]) != MEM)
+    FAIL;
+  addr = XEXP (operands[1], 0);
+  if (GET_CODE (addr) != PLUS)
+    FAIL;
+  reg = XEXP (addr, 0);
+  const_int = XEXP (addr, 1);
+  if (GET_CODE (reg) != REG || GET_CODE (const_int) != CONST_INT)
+    FAIL;
+  emit_move_insn (operands[2], const_int);
+  emit_move_insn (operands[0],
+                 change_address (operands[1], VOIDmode,
+                                 gen_rtx (PLUS, SImode, reg, operands[2])));
+  DONE;
+}")
+
+(define_split
+  [(set (match_operand:SI 1 "" "")
+       (match_operand:SI 0 "register_operand" ""))
+   (clobber (match_operand 2 "register_operand" ""))]
+  "! reload_in_progress && ! reload_completed"
+  [(use (reg:SI 0))]
+  "
+{
+  rtx addr, reg, const_int;
+
+  if (GET_CODE (operands[1]) != MEM)
+    FAIL;
+  addr = XEXP (operands[1], 0);
+  if (GET_CODE (addr) != PLUS)
+    FAIL;
+  reg = XEXP (addr, 0);
+  const_int = XEXP (addr, 1);
+  if (GET_CODE (reg) != REG || GET_CODE (const_int) != CONST_INT)
+    FAIL;
+  emit_move_insn (operands[2], const_int);
+  emit_move_insn (change_address (operands[1], VOIDmode,
+                                 gen_rtx (PLUS, SImode, reg, operands[2])),
+                 operands[0]);
+  DONE;
+}")
+
 (define_expand "movdf"
   [(set (match_operand:DF 0 "general_movdst_operand" "")
        (match_operand:DF 1 "general_movsrc_operand" ""))]