* config/h8300/h8300.md: Add a new peephole2.

From-SVN: r60082
This commit is contained in:
Kazu Hirata 2002-12-12 22:29:10 +00:00 committed by Kazu Hirata
parent 61c85ff12d
commit 7930523de8
2 changed files with 37 additions and 0 deletions

View 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

View File

@ -2748,3 +2748,36 @@
(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)))]
"")