Sven van Haastregt | 79a222f | 2019-06-03 09:39:11 +0000 | [diff] [blame^] | 1 | // 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 | |
| 5 | typedef float float4 __attribute__((ext_vector_type(4))); |
| 6 | typedef int int4 __attribute__((ext_vector_type(4))); |
| 7 | typedef int int2 __attribute__((ext_vector_type(2))); |
| 8 | typedef unsigned int uint; |
| 9 | typedef __SIZE_TYPE__ size_t; |
| 10 | |
| 11 | kernel void basic_conversion(global float4 *buf, global int4 *res) { |
| 12 | res[0] = convert_int4(buf[0]); |
| 13 | } |
| 14 | |
| 15 | kernel void basic_readonly_image_type(__read_only image2d_t img, int2 coord, global float4 *out) { |
| 16 | out[0] = read_imagef(img, coord); |
| 17 | } |
| 18 | |
| 19 | kernel 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 | } |