This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR bootstrap/4128 (commited)


Hi!

This is what I've just commited.
gen_v9_scc was using REGNO on SUBREG.
While at it, I've moved the early clobber test only where it is really
needed (ie. movrXX).

2002-03-15  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/4128
	* config/sparc/sparc.c (gen_v9_scc): Move early clobber test
	before movrXX only, use reg_overlap_mentioned_p.
	Only special case NE if just one insn can be generated.

	* gcc.c-torture/compile/20020315-1.c: New test.

--- gcc/config/sparc/sparc.c.jj	Wed Mar 13 20:54:03 2002
+++ gcc/config/sparc/sparc.c	Fri Mar 15 19:28:42 2002
@@ -2343,16 +2343,7 @@ gen_v9_scc (compare_code, operands)
 	  || GET_MODE (operands[0]) == DImode))
     return 0;
 
-  /* Handle the case where operands[0] == sparc_compare_op0.
-     We "early clobber" the result.  */
-  if (REGNO (operands[0]) == REGNO (sparc_compare_op0))
-    {
-      op0 = gen_reg_rtx (GET_MODE (sparc_compare_op0));
-      emit_move_insn (op0, sparc_compare_op0);
-    }
-  else
-    op0 = sparc_compare_op0;
-  /* For consistency in the following.  */
+  op0 = sparc_compare_op0;
   op1 = sparc_compare_op1;
 
   /* Try to use the movrCC insns.  */
@@ -2362,14 +2353,12 @@ gen_v9_scc (compare_code, operands)
       && v9_regcmp_p (compare_code))
     {
       /* Special case for op0 != 0.  This can be done with one instruction if
-	 operands[0] == sparc_compare_op0.  We don't assume they are equal
-	 now though.  */
+	 operands[0] == sparc_compare_op0.  */
 
       if (compare_code == NE
 	  && GET_MODE (operands[0]) == DImode
-	  && GET_MODE (op0) == DImode)
+	  && rtx_equal_p (op0, operands[0]))
 	{
-	  emit_insn (gen_rtx_SET (VOIDmode, operands[0], op0));
 	  emit_insn (gen_rtx_SET (VOIDmode, operands[0],
 			      gen_rtx_IF_THEN_ELSE (DImode,
 				       gen_rtx_fmt_ee (compare_code, DImode,
@@ -2379,6 +2368,14 @@ gen_v9_scc (compare_code, operands)
 	  return 1;
 	}
 
+      if (reg_overlap_mentioned_p (operands[0], op0))
+	{
+	  /* Handle the case where operands[0] == sparc_compare_op0.
+	     We "early clobber" the result.  */
+	  op0 = gen_reg_rtx (GET_MODE (sparc_compare_op0));
+	  emit_move_insn (op0, sparc_compare_op0);
+	}
+
       emit_insn (gen_rtx_SET (VOIDmode, operands[0], const0_rtx));
       if (GET_MODE (op0) != DImode)
 	{
--- gcc/testsuite/gcc.c-torture/compile/20020315-1.c.jj	Fri Mar 15 19:40:19 2002
+++ gcc/testsuite/gcc.c-torture/compile/20020315-1.c	Fri Mar 15 19:30:12 2002
@@ -0,0 +1,34 @@
+/* PR bootstrap/4128 */
+
+extern int bar (char *, char *, int, int);
+extern long baz (char *, char *, int, int);
+
+int sgt (char *a, char *b, int c, int d)
+{
+  return bar (a, b, c, d) > 0;
+}
+
+long dgt (char *a, char *b, int c, int d)
+{
+  return baz (a, b, c, d) > 0;
+}
+
+int sne (char *a, char *b, int c, int d)
+{
+  return bar (a, b, c, d) != 0;
+}
+
+long dne (char *a, char *b, int c, int d)
+{
+  return baz (a, b, c, d) != 0;
+}
+
+int seq (char *a, char *b, int c, int d)
+{
+  return bar (a, b, c, d) == 0;
+}
+
+long deq (char *a, char *b, int c, int d)
+{
+  return baz (a, b, c, d) == 0;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]