> Am 21.11.2025 um 19:44 schrieb Andrew Pinski <[email protected]>:
>
> This moves 2 patterns, `1/x` and `m1 CMP m2) * d` patterns to
> use `fold_before_rtl_expansion_p()` instead of `!canonicalize_math_p ()`
> it was before.
>
> These 2 were checking !canonicalize_math_p() before because there was no
> other predicate that was decent until fold_before_rtl_expansion_p was added.
>
> Bootstrappd and tested on x86_64-linux-gnu.
Ok
Richard
> gcc/ChangeLog:
>
> * match.pd (1/x): Use fold_before_rtl_expansion_p.
> (`m1 CMP m2) * d`): Likewise.
>
> Signed-off-by: Andrew Pinski <[email protected]>
> ---
> gcc/match.pd | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 63d56b08192..463c0d53d6c 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -607,7 +607,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> && (!flag_non_call_exceptions || tree_expr_nonzero_p (@1)))
> (if (TYPE_UNSIGNED (type))
> (convert (eq:boolean_type_node @1 { build_one_cst (type); }))
> - (if (!canonicalize_math_p ())
> + (if (fold_before_rtl_expansion_p ())
> (with { tree utype = unsigned_type_for (type); }
> (cond (le (plus (convert:utype @1) { build_one_cst (utype); })
> { build_int_cst (utype, 2); })
> @@ -2670,7 +2670,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> (convert (bit_and (bit_not @1) @0))))
>
> /* (m1 CMP m2) * d -> (m1 CMP m2) ? d : 0 */
> -(if (!canonicalize_math_p ())
> +(if (fold_before_rtl_expansion_p ())
> (for cmp (tcc_comparison)
> (simplify
> (mult:c (convert (cmp@0 @1 @2)) @3)
> --
> 2.43.0
>