[cfe-dev] [PATCH] [OpenCL] Conversions for ternary operations between scalar and vector

Colin Riddell colinriddell at codeplay.com
Wed Dec 17 05:03:17 PST 2014


Hi Sameer,

I replied inline with comments.


On 17/12/2014 04:44, Sahasrabuddhe, Sameer wrote:
> > +  if (getLangOpts().OpenCL) {
> > +    if (CondTy->isVectorType()){
> > +      if 
> (CondTy->getAs<VectorType>()->getElementType()->isFloatingType())
>
> This needs to be checked for the scalar operator too.
Agreed, thanks.

I have went through the examples you provided and marked which rules I 
disagree/am unsure about
> Some notable examples:
>
>    exp1     exp2    exp3     result   eval     reason
>   --------+-------+--------+--------+--------+--------
>    char2    int     int      error    -        7.1
Can you remind me where the wording about number of bits matching 
is....  I am not sure about this one because  220 also states that " The 
second and third expressions can be any type, as long their types 
match". Which to me, suggests that the char2 ?  int : int example is 
allowed. Also in table 6.14, for select() in  c ? b : a     a and b need 
to have matching types, but  c can be different as long as its integer
>      
>    char2    int2    int2     error    -        4.1
Same logic applies for this.
>    int2     char    char     error    -        7.1
And this.
>            
>    int2     int2    float2   error    -        5
Agree it should error, but because no implicit conversion is allowed 
between int2 and float2
>      
>    int2     int2    float    error    -        5
Not sure about this one, my understanding here is that an attempt will 
be made at converting the float to  a vec2. Maybe I misunderstand this rule?
>         
>    int2     char2   char2    error    -        4.1
Same as my first point


-- 
Colin Riddell

Team Lead - GPGPU Software Systems

Codeplay Software Ltd
45 York Place, Edinburgh, EH1 3HP
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: http://www.codeplay.com

This email and any attachments may contain confidential and /or privileged information and  is for use  by the addressee only. If you are not the intended recipient, please notify Codeplay Software Ltd immediately and delete the message from your computer. You may not copy or forward it,or use or disclose its contents to any other person. Any views or other information in this message which do not relate to our business are not authorized by Codeplay software Ltd, nor does this message form part of any contract unless so stated.
As internet communications are capable of data corruption Codeplay Software Ltd does not accept any responsibility for any changes made to this message after it was sent. Please note that Codeplay Software Ltd does not accept any liability or responsibility for viruses and it is your responsibility to scan any attachments.
Company registered in England and Wales, number: 04567874
Registered office: 81 Linkfield Street, Redhill RH1 6BY




More information about the cfe-dev mailing list