summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaOpenCL
diff options
context:
space:
mode:
authorSven van Haastregt <sven.vanhaastregt@arm.com>2019-11-06 11:53:19 +0000
committerSven van Haastregt <sven.vanhaastregt@arm.com>2019-11-07 14:59:33 +0000
commit0e70c350943f1a927f481529717c4f98a465777b (patch)
treeed1c6b9e27bacaa9da96eef6a98947fd33c95a57 /clang/test/SemaOpenCL
parent87bc320b510e91a1a71aa8a154c585db65579628 (diff)
downloadbcm5719-llvm-0e70c350943f1a927f481529717c4f98a465777b.tar.gz
bcm5719-llvm-0e70c350943f1a927f481529717c4f98a465777b.zip
[OpenCL] Add integer builtin functions
This patch adds the integer builtin functions from the OpenCL C specification. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D69901
Diffstat (limited to 'clang/test/SemaOpenCL')
-rw-r--r--clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl b/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
index 84cbb7aeec9..97a01a1fe93 100644
--- a/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
+++ b/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
@@ -20,18 +20,19 @@
// Provide typedefs when invoking clang without -finclude-default-header.
#ifdef NO_HEADER
+typedef unsigned char uchar;
+typedef unsigned int uint;
+typedef unsigned long ulong;
+typedef unsigned short ushort;
+typedef __SIZE_TYPE__ size_t;
typedef char char2 __attribute__((ext_vector_type(2)));
typedef char char4 __attribute__((ext_vector_type(4)));
+typedef uchar uchar4 __attribute__((ext_vector_type(4)));
typedef float float4 __attribute__((ext_vector_type(4)));
typedef half half4 __attribute__((ext_vector_type(4)));
typedef int int2 __attribute__((ext_vector_type(2)));
typedef int int4 __attribute__((ext_vector_type(4)));
typedef long long2 __attribute__((ext_vector_type(2)));
-typedef unsigned char uchar;
-typedef unsigned int uint;
-typedef unsigned long ulong;
-typedef unsigned short ushort;
-typedef __SIZE_TYPE__ size_t;
#endif
kernel void test_pointers(volatile global void *global_p, global const int4 *a) {
@@ -61,6 +62,8 @@ kernel void basic_conversion() {
char4 test_int(char c, char4 c4) {
char m = max(c, c);
char4 m4 = max(c4, c4);
+ uchar4 abs1 = abs(c4);
+ uchar4 abs2 = abs(abs1);
return max(c4, c);
}
OpenPOWER on IntegriCloud