[cfe-dev] [OpenCL Patch] Operator with mixed vector/scalar operands

Benyei, Guy guy.benyei at intel.com
Thu Jan 26 01:34:42 PST 2012


Hi Anton,
Here is the updated patch. 
Added test cases for the relevant rules in section 6.2.6.

Please review.

Thanks
   Guy


-----Original Message-----
From: Anton Lokhmotov [mailto:Anton.Lokhmotov at arm.com] 
Sent: Wednesday, January 11, 2012 17:18
To: Benyei, Guy
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [OpenCL Patch] Operator with mixed vector/scalar operands

Hi Guy,

Thanks for the update.  Could you please provide test cases for each rule in
section 6.2.6?

Also, please follow the usual LLVM style:

   * if(..) -> if (..)

   * }else if(..) -> } else if (..)

   * terminate comments with dots, etc.

Thanks,
Anton.



> -----Original Message-----
> From: Benyei, Guy [mailto:guy.benyei at intel.com]
> Sent: 11 January 2012 12:43
> To: Anton Lokhmotov
> Cc: cfe-dev at cs.uiuc.edu
> Subject: RE: cfe-dev Digest, Vol 55, Issue 35
> 
> Hi Anton,
> Thanks for your answer. You're right, I've missed that part in the
> spec.
> 
> Attached a fixed patch.
> 
> Thanks
>    Guy
> 
> 
> -----Original Message-----
> From: Anton Lokhmotov [mailto:Anton.Lokhmotov at arm.com]
> Sent: Tuesday, January 10, 2012 18:58
> To: Benyei, Guy
> Cc: cfe-dev at cs.uiuc.edu
> Subject: RE: cfe-dev Digest, Vol 55, Issue 35
> 
> Hi Guy,
> 
> > the scalar operand should be converted to the Vector's
> > elements type, and the widened to a vector of the same size as the
> > vector operand.
> 
> 
> There's a complication described in Section 6.2.6 (Usual Arithmetic
> Conversions):
> 
> - "An error shall occur if any scalar operand has greater rank than the
> type
> of the vector element."
> 
> - "2. The rank of any floating-point type is greater than the rank of
> any
> integer type."
> 
> Therefore, expressions like "(int2)(0,1) + 1.0f" must be rejected.  Our
> frontend gives the following error messages on your test code:
> 
> vector_scalar_operation.cl:9:18: error: Cannot downconvert and widen
> scalar
> type 'float' to vector type 'int4'
>         int4 res = ivec + f;
>                    ~~~~ ^ ~
> vector_scalar_operation.cl:10:16: error: Cannot downconvert and widen
> scalar
> type 'float' to vector type 'int4'
>         int4 res2 = f + ivec;
>                     ~ ^ ~~~~
> 
> We are happy to submit soon a patch implementing this, but are about to
> submit another one (and also are waiting for last submitted patch
> (http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-January/019448.html to
> be
> committed).
> 
> Best wishes,
> Anton.



---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vector_scalar3.patch
Type: application/octet-stream
Size: 7389 bytes
Desc: vector_scalar3.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120126/780b7eb0/attachment.obj>


More information about the cfe-dev mailing list