* config/h8300/h8300.md: Add a new peephole2.
authorKazu Hirata <kazu@cs.umass.edu>
Thu, 12 Dec 2002 22:29:10 +0000 (22:29 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Thu, 12 Dec 2002 22:29:10 +0000 (22:29 +0000)
From-SVN: r60082

gcc/ChangeLog
gcc/config/h8300/h8300.md

index 3accc82cefa6e4e64888c72a4bb22ee3a3cfd890..bf71fdb15afa6ba7b2468b32c1902c8469fd45fb 100644 (file)
@@ -1,3 +1,7 @@
+2002-12-12  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * config/h8300/h8300.md: Add a new peephole2.
+
 2002-12-12  Kazu Hirata  <kazu@cs.umass.edu>
 
        * config/h8300/h8300.md (a peephole2): Accept a constant
index ca95f4bbe758b97267ae579c097bb4c00565a343..8bc69aa85f68e23677d17b2f19dd2aa74842640b 100644 (file)
        (plus:SI (match_dup 0)
                 (match_dup 1)))]
   "")
+
+;; Turn
+;;
+;;   mov.l er7,er0
+;;   add.l #10,er0  (takes 8 bytes)
+;;
+;; into
+;;
+;;   sub.l er0,er0
+;;   add.b #10,r0l
+;;   add.l er7,er0  (takes 6 bytes)
+
+(define_peephole2
+  [(set (match_operand:SI 0 "register_operand" "")
+       (match_operand:SI 1 "register_operand" ""))
+   (set (match_dup 0)
+       (plus:SI (match_dup 0)
+                (match_operand:SI 2 "const_int_operand" "")))]
+  "(TARGET_H8300H || TARGET_H8300S)
+   && REG_P (operands[0]) && REG_P (operands[1])
+   && REGNO (operands[0]) != REGNO (operands[1])
+   && !CONST_OK_FOR_L (INTVAL (operands[2]))
+   && !CONST_OK_FOR_N (INTVAL (operands[2]))
+   && ((INTVAL (operands[2]) & 0xff) == INTVAL (operands[2])
+       || (INTVAL (operands[2]) & 0xff00) == INTVAL (operands[2])
+       || INTVAL (operands[2]) == 0xffff
+       || INTVAL (operands[2]) == 0xfffe)"
+  [(set (match_dup 0)
+       (match_dup 2))
+   (set (match_dup 0)
+       (plus:SI (match_dup 0)
+                (match_dup 1)))]
+  "")