OSDN Git Service

* config/h8300/h8300.md: Add a new peephole2.
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Dec 2002 22:29:10 +0000 (22:29 +0000)
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Dec 2002 22:29:10 +0000 (22:29 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60082 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 3accc82..bf71fdb 100644 (file)
@@ -1,5 +1,9 @@
 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
        that's accepted by CONST_OK_FOR_J.
 
index ca95f4b..8bc69aa 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)))]
+  "")