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

Jochen Wilhelmy j.wilhelmy at arcor.de
Tue Sep 21 11:05:07 PDT 2010


On 21.09.2010 19:15, Nate Begeman wrote:
> 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>.
>    
the llvm documentation says that select works on vectors:
http://www.llvm.org/docs/LangRef.html#i_select

for me select is better than bitselect/blend since I analyze the llvm ir 
and therefore it is more convenient if the
instructions are highlevel.

>    
>>
>> 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 :)
>    
Have you already asked this person or can you tell me who it is ? ;-)

-Jochen




More information about the cfe-dev mailing list