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