public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Richard Sandiford <richard.sandiford@arm.com>
Cc: Tamar Christina <Tamar.Christina@arm.com>,
	 Tamar Christina via Gcc-patches <gcc-patches@gcc.gnu.org>,
	nd <nd@arm.com>,  "jlaw@ventanamicro.com" <jlaw@ventanamicro.com>
Subject: Re: [PATCH]middle-end: replace GET_MODE_WIDER_MODE with GET_MODE_NEXT_MODE
Date: Wed, 16 Nov 2022 12:19:22 +0000 (UTC)	[thread overview]
Message-ID: <nycvar.YFH.7.77.849.2211161219060.3995@jbgna.fhfr.qr> (raw)
In-Reply-To: <mpty1sci7zr.fsf@arm.com>

On Tue, 15 Nov 2022, Richard Sandiford wrote:

> Tamar Christina <Tamar.Christina@arm.com> writes:
> >> -----Original Message-----
> >> From: Richard Sandiford <richard.sandiford@arm.com>
> >> Sent: Tuesday, November 15, 2022 11:59 AM
> >> To: Tamar Christina via Gcc-patches <gcc-patches@gcc.gnu.org>
> >> Cc: Tamar Christina <Tamar.Christina@arm.com>; nd <nd@arm.com>;
> >> rguenther@suse.de; jlaw@ventanamicro.com
> >> Subject: Re: [PATCH]middle-end: replace GET_MODE_WIDER_MODE with
> >> GET_MODE_NEXT_MODE
> >> 
> >> Tamar Christina via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> >> > Hi All,
> >> >
> >> > After the fix to the addsub patch yesterday for bootstrap I had only
> >> regtested on x86.
> >> > While looking today it seemed the new tests were failing, this was
> >> > caused by a change in the behavior of the GET_MODE_WIDER_MODE
> >> macro on trunk.
> >> >
> >> > This patch fixes that issue. Sorry for the mess, have rebased all branches
> >> now.
> >> >
> >> > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> >> >
> >> > Ok for master?
> >> >
> >> > Thanks,
> >> > Tamar
> >> >
> >> > gcc/ChangeLog:
> >> >
> >> > 	* match.pd: Replace GET_MODE_WIDER_MODE with
> >> > 	GET_MODE_NEXT_MODE.
> >> >
> >> > --- inline copy of patch --
> >> > diff --git a/gcc/match.pd b/gcc/match.pd index
> >> >
> >> 1b0ab7cf60fa4772fbe8304c622b0b8fab1bdefa..28191a992039c6f3a1dab5f7c0
> >> e3
> >> > 5dd58dc47092 100644
> >> > --- a/gcc/match.pd
> >> > +++ b/gcc/match.pd
> >> > @@ -7997,7 +7997,7 @@ and,
> >> >         machine_mode wide_mode;
> >> >       }
> >> >       (if (sel.series_p (0, 2, 0, 2)
> >> > -          && GET_MODE_WIDER_MODE (vec_mode).exists (&wide_mode)
> >> > +          && GET_MODE_NEXT_MODE (vec_mode).exists (&wide_mode)
> >> >  	  && VECTOR_MODE_P (wide_mode)
> >> >  	  && (GET_MODE_UNIT_BITSIZE (vec_mode) * 2
> >> >  	      == GET_MODE_UNIT_BITSIZE (wide_mode)))
> >> 
> >> Does anything guarantee that the next mode will be the right one?
> >> It think it would be safer to replace the last three && conditions with:
> >> 
> >>    && GET_MODE_2XWIDER_MODE (GET_MODE_INNER (vec_mode)).exists
> >> (&wide_elt_mode)
> >>    && multiple_p (GET_MODE_NUNITS (vec_mode), 2, &wide_nunits)
> >>    && related_vector_mode (vec_mode, wide_elt_mode,
> >> 			   wide_nunits).exists (&wide_mode)
> >
> > I see, respun patch accordingly.
> 
> LGTM, but I'm nervous when it comes to match.pd stuff so I'd prefer
> Richi or Jeff to have the final say.

I see nothing wrong here, so OK.

Richard.

> Thanks,
> Richard
> 
> >
> > Ok for master?
> >
> > --- inline copy of patch ---
> >
> > diff --git a/gcc/match.pd b/gcc/match.pd
> > index 1b0ab7cf60fa4772fbe8304c622b0b8fab1bdefa..82f05bbc912e4f80f3984d930c4a8dcb010136e1 100644
> > --- a/gcc/match.pd
> > +++ b/gcc/match.pd
> > @@ -7995,12 +7995,15 @@ and,
> >         vec_perm_indices sel (builder, 2, nelts);
> >         machine_mode vec_mode = TYPE_MODE (type);
> >         machine_mode wide_mode;
> > +       scalar_mode wide_elt_mode;
> > +       poly_uint64 wide_nunits;
> > +       scalar_mode inner_mode = GET_MODE_INNER (vec_mode);
> >       }
> >       (if (sel.series_p (0, 2, 0, 2)
> > -          && GET_MODE_WIDER_MODE (vec_mode).exists (&wide_mode)
> > -	  && VECTOR_MODE_P (wide_mode)
> > -	  && (GET_MODE_UNIT_BITSIZE (vec_mode) * 2
> > -	      == GET_MODE_UNIT_BITSIZE (wide_mode)))
> > +	  && GET_MODE_2XWIDER_MODE (inner_mode).exists (&wide_elt_mode)
> > +	  && multiple_p (GET_MODE_NUNITS (vec_mode), 2, &wide_nunits)
> > +	  && related_vector_mode (vec_mode, wide_elt_mode,
> > +				  wide_nunits).exists (&wide_mode))
> >  	(with
> >  	 {
> >  	   tree stype
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

      parent reply	other threads:[~2022-11-16 12:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 10:33 Tamar Christina
2022-11-15 11:58 ` Richard Sandiford
2022-11-15 13:15   ` Tamar Christina
2022-11-15 14:54     ` Richard Sandiford
2022-11-15 16:23       ` Jeff Law
2022-11-16 12:19       ` Richard Biener [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.YFH.7.77.849.2211161219060.3995@jbgna.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=Tamar.Christina@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jlaw@ventanamicro.com \
    --cc=nd@arm.com \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).