public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFT/RFA: Eliminate gen_binary, take 2
@ 2004-06-08 16:42 Paolo Bonzini
  2004-06-08 21:13 ` Roger Sayle
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Paolo Bonzini @ 2004-06-08 16:42 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

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


[-- Attachment #2: combine-tweak.patch --]
[-- Type: text/plain, Size: 2319 bytes --]

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;

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-06-10 21:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-08 16:42 RFT/RFA: Eliminate gen_binary, take 2 Paolo Bonzini
2004-06-08 21:13 ` Roger Sayle
2004-06-08 21:51 ` Eric Botcazou
2004-06-09  9:21   ` Paolo Bonzini
2004-06-09  9:36     ` Paolo Bonzini
2004-06-10  7:17     ` Eric Botcazou
2004-06-10  8:16       ` Paolo Bonzini
2004-06-10 11:16         ` Eric Botcazou
2004-06-10 12:34 ` Eric Botcazou
2004-06-10 12:48   ` Paolo Bonzini
2004-06-10 23:30     ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).