[OpenCL patch] asType, Convert

The attached patch adds support for builtins for astype, convert, and vec_step. I chose to group these together because they require very similar code modifications. I’ve included test cases for each.

__builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types.
__builtin_convert(): provides a way to perform scalar and vector conversions with rounding and saturation.

I have fixed the concerns with asType and other areas as mentioned by Guy Benyei in his review.

If there is no further objection and because this patch has had extensive review and has been out there for a long time, I feel this is ready to be committed and plan to do so shortly.

Thanks,
Tanya

asTypeConvertExpr.patch (33.2 KB)

Nits:

+ Args.push_back(llvm::ConstantInt::get(

The attached patch adds support for builtins for astype, convert, and
vec_step. I chose to group these together because they require very similar
code modifications. I've included test cases for each.
__builtin_astype(): Used to reinterpreted as another data type of the same
size using for both scalar and vector data types.
__builtin_convert(): provides a way to perform scalar and vector conversions
with rounding and saturation.
I have fixed the concerns with asType and other areas as mentioned by Guy
Benyei in his review.
If there is no further objection and because this patch has had extensive
review and has been out there for a long time, I feel this is ready to be
committed and plan to do so shortly.

Nits:

+ Args.push_back(llvm::ConstantInt::get(
+
llvm::Type::getInt32Ty(CGF.getLLVMContext()), 0));
+ Args.push_back(llvm::ConstantInt::get(
+
llvm::Type::getInt32Ty(CGF.getLLVMContext()), 1));
+ Args.push_back(llvm::ConstantInt::get(
+
llvm::Type::getInt32Ty(CGF.getLLVMContext()), 2));

Builder.getInt32

+ llvm::ConstantInt::get(llvm::Type::getInt32Ty(CGF.getLLVMContext()),
+ + E->getRoundingMode());
+ Value *Sat =
+ llvm::ConstantInt::get(llvm::Type::getInt32Ty(CGF.getLLVMContext()),
+ + E->getSat());

Builder.getInt32

Thanks. Updating patch and resending.

Index: docs/doxygen.cfg

--- docs/doxygen.cfg (revision 129616)
+++ docs/doxygen.cfg (working copy)
@@ -23,14 +23,14 @@

I assume you didn't mean to include this diff?

haha.. no. Thanks!

-Tanya

Here is the revised patch w/ Eli’s suggestions.

asTypeConvertExpr-2.patch (28.3 KB)

Attached is the updated patch that only implements AsType.

asType.patch (17.5 KB)