This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix bool vs. unsigned:1 vectorization (PR tree-optimization/79284)
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jeff Law <law at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 6 Feb 2017 15:26:01 +0100 (CET)
- Subject: Re: [PATCH] Fix bool vs. unsigned:1 vectorization (PR tree-optimization/79284)
- Authentication-results: sourceware.org; auth=none
- References: <20170131182637.GI14051@tucnak> <94cb0830-9f4c-9ff8-c9e7-f0ddd4028f20@redhat.com> <20170131224617.GO14051@tucnak> <dee6069f-e5e0-e5a5-e2cb-0b2c21c255c2@redhat.com> <20170131232249.GP14051@tucnak> <521f001d-1951-827b-98df-2cd0f06eed9d@redhat.com> <20170201080157.GQ14051@tucnak> <alpine.LSU.2.20.1702010910230.12993@r111.fhfr.qr> <b45512ac-c3be-4aac-5ba4-5c150cc41c20@redhat.com> <alpine.LSU.2.20.1702060913320.15777@zhemvz.fhfr.qr> <20170206083008.GB1849@tucnak>
On Mon, 6 Feb 2017, Jakub Jelinek wrote:
> On Mon, Feb 06, 2017 at 09:14:24AM +0100, Richard Biener wrote:
> > > > +/* Nonzero if TYPE represents a (scalar) boolean type or type
> > > > + in the middle-end compatible with it. */
> > > > +
> > > > +#define INTEGRAL_BOOLEAN_TYPE_P(TYPE) \
> > > > + (TREE_CODE (TYPE) == BOOLEAN_TYPE \
> > > > + || ((TREE_CODE (TYPE) == INTEGER_TYPE \
> > > > + || TREE_CODE (TYPE) == ENUMERAL_TYPE) \
> > > > + && TYPE_PRECISION (TYPE) == 1 \
> > > > + && TYPE_UNSIGNED (TYPE)))
> > > >
> > > > (just to quote what you proposed).
>
> > > I could agree to that. Alternately, we could restore the TYPE_PRECISION
> > > checks that Jakub removed in the vectorizer.
>
> I haven't removed any, there were just 3 changes of the kind:
> - if ((TYPE_PRECISION (TREE_TYPE (var)) != 1
> - || !TYPE_UNSIGNED (TREE_TYPE (var)))
> - && TREE_CODE (TREE_TYPE (var)) != BOOLEAN_TYPE)
> + if (!INTEGRAL_BOOLEAN_TYPE_P (TREE_TYPE (var)))
> which are almost equivalent, except that the old code could let
> non-INTEGRAL_TYPE_P with TYPE_PRECISION (whatever it means
> for the various kinds of types (e.g. log2 of number of vector elements
> etc.).
>
> >
> > Yeah, I guess at this point I prefer a vectorizer-local fix.
>
> So shall I move the INTEGRAL_BOOLEAN_TYPE_P macro (or change it to
> another name, e.g. including VECT in it?) to tree-vectorizer.h?
Works for me. Like VECT_SCALAR_BOOLEAN_TYPE_P () to not confuse it
with VECTOR_BOOLEAN_TYPE_P?
Richard.