aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2003-02-12 23:32:21 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2003-02-12 23:32:21 +0000
commit2bbfc54272ae1622f1935f916f47eec7373bd943 (patch)
tree93fbe60c27222fd9e6ef5d28e239195cec41edef /gcc
parente72fcfe8e47d6b453a9a7685c64b8595c32a2252 (diff)
downloadgcc-2bbfc54272ae1622f1935f916f47eec7373bd943.zip
gcc-2bbfc54272ae1622f1935f916f47eec7373bd943.tar.gz
gcc-2bbfc54272ae1622f1935f916f47eec7373bd943.tar.bz2
* config/h8300/h8300.md (a peephole2): New.
From-SVN: r62792
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/h8300/h8300.md30
2 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9ee4179..da2df7a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-12 Kazu Hirata <kazu@cs.umass.edu>
+
+ * config/h8300/h8300.md (a peephole2): New.
+
Wed Feb 12 22:47:18 CET 2003 Jan Hubicka <jh@suse.cz>
* Makefile.in (CRTSTUFF_CFLAGS): Add -fno-unit-at-a-time
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index c9cd5f5..31454ba 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -3561,6 +3561,36 @@
gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx) :
gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx));")
+;; For constants like -1, -2, 1, 2, it is still cheaper to make a copy
+;; of the register being tested, do the subtraction on the copy, and
+;; then test the copy. We avoid this transformation if we see more
+;; than one copy of the same compare insn.
+
+(define_peephole2
+ [(match_scratch:SI 4 "r")
+ (set (cc0)
+ (compare:SI (match_operand:SI 0 "register_operand" "")
+ (match_operand:SI 1 "incdec_operand" "")))
+ (set (pc)
+ (if_then_else (match_operator 3 "eqne_operator"
+ [(cc0) (const_int 0)])
+ (label_ref (match_operand 2 "" ""))
+ (pc)))]
+ "(TARGET_H8300H || TARGET_H8300S)
+ && !peep2_reg_dead_p (1, operands[0])
+ && !rtx_equal_p (PATTERN (insn),
+ PATTERN (next_nonnote_insn (next_nonnote_insn (insn))))"
+ [(set (cc0)
+ (match_dup 0))
+ (set (pc)
+ (if_then_else (match_op_dup 3 [(cc0) (const_int 0)])
+ (label_ref (match_dup 2))
+ (pc)))]
+ "emit_move_insn (operands[4], operands[0]);
+ operands[0] = operands[4];
+ operands[1] = GEN_INT (- INTVAL (operands[1]));
+ split_adds_subs (SImode, operands, 1);")
+
;; Narrow the mode of testing if possible.
(define_peephole2