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

2017-02-06 Thread Jeff Law
On 02/06/2017 08:36 AM, Richard Biener wrote: On Mon, 6 Feb 2017, Jakub Jelinek wrote: On Mon, Feb 06, 2017 at 03:26:01PM +0100, Richard Biener wrote: Works for me. Like VECT_SCALAR_BOOLEAN_TYPE_P () to not confuse it with VECTOR_BOOLEAN_TYPE_P? So like this if it passes bootstrap/regtest?

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

2017-02-06 Thread Jeff Law
On 02/02/2017 03:32 PM, Jakub Jelinek wrote: On Thu, Feb 02, 2017 at 10:12:32AM -0700, Jeff Law wrote: On 02/01/2017 03:45 AM, Richard Biener wrote: I agree. But this means we should look for a vectorizer-local fix without a new global predicate then (there seem to be subtly different needs a

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

2017-02-06 Thread Richard Biener
On Mon, 6 Feb 2017, Jakub Jelinek wrote: > On Mon, Feb 06, 2017 at 03:26:01PM +0100, Richard Biener wrote: > > Works for me. Like VECT_SCALAR_BOOLEAN_TYPE_P () to not confuse it > > with VECTOR_BOOLEAN_TYPE_P? > > So like this if it passes bootstrap/regtest? Ok. Richard. > 2017-02-06 Jakub J

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

2017-02-06 Thread Jeff Law
On 02/06/2017 07:23 AM, Richard Biener wrote: On Thu, 2 Feb 2017, Jakub Jelinek wrote: On Thu, Feb 02, 2017 at 10:12:32AM -0700, Jeff Law wrote: On 02/01/2017 03:45 AM, Richard Biener wrote: I agree. But this means we should look for a vectorizer-local fix without a new global predicate the

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

2017-02-06 Thread Jakub Jelinek
On Mon, Feb 06, 2017 at 03:26:01PM +0100, Richard Biener wrote: > Works for me. Like VECT_SCALAR_BOOLEAN_TYPE_P () to not confuse it > with VECTOR_BOOLEAN_TYPE_P? So like this if it passes bootstrap/regtest? 2017-02-06 Jakub Jelinek PR tree-optimization/79284 * tree-vectorize

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

2017-02-06 Thread Richard Biener
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) \ > > > >

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

