]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/match.pd
Update copyright years.
[thirdparty/gcc.git] / gcc / match.pd
index dda86964b4c8e9df1bbe7831111af36f616e9791..fac1dfc13a9c297700311fd8732a70dea3c15bae 100644 (file)
@@ -2,7 +2,7 @@
    This file is consumed by genmatch which produces gimple-match.c
    and generic-match.c from it.
 
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
+   Copyright (C) 2014-2020 Free Software Foundation, Inc.
    Contributed by Richard Biener <rguenther@suse.de>
    and Prathamesh Kulkarni  <bilbotheelffriend@gmail.com>
 
@@ -5786,43 +5786,50 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
      return (x * 0x01010101) >> 24;
    }  */
 (simplify
-  (rshift
-    (mult
-      (bit_and
-       (plus:c
-         (rshift @8 INTEGER_CST@5)
-         (plus:c@8
-           (bit_and @6 INTEGER_CST@7)
-           (bit_and
-             (rshift
-               (minus@6
-                 @0
-                 (bit_and
-                   (rshift @0 INTEGER_CST@4)
-                   INTEGER_CST@11))
-             INTEGER_CST@10)
-           INTEGER_CST@9)))
-       INTEGER_CST@3)
-      INTEGER_CST@2)
-    INTEGER_CST@1)
+ (rshift
+  (mult
+   (bit_and
+    (plus:c
+     (rshift @8 INTEGER_CST@5)
+      (plus:c@8
+       (bit_and @6 INTEGER_CST@7)
+       (bit_and
+        (rshift
+         (minus@6 @0
+          (bit_and (rshift @0 INTEGER_CST@4) INTEGER_CST@11))
+         INTEGER_CST@10)
+        INTEGER_CST@9)))
+    INTEGER_CST@3)
+   INTEGER_CST@2)
+  INTEGER_CST@1)
   /* Check constants and optab.  */
-  (with
-     {
-       unsigned prec = TYPE_PRECISION (type);
-       int shift = 64 - prec;
-       const unsigned HOST_WIDE_INT c1 = 0x0101010101010101ULL >> shift,
-                                   c2 = 0x0F0F0F0F0F0F0F0FULL >> shift,
-                                   c3 = 0x3333333333333333ULL >> shift,
-                                   c4 = 0x5555555555555555ULL >> shift;
-     }
-    (if (prec <= 64 && TYPE_UNSIGNED (type) && tree_to_uhwi (@4) == 1
-          && tree_to_uhwi (@10) == 2 && tree_to_uhwi (@5) == 4
-          && tree_to_uhwi (@1) == prec - 8 && tree_to_uhwi (@2) == c1
-          && tree_to_uhwi (@3) == c2 && tree_to_uhwi (@9) == c3
-          && tree_to_uhwi (@7) == c3 && tree_to_uhwi (@11) == c4
-          && direct_internal_fn_supported_p (IFN_POPCOUNT, type,
-           OPTIMIZE_FOR_BOTH))
-        (convert (IFN_POPCOUNT:type @0)))))
+  (with { unsigned prec = TYPE_PRECISION (type);
+         int shift = (64 - prec) & 63;
+         unsigned HOST_WIDE_INT c1
+           = HOST_WIDE_INT_UC (0x0101010101010101) >> shift;
+         unsigned HOST_WIDE_INT c2
+           = HOST_WIDE_INT_UC (0x0F0F0F0F0F0F0F0F) >> shift;
+         unsigned HOST_WIDE_INT c3
+           = HOST_WIDE_INT_UC (0x3333333333333333) >> shift;
+         unsigned HOST_WIDE_INT c4
+           = HOST_WIDE_INT_UC (0x5555555555555555) >> shift;
+   }
+   (if (prec >= 16
+       && prec <= 64
+       && pow2p_hwi (prec)
+       && TYPE_UNSIGNED (type)
+       && integer_onep (@4)
+       && wi::to_widest (@10) == 2
+       && wi::to_widest (@5) == 4
+       && wi::to_widest (@1) == prec - 8
+       && tree_to_uhwi (@2) == c1
+       && tree_to_uhwi (@3) == c2
+       && tree_to_uhwi (@9) == c3
+       && tree_to_uhwi (@7) == c3
+       && tree_to_uhwi (@11) == c4
+       && direct_internal_fn_supported_p (IFN_POPCOUNT, type,
+                                          OPTIMIZE_FOR_BOTH))
+    (convert (IFN_POPCOUNT:type @0)))))
 #endif
 
 /* Simplify: