From: Pan Li <[email protected]>
Like widen_mul based pattern, we would like introduce the mul based
pattern as well. The pattern is quite simple compares to the
widen_mul, thus add new instead of the for loop in match.pd.
gcc/ChangeLog:
* match.pd: Add mul based unsigned SAT_MUL.
Signed-off-by: Pan Li <[email protected]>
---
gcc/match.pd | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gcc/match.pd b/gcc/match.pd
index 4903552c82a..f8d74fd52ad 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -3611,6 +3611,18 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
bool widen_mult_p = cvt5_prec == cvt6_prec && widen_prec == cvt6_prec *
2;
}
(if (widen_prec > prec && c2_is_max_p && widen_mult_p)))))
+ (match (unsigned_integer_sat_mul @0 @1)
+ (convert@4 (min (mult:c@3 (convert @0) (convert @1)) INTEGER_CST@2))
+ (if (types_match (type, @0, @1) && types_match (type, @4))
+ (with
+ {
+ unsigned prec = TYPE_PRECISION (type);
+ unsigned widen_prec = TYPE_PRECISION (TREE_TYPE (@3));
+ wide_int c2 = wi::to_wide (@2);
+ wide_int max = wi::mask (prec, false, widen_prec);
+ bool c2_is_max_p = wi::eq_p (c2, max);
+ }
+ (if (widen_prec > prec && c2_is_max_p)))))
)
/* The boundary condition for case 10: IMM = 1:
--
2.43.0