2017-02-06 Thread Richard Biener
On Thu, 2 Feb 2017, Jakub Jelinek wrote: > On Thu, Feb 02, 2017 at 10:12:32AM -0700, Jeff Law wrote: > > On 02/01/2017 03:45 AM, Richard Biener wrote: > > > > > > I agree. But this means we should look for a vectorizer-local fix > > > without a new global predicate then (there seem to be subtly

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

2017-02-06 Thread Jakub Jelinek
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\ > >

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

2017-02-06 Thread Richard Biener
On Thu, 2 Feb 2017, Jeff Law wrote: > On 02/01/2017 01:21 AM, 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

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

2017-02-02 Thread Jakub Jelinek
On Thu, Feb 02, 2017 at 10:12:32AM -0700, Jeff Law wrote: > On 02/01/2017 03:45 AM, Richard Biener wrote: > > > > I agree. But this means we should look for a vectorizer-local fix > > without a new global predicate then (there seem to be subtly different > > needs and coming up with good names fo

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

2017-02-02 Thread Jeff Law
On 02/01/2017 03:45 AM, Richard Biener wrote: I agree. But this means we should look for a vectorizer-local fix without a new global predicate then (there seem to be subtly different needs and coming up with good names for all of them sounds difficult...). Well, we could go with Jakub's INTEGRA

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

2017-02-02 Thread Jeff Law
On 02/01/2017 01:21 AM, 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

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

2017-02-01 Thread Richard Biener
On Wed, 1 Feb 2017, Jakub Jelinek wrote: > On Wed, Feb 01, 2017 at 11:07:18AM +0100, Richard Biener wrote: > > > On Wed, Feb 01, 2017 at 10:58:29AM +0100, Richard Biener wrote: > > > > > > +/* Nonzero if TYPE represents a (scalar) boolean type or type > > > > > > + in the middle-end compatible w

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

2017-02-01 Thread Jakub Jelinek
On Wed, Feb 01, 2017 at 11:07:18AM +0100, Richard Biener wrote: > > On Wed, Feb 01, 2017 at 10:58:29AM +0100, Richard Biener wrote: > > > > > +/* Nonzero if TYPE represents a (scalar) boolean type or type > > > > > + in the middle-end compatible with it. */ > > > > > + > > > > > +#define INTEGRA

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

2017-02-01 Thread Richard Biener
On Wed, 1 Feb 2017, Jakub Jelinek wrote: > On Wed, Feb 01, 2017 at 10:58:29AM +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) \ > > > >

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

2017-02-01 Thread Jakub Jelinek
On Wed, Feb 01, 2017 at 10:58:29AM +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\ > >

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

2017-02-01 Thread Richard Biener
On Wed, 1 Feb 2017, Jakub Jelinek wrote: > On Wed, Feb 01, 2017 at 09:21:57AM +0100, Richard Biener wrote: > > > Not sure I understand what you mean explicitly check the precision, > > > the macro checks the precision already, and intentionally only for > > > non-BOOLEAN_TYPE. If you mean checkin

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

2017-02-01 Thread Jakub Jelinek
On Wed, Feb 01, 2017 at 09:21:57AM +0100, Richard Biener wrote: > > Not sure I understand what you mean explicitly check the precision, > > the macro checks the precision already, and intentionally only for > > non-BOOLEAN_TYPE. If you mean checking precision explicitly in the spots > > where the

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

2017-02-01 Thread Jakub Jelinek
On Wed, Feb 01, 2017 at 09:32:46AM +0100, Eric Botcazou wrote: > > all BOOLEAN_TYPEs but Adas have precision one and are unsigned > > (their TYPE_SIZE may vary though). Oops, thanks for the correction. That said, the prec > 1 BOOLEAN_TYPE aren't compatible with the prec 1 BOOLEAN_TYPE, so the int

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

2017-02-01 Thread Eric Botcazou
> all BOOLEAN_TYPEs but Adas have precision one and are unsigned > (their TYPE_SIZE may vary though). /* Builds a boolean type of precision PRECISION. Used for boolean vectors to choose proper vector element size. */ tree build_nonstandard_boolean_type (unsigned HOST_WIDE_INT precision) { tr

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

2017-02-01 Thread Jakub Jelinek
On Wed, Feb 01, 2017 at 09:21:57AM +0100, Richard Biener wrote: > it came with r173854 where you see other BOOLEAN_TYPE > -> integral-type with precision 1 check changes, so a new predicate > is very welcome IMHO. > > all BOOLEAN_TYPEs but Adas have precision one and are unsigned > (their TYPE_SIZ

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

2017-02-01 Thread Richard Biener
On Wed, 1 Feb 2017, Jakub Jelinek wrote: > On Tue, Jan 31, 2017 at 04:31:28PM -0700, Jeff Law wrote: > > On 01/31/2017 04:22 PM, Jakub Jelinek wrote: > > > On Tue, Jan 31, 2017 at 03:52:10PM -0700, Jeff Law wrote: > > > > Which makes your patch safe -- but introduces a non-obvious dependency > > >

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

2017-02-01 Thread Jakub Jelinek
On Tue, Jan 31, 2017 at 04:31:28PM -0700, Jeff Law wrote: > On 01/31/2017 04:22 PM, Jakub Jelinek wrote: > > On Tue, Jan 31, 2017 at 03:52:10PM -0700, Jeff Law wrote: > > > Which makes your patch safe -- but introduces a non-obvious dependency > > > between useless_type_conversion_p and your defini

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

2017-01-31 Thread Jeff Law
On 01/31/2017 04:22 PM, Jakub Jelinek wrote: On Tue, Jan 31, 2017 at 03:52:10PM -0700, Jeff Law wrote: Which makes your patch safe -- but introduces a non-obvious dependency between useless_type_conversion_p and your definition of INTEGRAL_BOOLEAN_TYPE and how it's used in the vectorizer. The

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

2017-01-31 Thread Jakub Jelinek
On Tue, Jan 31, 2017 at 03:52:10PM -0700, Jeff Law wrote: > Which makes your patch safe -- but introduces a non-obvious dependency > between useless_type_conversion_p and your definition of > INTEGRAL_BOOLEAN_TYPE and how it's used in the vectorizer. The predicate is simply true for all BOOLEAN_TY

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

2017-01-31 Thread Jeff Law
On 01/31/2017 03:46 PM, Jakub Jelinek wrote: On Tue, Jan 31, 2017 at 03:41:27PM -0700, Jeff Law wrote: useless_type_conversion_p says that precision 1 unsigned BOOLEAN_TYPE conversion to/from precision 1 unsigned integral type is useless, but apparently the vectorizer heavily relies on the BOOLE

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

2017-01-31 Thread Jakub Jelinek
On Tue, Jan 31, 2017 at 03:41:27PM -0700, Jeff Law wrote: > > useless_type_conversion_p says that precision 1 unsigned BOOLEAN_TYPE > > conversion to/from precision 1 unsigned integral type is useless, > > but apparently the vectorizer heavily relies on the BOOLEAN_TYPE vs. > > unsigned integral:1

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

2017-01-31 Thread Jeff Law
On 01/31/2017 11:26 AM, Jakub Jelinek wrote: Hi! useless_type_conversion_p says that precision 1 unsigned BOOLEAN_TYPE conversion to/from precision 1 unsigned integral type is useless, but apparently the vectorizer heavily relies on the BOOLEAN_TYPE vs. unsigned integral:1 distinction (uses VECT