[cfe-dev] OpenCL vec_step feature implementation

Benyei, Guy guy.benyei at intel.com
Tue Feb 15 07:20:16 PST 2011


Attached our implementation for the OpenCL vec_step built in function (OpenCL 1.1 specs, 6.11.12), and a test for validating it.
We'd like to get your feedback, and eventually we'd like to contribute this code to the open source development trunk.

The vec_step function takes an expression or a type as argument, and returns 1 for scalar types, or the number of vector elements for vector types.
Since vec_step might take types as argument, it cannot be implemented as a standard function, it is rather similar to sizeof and alignof expressions. In this implementation, we take advantage of the existing SizeOfAlignOfExpr class and the functions manipulating it, and we add vec_step to this expression class.

I know that the SizeOfAlignOf name is not exactly right after this change; however I still think that this name covers the main feature handled by this class. Calling it SizeOfAlignOfVecStep would be quite long, and might get longer over time. We might change the name to something like UnaryOperatorWithExprOrType - still long and ugly, but generic. I'll be happy to get your ideas about the name.

      Guy Benyei
      SSG - MGP OpenCL Development Center

[cid:image001.png at 01CBCD2F.650F2740]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110215/2ed7e8d7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 35414 bytes
Desc: image001.png
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110215/2ed7e8d7/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opencl_vec_step.patch
Type: application/octet-stream
Size: 32121 bytes
Desc: opencl_vec_step.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110215/2ed7e8d7/attachment.obj>
-------------- next part --------------
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.

More information about the cfe-dev mailing list