[cfe-dev] is opencl-style select function supported?

Nate Begeman nbegeman at apple.com
Tue Sep 21 10:15:57 PDT 2010


On Sep 21, 2010, at 1:20 AM, Jochen Wilhelmy wrote:

> On 21.09.2010 00:43, Nate Begeman wrote:
>> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100920/034760.html
>> 
>> On Sep 20, 2010, at 10:51 AM, Nate Begeman wrote:
>> 
>> 
> thanks for solving this problem fast, but i wonder why you do something like
> result = c & a | ~c & a
> instead of using the llvm select instruction, i.e.
> Builder.CreateSelect(TestMSB, LHS, RHS, "select");

I don't think the LLVM IR select instruction has the appropriate semantics for vectors, but I could be wrong.  Doing a bitselect/blend (whatever your preferred terminology) allows the target code generators to avoid having to see <4 x i1>.

> 
> 
> I also would suggest that this depends on the Altivec option instead of 
> OpenCL.
> I'd like to use vectors with C++ and therefore enable Altivec. Then I 
> would expect
> the vectorized ? : operator to work.

I'm not the right person to comment on if that's appropriate or not.  I don't see a problem per se with enabling this for altivec+ext_vector_type but I'll let some other language person decide :)

nate





More information about the cfe-dev mailing list