This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix bool vs. unsigned:1 vectorization (PR tree-optimization/79284)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]