m68hc11.md (peephole2): New peephole2 to optimize address computations.
authorStephane Carrez <Stephane.Carrez@worldnet.fr>
Sun, 25 Nov 2001 16:45:22 +0000 (17:45 +0100)
committerStephane Carrez <ciceron@gcc.gnu.org>
Sun, 25 Nov 2001 16:45:22 +0000 (17:45 +0100)
* config/m68hc11/m68hc11.md (peephole2): New peephole2 to optimize
address computations.

From-SVN: r47323

gcc/ChangeLog
gcc/config/m68hc11/m68hc11.md

index 1b320b21131df51b2cd2aeb4fa1fe7e004535216..e6ec65b9b4e4e3892cb09553be4f0a4ebd4666a8 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-25  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+       * config/m68hc11/m68hc11.md (peephole2): New peephole2 to optimize
+       address computations.
+
 2001-11-25  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
 
        * config/m68hc11/m68hc11.c (d_register_operand): Must accept
index 10886d2899726ff8cb2b86f09ba003a6be41ebd8..f201e740895f3e82390128452f96bcf52f534196 100644 (file)
 ;;- Peepholes
 ;;--------------------------------------------------------------------
 
+;;
+;; Reorganize to optimize address computations.
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+       (match_operand:HI 1 "const_int_operand" ""))
+   (set (match_dup 0)
+       (plus:HI (match_dup 0)
+                (match_operand:HI 2 "general_operand" "")))]
+  "(INTVAL (operands[1]) >= -2 && INTVAL (operands[1]) <= 2)"
+  [(set (match_dup 0) (match_dup 2))
+   (set (match_dup 0) (plus:HI (match_dup 0) (match_dup 1)))]
+  "")
+
+;;
+;; Reorganize address computation based on stack pointer.
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+        (match_operand:HI 1 "const_int_operand" ""))
+   (set (match_dup 0) (plus:HI (match_dup 0) (reg:HI SP_REGNUM)))]
+  ""
+  [(set (match_dup 0) (reg:HI SP_REGNUM))
+   (set (match_dup 0) (plus:HI (match_dup 0) (match_dup 1)))]
+  "")
+
 ;;
 ;; This peephole catches the address computations generated by the reload
 ;; pass.