public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Remove GIMPLE restriction of ! using match.pd patterns
@ 2022-05-09 11:42 Richard Biener
  2022-05-19 22:47 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2022-05-09 11:42 UTC (permalink / raw)
  To: gcc-patches

This removes #if GIMPLE guards around patterns using ! which is
now also provided in the GENERIC implementation.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2022-05-09  Richard Biener  <rguenther@suse.de>

	* match.pd: Remove #if GIMPLE guards around ! using patterns.
---
 gcc/match.pd | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 6d691d302b3..1fdd98b375e 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1087,7 +1087,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (bit_ior:c (bit_xor:c@3 @0 @1) (bit_xor:c (bit_xor:c @1 @2) @0))
  (bit_ior @3 @2))
 
-#if GIMPLE
 /* (~X | C) ^ D -> (X | C) ^ (~D ^ C) if (~D ^ C) can be simplified.  */
 (simplify
  (bit_xor:c (bit_ior:cs (bit_not:s @0) @1) @2)
@@ -1104,7 +1103,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
       && wi::bit_and_not (get_nonzero_bits (@0), wi::to_wide (@1)) == 0)
   (bit_xor @0 @1)))
-#endif
 
 /* For constants M and N, if M == (1LL << cst) - 1 && (N & M) == M,
    ((A & N) + B) & M -> (A + B) & M
@@ -1259,6 +1257,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 	&& wi::to_wide (@1) != wi::min_value (TYPE_PRECISION (type),
 					      SIGNED))
     (minus (plus @1 { build_minus_one_cst (type); }) @0))))
+#endif
 
 /* ~(X >> Y) -> ~X >> Y if ~X can be simplified.  */
 (simplify
@@ -1271,7 +1270,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    (if (!wi::neg_p (tree_nonzero_bits (@0)))
     (with { tree stype = signed_type_for (TREE_TYPE (@0)); }
      (convert (rshift (bit_not! (convert:stype @0)) @1))))))
-#endif
 
 /* x + (x & 1) -> (x + 1) & ~1 */
 (simplify
@@ -2750,7 +2748,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 
 /* (T)(A) +- (T)(B) -> (T)(A +- B) only when (A +- B) could be simplified
    to a simple value.  */
-#if GIMPLE
   (for op (plus minus)
    (simplify
     (op (convert @0) (convert @1))
@@ -2761,7 +2758,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 	  && !TYPE_OVERFLOW_TRAPS (type)
 	  && !TYPE_OVERFLOW_SANITIZED (type))
       (convert (op! @0 @1)))))
-#endif
 
   /* ~A + A -> -1 */
   (simplify
@@ -2947,9 +2943,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
      /* If @1 +- @2 is constant require a hard single-use on either
 	original operand (but not on both).  */
      (mult (plusminus @1 @2) @0)
-#if GIMPLE
      (mult! (plusminus @1 @2) @0)
-#endif
   )))
   /* We cannot generate constant 1 for fract.  */
   (if (!ALL_FRACT_MODE_P (TYPE_MODE (type)))
@@ -4070,7 +4064,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (if (integer_zerop (@0))
    @2)))
 
-#if GIMPLE
 /* Sink unary operations to branches, but only if we do fold both.  */
 (for op (negate bit_not abs absu)
  (simplify
@@ -4093,7 +4086,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (simplify
   (op @3 (vec_cond:s @0 @1 @2))
   (vec_cond @0 (op! @3 @1) (op! @3 @2))))
-#endif
 
 #if GIMPLE
 (match (nop_atomic_bit_test_and_p @0 @1 @4)
@@ -5419,7 +5411,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (cmp:c (bit_xor:c @0 @1) @0)
   (cmp @1 { build_zero_cst (TREE_TYPE (@1)); }))
 
-#if GIMPLE
  /* (X & Y) == X becomes (X & ~Y) == 0.  */
  (simplify
   (cmp:c (bit_and:c @0 @1) @0)
@@ -5439,7 +5430,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (simplify
   (cmp:c (bit_ior:c @0 @1) @1)
   (cmp (bit_and @0 (bit_not! @1)) { build_zero_cst (TREE_TYPE (@0)); }))
-#endif
 
  /* (X ^ C1) op C2 can be rewritten as X op (C1 ^ C2).  */
  (simplify
-- 
2.35.3

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

* Re: [PATCH] Remove GIMPLE restriction of ! using match.pd patterns
  2022-05-09 11:42 [PATCH] Remove GIMPLE restriction of ! using match.pd patterns Richard Biener
@ 2022-05-19 22:47 ` Hans-Peter Nilsson
  0 siblings, 0 replies; 2+ messages in thread
From: Hans-Peter Nilsson @ 2022-05-19 22:47 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

> From: Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org>
> Date: Mon, 9 May 2022 13:42:27 +0200

> This removes #if GIMPLE guards around patterns using ! which is
> now also provided in the GENERIC implementation.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
> 
> 2022-05-09  Richard Biener  <rguenther@suse.de>
> 
> 	* match.pd: Remove #if GIMPLE guards around ! using patterns.

This cause PR105629, "[13 Regression] g++.dg/opt/pr94589-2.C
for cris, m68k, s390x".  Code quality seems to have
regressed for cris-elf by a quick diff of the
pr94589-2.s:es.

brgds, H-P
 

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

end of thread, other threads:[~2022-05-19 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 11:42 [PATCH] Remove GIMPLE restriction of ! using match.pd patterns Richard Biener
2022-05-19 22:47 ` Hans-Peter Nilsson

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