Changeset View
Changeset View
Standalone View
Standalone View
test/SemaOpenCL/builtin-new.cl
- This file was added.
// RUN: %clang_cc1 %s -triple spir -verify -pedantic -fsyntax-only -cl-std=CL1.2 -DCL12 | |||||
// RUN: %clang_cc1 %s -triple spir -verify -pedantic -fsyntax-only -cl-std=CL2.0 -DCL20 | |||||
typedef float float4 __attribute__((ext_vector_type(4))); | |||||
typedef int int4 __attribute__((ext_vector_type(4))); | |||||
typedef int int2 __attribute__((ext_vector_type(2))); | |||||
typedef unsigned int uint; | |||||
kernel void test(global float4* buf, global int4* res) | |||||
{ | |||||
res[0] = convert_int4(buf[0]); | |||||
} | |||||
kernel void test2(global int* bar) { | |||||
bar[0] = foo_version(bar); | |||||
} | |||||
kernel void test3(constant int* bar, global int* baz) { | |||||
baz[0] = foo_version(bar); | |||||
#ifdef CL12 | |||||
// expected-error@-2{{passing '__constant int *' to parameter of type '__global int *' changes address space of pointer}} | |||||
#endif | |||||
} | |||||
kernel void test4(image2d_t img, int2 coord, global float4* out) { | |||||
out[0] = read_imagef(img, coord); | |||||
} | |||||
kernel void test5(write_only image2d_t img, int2 coord, float4 colour) { | |||||
write_imagef(img, coord, colour); | |||||
} | |||||
#ifdef CL20 | |||||
kernel void test6(global uint* out) { | |||||
out[0] = get_sub_group_size(); | |||||
// expected-error@-1{{use of declaration 'get_sub_group_size' requires cl_khr_subgroups extension to be enabled}} | |||||
#pragma OPENCL EXTENSION cl_khr_subgroups : enable | |||||
out[1] = get_sub_group_size(); | |||||
} | |||||
#endif |