From: Pan Li <pan2...@intel.com>

This patch would like to fix the warning as below:

/home/slyfox/dev/git/gcc/gcc/match.pd:3424:3 warning: duplicate pattern
 (cond^ (ne (imagpart (IFN_SUB_OVERFLOW:c@2 @0 @1)) integer_zerop)
  ^
/home/slyfox/dev/git/gcc/gcc/match.pd:3397:3 warning: previous pattern
defined here
 (cond^ (ne (imagpart (IFN_SUB_OVERFLOW@2 @0 @1)) integer_zerop)

The second has a optional nop_convert which allows for the first one,
thus remove the dup one.

        PR middle-end/117141

The below test suites are passed for this patch.
* The rv64gcv fully regression test.
* The x86 bootstrap test.
* The x86 fully regression test.

gcc/ChangeLog:

        * match.pd: Remove the dup pattern for signed SAT_SUB.

Signed-off-by: Pan Li <pan2...@intel.com>
---
 gcc/match.pd | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index ee53c25cef9..22fad1a8757 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -3395,7 +3395,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
    The T and UT are type pair like T=int8_t, UT=uint8_t.  */
 (match (signed_integer_sat_sub @0 @1)
  (cond^ (ne (imagpart (IFN_SUB_OVERFLOW@2 @0 @1)) integer_zerop)
-       (bit_xor:c (negate (convert (lt @0 integer_zerop)))
+       (bit_xor:c (nop_convert?
+                   (negate (nop_convert? (convert (lt @0 integer_zerop)))))
                   max_value)
        (realpart @2))
  (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type)
@@ -3417,18 +3418,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
        @2)
  (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type))))
 
-/* Signed saturation sub, case 5:
-   Z = .SUB_OVERFLOW (X, Y)
-   SAT_S_SUB = IMAGPART_EXPR (Z) != 0 ? (-(T)(X < 0) ^ MAX) : minus;  */
-(match (signed_integer_sat_sub @0 @1)
- (cond^ (ne (imagpart (IFN_SUB_OVERFLOW:c@2 @0 @1)) integer_zerop)
-       (bit_xor:c (nop_convert?
-                   (negate (nop_convert? (convert (lt @0 integer_zerop)))))
-                  max_value)
-       (realpart @2))
- (if (INTEGRAL_TYPE_P (type) && !TYPE_UNSIGNED (type)
-      && types_match (type, @0, @1))))
-
 /* Unsigned saturation truncate, case 1, sizeof (WT) > sizeof (NT).
    SAT_U_TRUNC = (NT)x | (NT)(-(X > (WT)(NT)(-1))).  */
 (match (unsigned_integer_sat_trunc @0)
-- 
2.43.0

Reply via email to