On 08/21/2015 04:49 AM, Ilya Enkovich wrote:
I want a work with bitmasks to be expressed in a natural way using
regular integer operations. Currently all masks manipulations are
emulated via vector statements (mostly using a bunch of vec_cond). For
complex predicates it may be nontrivial to transform it back to scalar
masks and get an efficient code. Also the same vector may be used as
both a mask and an integer vector. Things become more complex if you
additionally have broadcasts and vector pack/unpack code. It also
should be transformed into a scalar masks manipulations somehow.
Or why not model the conversion at the gimple level using a
CONVERT_EXPR? In fact, the more I think about it, that seems to make
more sense to me.
We pick a canonical form for the mask, whatever it may be. We use that
canonical form and model conversions between it and the other form via
CONVERT_EXPR. We then let DOM/PRE find/eliminate the redundant
conversions. If it's not up to the task, we should really look into why
and resolve.
Yes, that does mean we have two forms which I'm not terribly happy about
and it means some target dependencies on what the masked vector
operation looks like (ie, does it accept a simple integer or vector
mask), but I'm starting to wonder if, as distasteful as I find it, it's
the right thing to do.
But I don't like changing our IL so much as to allow 'integer' masks everywhere.
I'm warming up to that idea...
jeff