This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] h8300: Fix an error from --enable-checking.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 16 Nov 2003 21:30:11 -0500 (EST)
- Subject: [patch] h8300: Fix an error from --enable-checking.
Hi,
Attached is a patch to fix an error from --enable-checking.
PATTERN (next_nonnote_insn (next_nonnote_insn (insn)))
does not make sense if next_nonnote_insn (next_nonnote_insn (insn)) is
a CODE_LABEL.
Tested on h8300 port. Committed.
Kazu Hirata
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.
Index: h8300-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300-protos.h,v
retrieving revision 1.63
diff -u -r1.63 h8300-protos.h
--- h8300-protos.h 5 Sep 2003 20:00:03 -0000 1.63
+++ h8300-protos.h 16 Nov 2003 20:26:53 -0000
@@ -79,6 +79,7 @@
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: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.253
diff -u -r1.253 h8300.c
--- h8300.c 22 Oct 2003 23:21:14 -0000 1.253
+++ h8300.c 16 Nov 2003 20:26:54 -0000
@@ -4514,6 +4514,26 @@
&& 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: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.239
diff -u -r1.239 h8300.md
--- h8300.md 16 Nov 2003 13:55:19 -0000 1.239
+++ h8300.md 16 Nov 2003 20:26:55 -0000
@@ -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)