Vector Comparison patch
Paolo Bonzini
bonzini@gnu.org
Mon Aug 29 12:54:00 GMT 2011
On 08/18/2011 11:23 AM, Richard Guenther wrote:
> Yeah, well. That's really a question for language lawyers;) I agree
> that it would be nice to have mask ? val0 : val1 behave "the same"
> for scalars and vectors. The question is whether for vectors you
> define it on the bit-level (which makes it equal to (mask& val0) |
> (~mask& val1))
> or on the vector component level. The vector component level
> is probably what people would expect.
>
> Which means we have to treat mask ? val0 : val1 as
> mask != {0,...} ? val0 : val1.
The definition in OpenCL makes zero sense to me. For byte operands it
is custom-tailored after the SSE PMOVMSKB instruction, but there is no
PMOVMSKW/PMOVMSKD instruction so you would need very slow bit shift
operations before PMOVMSK. On the other hand, bit selection is for
example in Altivec.
Do we have some way to contact anyone in the OpenCL standards group
(CCing Chris Lattner)?
If you wanted to implement it, it would be mask < {0,...} ? val0 : val1.
But really, since we're not implementing OpenCL C I would really
prefer to have bit-level selection, and let a front-end implement the quirk.
Paolo
More information about the Gcc-patches
mailing list