aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2002-12-11 13:27:29 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2002-12-11 13:27:29 +0000
commit68d0a3d2797b1fef210c973c1dbf7db2a52ef83a (patch)
treea7f7499227047b98fb9824227249a1bf3c72cc72 /gcc
parent722d59a3375f50d6a56191ddf2dd6a822daae19f (diff)
downloadgcc-68d0a3d2797b1fef210c973c1dbf7db2a52ef83a.zip
gcc-68d0a3d2797b1fef210c973c1dbf7db2a52ef83a.tar.gz
gcc-68d0a3d2797b1fef210c973c1dbf7db2a52ef83a.tar.bz2
* config/h8300/h8300.md (two define_peephole2): New.
From-SVN: r60036
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/h8300/h8300.md56
2 files changed, 60 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 364c1f5..caf1f4b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2002-12-11 Kazu Hirata <kazu@cs.umass.edu>
+ * config/h8300/h8300.md (two define_peephole2): New.
+
+2002-12-11 Kazu Hirata <kazu@cs.umass.edu>
+
* config/h8300/h8300.h (CONST_OK_FOR_J): Remove.
(CONST_OK_FOR_K): Likewise.
(CONST_OK_FOR_M): Likewise.
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index b1d39d7..051b81f 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -2689,3 +2689,59 @@
(set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -8)))
(match_dup 1))])]
"")
+
+;; Turn
+;;
+;; mov.w #2,r0
+;; add.w r7,r0 (6 bytes)
+;;
+;; into
+;;
+;; mov.w r7,r0
+;; adds #2,r0 (4 bytes)
+
+(define_peephole2
+ [(set (match_operand:HI 0 "register_operand" "")
+ (match_operand:HI 1 "const_int_operand" ""))
+ (set (match_dup 0)
+ (plus:HI (match_dup 0)
+ (match_operand:HI 2 "register_operand" "")))]
+ "REG_P (operands[0]) && REG_P (operands[2])
+ && REGNO (operands[0]) != REGNO (operands[2])
+ && (CONST_OK_FOR_L (INTVAL (operands[1]))
+ || CONST_OK_FOR_N (INTVAL (operands[1])))"
+ [(set (match_dup 0)
+ (match_dup 2))
+ (set (match_dup 0)
+ (plus:HI (match_dup 0)
+ (match_dup 1)))]
+ "")
+
+;; Turn
+;;
+;; sub.l er0,er0
+;; add.b #4,r0l
+;; add.l er7,er0 (6 bytes)
+;;
+;; into
+;;
+;; mov.l er7,er0
+;; adds #4,er0 (4 bytes)
+
+(define_peephole2
+ [(set (match_operand:SI 0 "register_operand" "")
+ (match_operand:SI 1 "const_int_operand" ""))
+ (set (match_dup 0)
+ (plus:SI (match_dup 0)
+ (match_operand:SI 2 "register_operand" "")))]
+ "(TARGET_H8300H || TARGET_H8300S)
+ && REG_P (operands[0]) && REG_P (operands[2])
+ && REGNO (operands[0]) != REGNO (operands[2])
+ && (CONST_OK_FOR_L (INTVAL (operands[1]))
+ || CONST_OK_FOR_N (INTVAL (operands[1])))"
+ [(set (match_dup 0)
+ (match_dup 2))
+ (set (match_dup 0)
+ (plus:SI (match_dup 0)
+ (match_dup 1)))]
+ "")