diff options
author | Kazu Hirata <kazu@cs.umass.edu> | 2003-11-17 02:29:54 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2003-11-17 02:29:54 +0000 |
commit | c06d5c8586da408dc208f97b95058599aef96089 (patch) | |
tree | b32959fb48cc47ddbbc569cb8f49b24303d33499 /gcc | |
parent | a62a282bf47bfccc4aa3a71e10c0c4277954ef2b (diff) | |
download | gcc-c06d5c8586da408dc208f97b95058599aef96089.zip gcc-c06d5c8586da408dc208f97b95058599aef96089.tar.gz gcc-c06d5c8586da408dc208f97b95058599aef96089.tar.bz2 |
h8300-protos.h: Add the prototype for same_cmp_following_p.
* config/h8300/h8300-protos.h: Add the prototype for
same_cmp_following_p.
* config/h8300/h8300.c (same_cmp_following_p): New.
* config/h8300/h8300.md (peephole2): Use it.
From-SVN: r73662
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/h8300/h8300-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.c | 20 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.md | 3 |
4 files changed, 29 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 19446d7..5b35017 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2003-11-16 Kazu Hirata <kazu@cs.umass.edu> + * config/h8300/h8300-protos.h: Add the prototype for + same_cmp_following_p. + * config/h8300/h8300.c (same_cmp_following_p): New. + * config/h8300/h8300.md (peephole2): Use it. + +2003-11-16 Kazu Hirata <kazu@cs.umass.edu> + * config/h8300/h8300.md: Don't use REGNO when its operand is not guaranteed to be a REG. diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index e36ae4b..a7987d0 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -79,6 +79,7 @@ extern int h8300_eightbit_constant_address_p (rtx); extern int h8300_tiny_constant_address_p (rtx); extern int byte_accesses_mergeable_p (rtx, rtx); extern int same_cmp_preceding_p (rtx); +extern int same_cmp_following_p (rtx); /* Used in builtins.c */ extern rtx h8300_return_addr_rtx (int, rtx); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 88e9a63..28b44e0 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -4514,6 +4514,26 @@ same_cmp_preceding_p (rtx i3) && any_condjump_p (i2) && onlyjump_p (i2)); } +/* Return nonzero if we have the same comparison insn as I1 two insns + after I1. I1 is assumed to be a comparison insn. */ + +int +same_cmp_following_p (rtx i1) +{ + rtx i2, i3; + + /* Make sure we have a sequence of three insns. */ + i2 = next_nonnote_insn (i1); + if (i2 == NULL_RTX) + return 0; + i3 = next_nonnote_insn (i2); + if (i3 == NULL_RTX) + return 0; + + return (INSN_P (i3) && rtx_equal_p (PATTERN (i1), PATTERN (i3)) + && any_condjump_p (i2) && onlyjump_p (i2)); +} + /* Return nonzero if register OLD_REG can be renamed to register NEW_REG. */ int diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index 5ebb891..8f6e78c 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -4482,8 +4482,7 @@ (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))))" + && !same_cmp_following_p (insn)" [(set (match_dup 4) (match_dup 0)) (set (match_dup 4) |