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]

RFT/RFA: Eliminate gen_binary, take 2


This patch, which is relative to the "Eliminate gen_binary patch", fixes the bootstrapping failures that it had caused. As I had guessed, it is a pasto where handling of AND-with-complement-of expressions, which went
undetected under i686-pc-linux-gnu because of the absence of these instructions. I'm sorry to people using other archs.


This version was bootstrapped/regtested i686-pc-linux-gnu, a very similar one was tested on sparc-sun-solaris2.8, and this one passes the testcase that Eric Botcazou had distilled; but experience with the previous patch clearly showed that "very similar" is not enough, so even if approved I'll let a week pass so that people can test it and mail results.

The actual changelog if approved would be the same as in the gen_binary
elimination patch, since distribute_and_simplify_rtx was described
simply as "New function" there.

Ok for mainline together with the original patch?

Paolo

2004-06-06  Paolo Bonzini  <bonzini@gnu.org>

	* combine.c (distribute_and_simplify_rtx): Fix handling of
	(and (xor (B C) (not A))).

Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.430
diff -u -r1.430 combine.c
--- combine.c	27 May 2004 08:28:28 -0000	1.430
+++ combine.c	3 Jun 2004 09:00:27 -0000
@@ -7895,13 +7895,10 @@
       /* (and (xor B C) (not A)) == (xor (ior A B) (ior A C))  */
       if (outer == AND && inner == XOR && GET_CODE (op1) == NOT)
         {
-	  new_op0 = simplify_gen_binary (IOR, mode, inner_op0, op1);
-          new_op1 = simplify_gen_binary (IOR, mode, inner_op1, op1);
+	  new_op0 = simplify_gen_binary (IOR, mode, inner_op0, XEXP (op1, 0));
+          new_op1 = simplify_gen_binary (IOR, mode, inner_op1, XEXP (op1, 0));
           x = apply_distributive_law (simplify_gen_binary (XOR, mode,
 							   new_op0, new_op1));
-
-	  if (GET_CODE (x) != AND)
-	    return x;
 	}
       else
 	{
@@ -7909,10 +7906,9 @@
           new_op1 = simplify_gen_binary (outer, mode, inner_op1, op1);
           x = apply_distributive_law (simplify_gen_binary (inner, mode,
 							   new_op0, new_op1));
-
-	  if (GET_CODE (x) != outer)
-	    return x;
 	}
+      if (GET_CODE (x) != outer)
+        return x;
     }
 
   if (ARITHMETIC_P (op1))
@@ -7924,13 +7920,10 @@
       /* (and (not A) (xor B C)) == (xor (ior A B) (ior A C))  */
       if (outer == AND && inner == XOR && GET_CODE (op0) == NOT)
         {
-	  new_op0 = simplify_gen_binary (IOR, mode, inner_op0, op0);
-          new_op1 = simplify_gen_binary (IOR, mode, inner_op1, op0);
+	  new_op0 = simplify_gen_binary (IOR, mode, inner_op0, XEXP (op0, 0));
+          new_op1 = simplify_gen_binary (IOR, mode, inner_op1, XEXP (op0, 0));
           x = apply_distributive_law (simplify_gen_binary (XOR, mode,
 							   new_op0, new_op1));
-
-	  if (GET_CODE (x) != AND)
-	    return x;
 	}
       else
 	{
@@ -7938,10 +7931,9 @@
           new_op1 = simplify_gen_binary (outer, mode, op0, inner_op1);
           x = apply_distributive_law (simplify_gen_binary (inner, mode,
 							   new_op0, new_op1));
-
-	  if (GET_CODE (x) != outer)
-	    return x;
 	}
+      if (GET_CODE (x) != outer)
+        return x;
     }
 
   return NULL_RTX;

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