public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4004] remove duplicate match.pd patterns
@ 2022-11-14 13:35 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-11-14 13:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:cf716ab562c1e0549e0632b1c92059932f8b899a

commit r13-4004-gcf716ab562c1e0549e0632b1c92059932f8b899a
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Nov 14 14:33:43 2022 +0100

    remove duplicate match.pd patterns
    
    The following merges match.pd patterns that cause genmatch complaints
    about duplicates when in-order isn't enforced (you have to edit
    genmatch.cc to do a full duplicate check).
    
            * match.pd: Remove duplicates.

Diff:
---
 gcc/match.pd | 63 +++++++++++++++++++++++++++++-------------------------------
 1 file changed, 30 insertions(+), 33 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 194ba8f5188..4d0898ccdcb 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1285,8 +1285,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 
 /* ~x | x -> -1 */
 /* ~x ^ x -> -1 */
-/* ~x + x -> -1 */
-(for op (bit_ior bit_xor plus)
+(for op (bit_ior bit_xor)
  (simplify
   (op:c (convert? @0) (convert? (bit_not @0)))
   (convert { build_all_ones_cst (TREE_TYPE (@0)); })))
@@ -2939,9 +2938,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 
   /* ~A + A -> -1 */
   (simplify
-   (plus:c (bit_not @0) @0)
+   (plus:c (convert? (bit_not @0)) (convert? @0))
    (if (!TYPE_OVERFLOW_TRAPS (type))
-    { build_all_ones_cst (type); }))
+    (convert { build_all_ones_cst (TREE_TYPE (@0)); })))
 
   /* ~A + 1 -> -A */
   (simplify
@@ -5103,34 +5102,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    (scmp @0 (bit_not @1)))))
 
 (for cmp (simple_comparison)
- /* Fold (double)float1 CMP (double)float2 into float1 CMP float2.  */
- (simplify
-  (cmp (convert@2 @0) (convert? @1))
-  (if (FLOAT_TYPE_P (TREE_TYPE (@0))
-       && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@2))
-	   == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0)))
-       && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@2))
-	   == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@1))))
-   (with
-    {
-      tree type1 = TREE_TYPE (@1);
-      if (TREE_CODE (@1) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (type1))
-        {
-	  REAL_VALUE_TYPE orig = TREE_REAL_CST (@1);
-	  if (TYPE_PRECISION (type1) > TYPE_PRECISION (float_type_node)
-	      && exact_real_truncate (TYPE_MODE (float_type_node), &orig))
-	    type1 = float_type_node;
-	  if (TYPE_PRECISION (type1) > TYPE_PRECISION (double_type_node)
-	      && exact_real_truncate (TYPE_MODE (double_type_node), &orig))
-	    type1 = double_type_node;
-        }
-      tree newtype
-        = (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (type1)
-	   ? TREE_TYPE (@0) : type1);
-    }
-    (if (TYPE_PRECISION (TREE_TYPE (@2)) > TYPE_PRECISION (newtype))
-     (cmp (convert:newtype @0) (convert:newtype @1))))))
-
  (simplify
   (cmp @0 REAL_CST@1)
   /* IEEE doesn't distinguish +0 and -0 in comparisons.  */
@@ -5683,7 +5654,33 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 	  (if (cmp == LT_EXPR || cmp == LE_EXPR)
 	   { constant_boolean_node (above ? true : false, type); }
 	   (if (cmp == GT_EXPR || cmp == GE_EXPR)
-	    { constant_boolean_node (above ? false : true, type); }))))))))))))
+	    { constant_boolean_node (above ? false : true, type); })))))))))
+   /* Fold (double)float1 CMP (double)float2 into float1 CMP float2.  */
+   (if (FLOAT_TYPE_P (TREE_TYPE (@00))
+	&& (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0))
+	    == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@00)))
+	&& (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0))
+	    == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@10))))
+    (with
+     {
+       tree type1 = TREE_TYPE (@10);
+       if (TREE_CODE (@10) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (type1))
+	 {
+	   REAL_VALUE_TYPE orig = TREE_REAL_CST (@10);
+	   if (TYPE_PRECISION (type1) > TYPE_PRECISION (float_type_node)
+	       && exact_real_truncate (TYPE_MODE (float_type_node), &orig))
+	     type1 = float_type_node;
+	   if (TYPE_PRECISION (type1) > TYPE_PRECISION (double_type_node)
+	       && exact_real_truncate (TYPE_MODE (double_type_node), &orig))
+	     type1 = double_type_node;
+	 }
+      tree newtype
+        = (TYPE_PRECISION (TREE_TYPE (@00)) > TYPE_PRECISION (type1)
+	   ? TREE_TYPE (@00) : type1);
+     }
+     (if (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (newtype))
+      (cmp (convert:newtype @00) (convert:newtype @10))))))))
+
 
 (for cmp (eq ne)
  (simplify

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-14 13:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 13:35 [gcc r13-4004] remove duplicate match.pd patterns Richard Biener

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).