Re: [PATCH] match: Combine two patterns into for.
Andrea Pinski <[email protected]> Sun, 2 Aug 2026 01:49:54 -0700
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <CALvbMcCNyqqG-PhxskAkh8noQcb=Hb=uGXXegwpcSq1SbcdANQ@mail.gmail.com> |
On Thu, Jul 30, 2026 at 4:07 PM Kael Andrew Franco <[email protected]> wrote: > > From 874de2e32a942619608766c78bef37d280488a08 Mon Sep 17 00:00:00 2001 > From: Kael Andrew Alonzo Franco <[email protected]> > Date: Thu, 30 Jul 2026 07:33:12 -0400 > Subject: [PATCH] match: Combine two patterns into for. > > This simplify r6-4336 so genmatch outputs > less C++ code. > > Bootstrapped and regtested on x86_64-pc-linux-gnu. > > gcc/ChangeLog: > > * match.pd: Combine two patterns into for. Ok, thanks for the cleanups. > > Signed-off-by: Kael Andrew Franco <[email protected]> > --- > gcc/match.pd | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/gcc/match.pd b/gcc/match.pd > index ce02ebf2699..93c72c94bf0 100644 > --- a/gcc/match.pd > +++ b/gcc/match.pd > @@ -4507,27 +4507,27 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > /* Simplifications of MIN_EXPR, MAX_EXPR, fmin() and fmax(). */ > > (for minmax (min max) > + maxmin (max min) > (simplify > (minmax @0 @0) > @0) > /* max(max(x,y),x) -> max(x,y) */ > (simplify > (minmax:c (minmax:c@2 @0 @1) @0) > - @2)) > + @2) > + > +/* min(max(x,y),y) -> y. > + max(min(x,y),y) -> y. */ > + (simplify > + (minmax:c (maxmin:c @0 @1) @1) > + @1)) > + > /* For fmin() and fmax(), skip folding when both are sNaN. */ > (for minmax (FMIN_ALL FMAX_ALL) > (simplify > (minmax @0 @0) > (if (!tree_expr_maybe_signaling_nan_p (@0)) > @0))) > -/* min(max(x,y),y) -> y. */ > -(simplify > - (min:c (max:c @0 @1) @1) > - @1) > -/* max(min(x,y),y) -> y. */ > -(simplify > - (max:c (min:c @0 @1) @1) > - @1) > /* max(a,-a) -> abs(a). */ > (simplify > (max:c @0 (negate @0)) > -- > 2.55.0 > >