]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
h8300-protos.h: Add the prototype for same_cmp_following_p.
authorKazu Hirata <kazu@cs.umass.edu>
Mon, 17 Nov 2003 02:29:54 +0000 (02:29 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 17 Nov 2003 02:29:54 +0000 (02:29 +0000)
* 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

gcc/ChangeLog
gcc/config/h8300/h8300-protos.h
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.md

index 19446d7f72eb71178a31f2b071c4c7957c5783a7..5b35017e1bb39f3c5d244c80503ee22bf1559edd 100644 (file)
@@ -1,3 +1,10 @@
+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
index e36ae4b719c8246199de7814852626b26858d7e2..a7987d06a83febaf1b8fcbaa27e657a0d0f5a789 100644 (file)
@@ -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);
index 88e9a63a6dd00c3d97bd2a397bd4f1e8ebe4be33..28b44e0cdc68c134c54a3370a74a7e473431bee2 100644 (file)
@@ -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
index 5ebb8919f0e37c851cec0fcc2b50a2655aea5e96..8f6e78caa8653fc45f5aa2e61b4fbac67df472a2 100644 (file)
                      (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)