aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1996-09-17 12:08:58 -0700
committerJim Wilson <wilson@gcc.gnu.org>1996-09-17 12:08:58 -0700
commit653bd7a66072795b40b00ad455bdfd2d0ba75d43 (patch)
treee63b2709542d7ee386876a7962b6de370f83bec9
parent1bdf86c3ba2e441805b8d414c1349fceb9269bc1 (diff)
downloadgcc-653bd7a66072795b40b00ad455bdfd2d0ba75d43.zip
gcc-653bd7a66072795b40b00ad455bdfd2d0ba75d43.tar.gz
gcc-653bd7a66072795b40b00ad455bdfd2d0ba75d43.tar.bz2
New define_splits to recombine output from LEGITIMIZE_ADDRESS.
From-SVN: r12729
-rw-r--r--gcc/config/sh/sh.md55
1 files changed, 55 insertions, 0 deletions
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 9e9fd94..729884c 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -1709,6 +1709,61 @@
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" ""))]