This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [RFC, vectorizer] Allow single element vector types for vector reduction operations
- From: Richard Biener <rguenther at suse dot de>
- To: Jon Beniston <jon at beniston dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 28 Aug 2017 10:59:56 +0200 (CEST)
- Subject: RE: [RFC, vectorizer] Allow single element vector types for vector reduction operations
- Authentication-results: sourceware.org; auth=none
- References: <015b01d31f6b$c3651620$4a2f4260$@beniston.com> <alpine.LSU.2.20.1708280914330.14191@zhemvz.fhfr.qr> <000001d31fd7$b239abb0$16ad0310$@beniston.com>
On Mon, 28 Aug 2017, Jon Beniston wrote:
> Hi Richard,
>
> >- if (nunits < 1) /* Support V1SI. */
> >+ if (nunits < 1 || (nunits == 1 && !reduct_p))
> > return NULL_TREE;
> >
> >doesn't seem to be against trunk which has
> >
> > if (nunits <= 1)
> > return NULL_TREE;
> >
> >so what happens if you just change that to
> >
> > if (nunits < 1)
> > return NULL_TREE;
>
> Ah, that's what I first tried, and mistakenly sent the patch against that.
>
> That did help the initial problem, but then I needed to add a lot of support
> for the V1SI type in the backend (which just duplicated SI patterns) and
> there are a few places where GCC seems to have sanity checks against vectors
> that are only one element wide. A dot product producing a scalar result
> seems natural.
Where do you need V1SI types? The vectorizer should perform a SI extract
from V1SI here. You need to elaborate a bit here.
>
> Also, as well as ARC benefitting from this, I think the TI c6x port would
> too. That currently has a sdot_prodv2hi pattern that uses SI and V2HI types.
The vectorizer doesn't really support vector->scalar ops so V1SI feels
more natural here. That is, your patch looks a bit ugly -- there's
nothing wrong with V1SI vector types. So maybe instead of adjusting
that function the respective caller when facing a lane-reducing op
such as DOT_PROD needs to consider scalar result types.
Richard.
> Cheers,
> Jon
>
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)