1// REQUIRES: amdgpu-registered-target
2// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple amdgcn-unknown-unknown
3// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple amdgcn-unknown-unknown
4// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple amdgcn-unknown-unknown
5// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple amdgcn-unknown-unknown
6// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
7// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
8// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
9// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
10
11// Extensions in all versions
12#ifndef cl_clang_storage_class_specifiers
13#error "Missing cl_clang_storage_class_specifiers define"
14#endif
15#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
16
17#ifndef cl_khr_fp16
18#error "Missing cl_khr_fp16 define"
19#endif
20#pragma OPENCL EXTENSION cl_khr_fp16: enable
21
22#ifndef cl_khr_int64_base_atomics
23#error "Missing cl_khr_int64_base_atomics define"
24#endif
25#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
26
27#ifndef cl_khr_int64_extended_atomics
28#error "Missing cl_khr_int64_extended_atomics define"
29#endif
30#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
31
32#ifdef cl_khr_gl_sharing
33#error "Incorrect cl_khr_gl_sharing define"
34#endif
35#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
36// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_sharing' - ignoring}}
37
38#ifndef cl_khr_icd
39#error "Missing cl_khr_icd define"
40#endif
41#pragma OPENCL EXTENSION cl_khr_icd: enable
42
43// Core features in CL 1.1
44
45#ifndef cl_khr_byte_addressable_store
46#error "Missing cl_khr_byte_addressable_store define"
47#endif
48#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
49#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
50// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}}
51#endif
52
53#ifndef cl_khr_global_int32_base_atomics
54#error "Missing cl_khr_global_int32_base_atomics define"
55#endif
56#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
57#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
58// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
59#endif
60
61#ifndef cl_khr_global_int32_extended_atomics
62#error "Missing cl_khr_global_int32_extended_atomics define"
63#endif
64#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
65#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
66// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}}
67#endif
68
69#ifndef cl_khr_local_int32_base_atomics
70#error "Missing cl_khr_local_int32_base_atomics define"
71#endif
72#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
73#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
74// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
75#endif
76
77#ifndef cl_khr_local_int32_extended_atomics
78#error "Missing cl_khr_local_int32_extended_atomics define"
79#endif
80#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
81#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
82// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_extended_atomics' is core feature or supported optional core feature - ignoring}}
83#endif
84
85#ifdef cl_khr_select_fprounding_mode
86#error "Incorrect cl_khr_select_fprounding_mode define"
87#endif
88#pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable
89// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_select_fprounding_mode' - ignoring}}
90
91
92// Core feature in CL 1.2
93#ifndef cl_khr_fp64
94#error "Missing cl_khr_fp64 define"
95#endif
96#pragma OPENCL EXTENSION cl_khr_fp64: enable
97#if (__OPENCL_C_VERSION__ >= 120) && defined TEST_CORE_FEATURES
98// expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}}
99#endif
100
101//Core feature in CL 2.0
102#ifndef cl_khr_3d_image_writes
103#error "Missing cl_khr_3d_image_writes define"
104#endif
105#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
106#if (__OPENCL_C_VERSION__ >= 200) && defined TEST_CORE_FEATURES
107// expected-warning@-2{{OpenCL extension 'cl_khr_3d_image_writes' is core feature or supported optional core feature - ignoring}}
108#endif
109
110
111
112#ifdef cl_khr_gl_event
113#error "Incorrect cl_khr_gl_event define"
114#endif
115#pragma OPENCL EXTENSION cl_khr_gl_event: enable
116// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_event' - ignoring}}
117
118#ifdef cl_khr_d3d10_sharing
119#error "Incorrect cl_khr_d3d10_sharing define"
120#endif
121#pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable
122// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_d3d10_sharing' - ignoring}}
123
124#ifdef cl_khr_context_abort
125#error "Incorrect cl_context_abort define"
126#endif
127#pragma OPENCL EXTENSION cl_khr_context_abort: enable
128// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_context_abort' - ignoring}}
129
130#ifdef cl_khr_d3d11_sharing
131#error "Incorrect cl_khr_d3d11_sharing define"
132#endif
133#pragma OPENCL EXTENSION cl_khr_d3d11_sharing: enable
134// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_d3d11_sharing' - ignoring}}
135
136#ifdef cl_khr_dx9_media_sharing
137#error "Incorrect cl_khr_dx9_media_sharing define"
138#endif
139#pragma OPENCL EXTENSION cl_khr_dx9_media_sharing: enable
140// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_dx9_media_sharing' - ignoring}}
141
142#ifdef cl_khr_image2d_from_buffer
143#error "Incorrect cl_khr_image2d_from_buffer define"
144#endif
145#pragma OPENCL EXTENSION cl_khr_image2d_from_buffer: enable
146// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_image2d_from_buffer' - ignoring}}
147
148#ifdef cl_khr_initialize_memory
149#error "Incorrect cl_khr_initialize_memory define"
150#endif
151#pragma OPENCL EXTENSION cl_khr_initialize_memory: enable
152// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_initialize_memory' - ignoring}}
153
154#ifdef cl_khr_gl_depth_images
155#error "Incorrect cl_khr_gl_depth_images define"
156#endif
157#pragma OPENCL EXTENSION cl_khr_gl_depth_images: enable
158// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_depth_images' - ignoring}}
159
160#ifdef cl_khr_gl_msaa_sharing
161#error "Incorrect cl_khr_gl_msaa_sharing define"
162#endif
163#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
164// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}}
165
166#ifdef cl_khr_spir
167#error "Incorrect cl_khr_spir define"
168#endif
169#pragma OPENCL EXTENSION cl_khr_spir: enable
170// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_spir' - ignoring}}
171
172#ifdef cl_khr_egl_event
173#error "Incorrect cl_khr_egl_event define"
174#endif
175#pragma OPENCL EXTENSION cl_khr_egl_event: enable
176// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_egl_event' - ignoring}}
177
178#ifdef cl_khr_egl_image
179#error "Incorrect cl_khr_egl_image define"
180#endif
181#pragma OPENCL EXTENSION cl_khr_egl_image: enable
182// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_egl_image' - ignoring}}
183
184#ifdef cl_khr_srgb_image_writes
185#error "Incorrect cl_khr_srgb_image_writes define"
186#endif
187#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable
188// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}}
189
190#ifdef cl_khr_subgroups
191#error "Incorrect cl_khr_subgroups define"
192#endif
193#pragma OPENCL EXTENSION cl_khr_subgroups: enable
194// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}}
195
196#ifdef cl_khr_terminate_context
197#error "Incorrect cl_khr_terminate_context define"
198#endif
199#pragma OPENCL EXTENSION cl_khr_terminate_context: enable
200// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_terminate_context' - ignoring}}
201