Re: [PATCH 2/2] match: Combine two patterns into one for. [PR19832]

Andrea Pinski <[email protected]> Sat, 1 Aug 2026 22:10:50 -0700
Newsgroups gmane.comp.gcc.patches
Message-ID <CALvbMcB-4rdu_Bmx63AFjxzqzFPQHyNscbnZvDvuo86XpLwQVA@mail.gmail.com>
On Sat, Aug 1, 2026 at 7:33 AM Kael Andrew Franco <[email protected]> wrote:
>
> From 296ae59671c343e7f9ba51a786fe8be8206e3849 Mon Sep 17 00:00:00 2001
> From: Kael Andrew Alonzo Franco <[email protected]>
> Date: Fri, 31 Jul 2026 20:45:43 -0400
> Subject: [PATCH 2/2] match: Combine two patterns into one for. [PR19832]
>
> From r14-3606, this reduce genmatch's outputted C++ code.
>
> Bootstrapped and tested on x86_64-pc-linux-gnu.
>
> PR tree-optimization/19832
>
> gcc/ChangeLog:
>
> * match.pd: Combine two patterns into one for.

Ok.

>
> Signed-off-by: Kael Andrew Franco <[email protected]>
> ---
>  gcc/match.pd | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index aa7cada1b64..5b8340ca900 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -6845,13 +6845,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>
>  (for cnd (cond vec_cond)
>   /* (a != b) ? (a - b) : 0 -> (a - b) */
> - (simplify
> -  (cnd (ne:c @0 @1) (minus@2 @0 @1) integer_zerop)
> -  @2)
>   /* (a != b) ? (a ^ b) : 0 -> (a ^ b) */
> - (simplify
> -  (cnd (ne:c @0 @1) (bit_xor@2 @0 @1) integer_zerop)
> -  @2)
> + (for op (minus bit_xor)
> +  (simplify
> +   (cnd (ne:c @0 @1) (op@2 @0 @1) integer_zerop)
> +   @2))
>   /* (a != b) ? (a & b) : a -> (a & b) */
>   /* (a != b) ? (a | b) : a -> (a | b) */
>   /* (a != b) ? min(a,b) : a -> min(a,b) */
> --
> 2.55.0
>
>