On Wed, Aug 26, 2015 at 03:02:02PM +0200, Richard Biener wrote: > > AVX-512 is such target. Current representation forces multiple scalar > > mask -> vector mask and back transformations which are artificially > > introduced by current bool patterns and are hard to optimize out. > > I dislike the bool patterns anyway and we should try to remove those > and make the vectorizer handle them in other ways (they have single-use > issues anyway). I don't remember exactly what caused us to add them > but one reason was there wasn't a vector type for 'bool' (but I don't see how > it should be necessary to ask "get me a vector type for 'bool'").
That was just one of the reasons. The other reason is that even if we would choose some vector of integer type as vector of bool, the question is what type. E.g. if you use vector of chars, you almost always get terrible vectorized code, except for the AVX-512 you really want an integral type that has the size of the types you are comparing. And I'd say this is very much related to the need to do some type promotions or demotions on the scalar code meant to be vectorized (but only the copy for vectorizations), so that we have as few different scalar type sizes in the loop as possible, because widening / narrowing vector conversions aren't exactly cheap and a single char operation in a loop otherwise full of long long operations might unnecessarily turn a vf=2 (or 4 or 8) loop into vf=16 (or 32 or 64), increasing it a lot. Jakub