blob: a19664f3104b07e6e4167f1e50d0b7f1f3e04430 [file] [log] [blame]
Sven van Haastregt79a222f2019-06-03 09:39:11 +00001// RUN: %clang_cc1 %s -triple spir -verify -pedantic -fsyntax-only -cl-std=CL2.0 -fdeclare-opencl-builtins
2
3// Test the -fdeclare-opencl-builtins option.
4
5typedef float float4 __attribute__((ext_vector_type(4)));
6typedef int int4 __attribute__((ext_vector_type(4)));
7typedef int int2 __attribute__((ext_vector_type(2)));
8typedef unsigned int uint;
9typedef __SIZE_TYPE__ size_t;
10
11kernel void basic_conversion(global float4 *buf, global int4 *res) {
12 res[0] = convert_int4(buf[0]);
13}
14
15kernel void basic_readonly_image_type(__read_only image2d_t img, int2 coord, global float4 *out) {
16 out[0] = read_imagef(img, coord);
17}
18
19kernel void basic_subgroup(global uint *out) {
20 out[0] = get_sub_group_size();
21// expected-error@-1{{use of declaration 'get_sub_group_size' requires cl_khr_subgroups extension to be enabled}}
22#pragma OPENCL EXTENSION cl_khr_subgroups : enable
23 out[1] = get_sub_group_size();
24}