summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/layer.conf2
-rw-r--r--conf/machine/include/meta-intel.inc6
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0001-OpenCL-3.0-support.patch8451
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0001-llvm-spirv-skip-building-tests.patch51
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0002-Add-support-for-cl_ext_float_atomics-in-SPIRVWriter.patch433
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0002-Memory-leak-fix-for-Managed-Static-Mutex.patch35
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0003-Remove-repo-name-in-LLVM-IR.patch49
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0004-Remove-__IMAGE_SUPPORT__-macro-for-SPIR-since-SPIR-d.patch51
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0005-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch52
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0006-OpenCL-support-cl_ext_float_atomics.patch353
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0007-ispc-11_0_11_1_disable-A-B-A-B-in-InstCombine.patch47
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0008-ispc-11_0_11_1_packed_load_store_avx512.patch95
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend22
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_11.0.0.bb15
14 files changed, 4 insertions, 9658 deletions
diff --git a/conf/layer.conf b/conf/layer.conf
index b48cf61..eb8ab7f 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -18,7 +18,7 @@ LAYERRECOMMENDS_intel = "dpdk"
18# This should only be incremented on significant changes that will 18# This should only be incremented on significant changes that will
19# cause compatibility issues with other layers 19# cause compatibility issues with other layers
20LAYERVERSION_intel = "5" 20LAYERVERSION_intel = "5"
21LAYERSERIES_COMPAT_intel = "dunfell gatesgarth hardknott honister" 21LAYERSERIES_COMPAT_intel = "dunfell hardknott honister"
22 22
23BBFILES_DYNAMIC += " \ 23BBFILES_DYNAMIC += " \
24 clang-layer:${LAYERDIR}/dynamic-layers/clang-layer/*/*/*.bb \ 24 clang-layer:${LAYERDIR}/dynamic-layers/clang-layer/*/*/*.bb \
diff --git a/conf/machine/include/meta-intel.inc b/conf/machine/include/meta-intel.inc
index f4d4c61..7ae7826 100644
--- a/conf/machine/include/meta-intel.inc
+++ b/conf/machine/include/meta-intel.inc
@@ -27,11 +27,9 @@ PREFERRED_PROVIDER_libva-utils-native = "libva-intel-utils-native"
27PREFERRED_PROVIDER_nativesdk-libva-utils = "nativesdk-libva-intel-utils" 27PREFERRED_PROVIDER_nativesdk-libva-utils = "nativesdk-libva-intel-utils"
28 28
29PREFERRED_VERSION_opencl-clang ?= "${@bb.utils.contains('LLVMVERSION', '10.0.1', '10.0.0', \ 29PREFERRED_VERSION_opencl-clang ?= "${@bb.utils.contains('LLVMVERSION', '10.0.1', '10.0.0', \
30 bb.utils.contains('LLVMVERSION', '11.1.0', '11.0.0', \ 30 bb.utils.contains('LLVMVERSION', '12.0.0', '12.0.0', '13.0.0', d), d)}"
31 bb.utils.contains('LLVMVERSION', '12.0.0', '12.0.0', '13.0.0', d), d), d)}"
32PREFERRED_VERSION_opencl-clang-native ?= "${@bb.utils.contains('LLVMVERSION', '10.0.1', '10.0.0', \ 31PREFERRED_VERSION_opencl-clang-native ?= "${@bb.utils.contains('LLVMVERSION', '10.0.1', '10.0.0', \
33 bb.utils.contains('LLVMVERSION', '11.1.0', '11.0.0', \ 32 bb.utils.contains('LLVMVERSION', '12.0.0', '12.0.0', '13.0.0', d), d)}"
34 bb.utils.contains('LLVMVERSION', '12.0.0', '12.0.0', '13.0.0', d), d), d)}"
35 33
36XSERVER_X86_ASPEED_AST = "xf86-video-ast \ 34XSERVER_X86_ASPEED_AST = "xf86-video-ast \
37 " 35 "
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0001-OpenCL-3.0-support.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0001-OpenCL-3.0-support.patch
deleted file mode 100644
index af433e1..0000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-0001-OpenCL-3.0-support.patch
+++ /dev/null
@@ -1,8451 +0,0 @@
1From 36d87f69fee9c3d3f399f8e4027ab707ad050e80 Mon Sep 17 00:00:00 2001
2From: Anton Zabaznov <anton.zabaznov@intel.com>
3Date: Tue, 22 Sep 2020 19:03:50 +0300
4Subject: [PATCH 1/6] OpenCL 3.0 support
5
6Upstream-Status: Backport [Taken from opencl-clang patches, https://github.com/intel/opencl-clang/blob/ocl-open-110/patches/clang/0001-OpenCL-3.0-support.patch]
7Signed-off-by: Anton Zabaznov <anton.zabaznov@intel.com>
8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9---
10 clang/include/clang/Basic/Builtins.def | 65 +-
11 clang/include/clang/Basic/Builtins.h | 13 +-
12 .../clang/Basic/DiagnosticParseKinds.td | 2 +
13 .../clang/Basic/DiagnosticSemaKinds.td | 7 +
14 clang/include/clang/Basic/LangOptions.def | 2 +
15 clang/include/clang/Basic/LangStandards.def | 4 +
16 .../include/clang/Basic/OpenCLExtensions.def | 15 +
17 clang/include/clang/Basic/OpenCLOptions.h | 174 +-
18 clang/include/clang/Driver/Options.td | 2 +-
19 clang/include/clang/Sema/Sema.h | 9 +
20 clang/lib/AST/ASTContext.cpp | 3 +-
21 clang/lib/Basic/Builtins.cpp | 28 +-
22 clang/lib/Basic/TargetInfo.cpp | 11 +
23 clang/lib/Basic/Targets.cpp | 1 -
24 clang/lib/CodeGen/CodeGenFunction.cpp | 6 +-
25 clang/lib/Frontend/CompilerInvocation.cpp | 22 +-
26 clang/lib/Frontend/InitPreprocessor.cpp | 6 +-
27 clang/lib/Headers/opencl-c-base.h | 75 +-
28 clang/lib/Headers/opencl-c.h | 3216 ++++++++++++++---
29 clang/lib/Parse/ParseDecl.cpp | 12 +-
30 clang/lib/Parse/ParsePragma.cpp | 10 +-
31 clang/lib/Sema/OpenCLBuiltins.td | 153 +-
32 clang/lib/Sema/Sema.cpp | 47 +-
33 clang/lib/Sema/SemaChecking.cpp | 38 +-
34 clang/lib/Sema/SemaDecl.cpp | 18 +-
35 clang/lib/Sema/SemaDeclAttr.cpp | 9 +-
36 clang/lib/Sema/SemaDeclCXX.cpp | 12 +-
37 clang/lib/Sema/SemaLookup.cpp | 19 +-
38 clang/lib/Sema/SemaType.cpp | 14 +-
39 .../CodeGenOpenCL/addr-space-struct-arg.cl | 7 +-
40 .../address-spaces-conversions.cl | 2 +
41 .../CodeGenOpenCL/address-spaces-mangling.cl | 3 +-
42 clang/test/CodeGenOpenCL/address-spaces.cl | 4 +
43 .../amdgcn-automatic-variable.cl | 1 +
44 .../CodeGenOpenCL/amdgpu-sizeof-alignof.cl | 21 +-
45 .../CodeGenOpenCL/arm-integer-dot-product.cl | 1 +
46 .../test/CodeGenOpenCL/cl-uniform-wg-size.cl | 2 +
47 clang/test/CodeGenOpenCL/fpmath.cl | 2 +
48 .../generic-address-space-feature.cl | 28 +
49 .../intel-subgroups-avc-ext-types.cl | 1 +
50 .../kernels-have-spir-cc-by-default.cl | 3 +
51 clang/test/CodeGenOpenCL/logical-ops.cl | 1 +
52 clang/test/CodeGenOpenCL/no-half.cl | 1 +
53 clang/test/CodeGenOpenCL/pipe_builtin.cl | 3 +
54 clang/test/CodeGenOpenCL/pipe_types.cl | 1 +
55 clang/test/CodeGenOpenCL/printf.cl | 2 +
56 clang/test/CodeGenOpenCL/unroll-hint.cl | 1 +
57 clang/test/Driver/autocomplete.c | 2 +
58 clang/test/Driver/opencl.cl | 2 +
59 clang/test/Driver/unknown-std.cl | 1 +
60 clang/test/Frontend/stdlang.c | 1 +
61 clang/test/Headers/opencl-c-header.cl | 7 +-
62 clang/test/Index/pipe-size.cl | 7 +
63 clang/test/Preprocessor/init-aarch64.c | 12 +-
64 clang/test/Preprocessor/predefined-macros.c | 13 +
65 .../Sema/feature-extensions-simult-support.cl | 75 +
66 clang/test/Sema/features-ignore-pragma.cl | 24 +
67 clang/test/Sema/opencl-features-pipes.cl | 18 +
68 clang/test/Sema/opencl-features.cl | 128 +
69 clang/test/Sema/pipe_builtins_feature.cl | 21 +
70 .../address-spaces-conversions-cl2.0.cl | 3 +
71 clang/test/SemaOpenCL/address-spaces.cl | 1 +
72 .../SemaOpenCL/cl20-device-side-enqueue.cl | 16 +-
73 .../SemaOpenCL/forget-unsupported-builtins.cl | 22 +
74 clang/test/SemaOpenCL/image-features.cl | 20 +
75 .../SemaOpenCL/invalid-pipe-builtin-cl2.0.cl | 1 +
76 clang/test/SemaOpenCL/storageclass-cl20.cl | 1 +
77 .../TableGen/ClangOpenCLBuiltinEmitter.cpp | 35 +-
78 68 files changed, 3749 insertions(+), 738 deletions(-)
79 create mode 100644 clang/test/CodeGenOpenCL/generic-address-space-feature.cl
80 create mode 100644 clang/test/Sema/feature-extensions-simult-support.cl
81 create mode 100644 clang/test/Sema/features-ignore-pragma.cl
82 create mode 100644 clang/test/Sema/opencl-features-pipes.cl
83 create mode 100644 clang/test/Sema/opencl-features.cl
84 create mode 100644 clang/test/Sema/pipe_builtins_feature.cl
85 create mode 100644 clang/test/SemaOpenCL/forget-unsupported-builtins.cl
86 create mode 100644 clang/test/SemaOpenCL/image-features.cl
87
88diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def
89index 5463b7dfc18c..e094beab9a6c 100644
90--- a/clang/include/clang/Basic/Builtins.def
91+++ b/clang/include/clang/Basic/Builtins.def
92@@ -111,6 +111,10 @@
93 # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
94 #endif
95
96+#if defined(BUILTIN) && !defined(OPENCLBUILTIN)
97+# define OPENCLBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG, FEATURE) BUILTIN(ID, TYPE, ATTRS)
98+#endif
99+
100 // Standard libc/libm functions:
101 BUILTIN(__builtin_atan2 , "ddd" , "Fne")
102 BUILTIN(__builtin_atan2f, "fff" , "Fne")
103@@ -1529,50 +1533,54 @@ BUILTIN(__builtin_coro_param, "bv*v*", "n")
104
105 // OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
106 // We need the generic prototype, since the packet type could be anything.
107-LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
108-LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG)
109+OPENCLBUILTIN(read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
110+OPENCLBUILTIN(write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
111
112-LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG)
113-LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG)
114+OPENCLBUILTIN(reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
115+OPENCLBUILTIN(reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
116
117-LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG)
118-LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG)
119+OPENCLBUILTIN(commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
120+OPENCLBUILTIN(commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
121
122-LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
123-LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
124+OPENCLBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
125+OPENCLBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
126
127-LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
128-LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
129+OPENCLBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
130+OPENCLBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
131
132-LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
133-LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
134+OPENCLBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
135+OPENCLBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
136
137-LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
138-LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
139+OPENCLBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
140+OPENCLBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
141
142-LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
143-LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
144+OPENCLBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
145+OPENCLBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
146
147 // OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
148 // Custom builtin check allows to perform special check of passed block arguments.
149-LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
150-LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC20_LANG)
151-LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCLC20_LANG)
152-LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCLC20_LANG)
153-LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC20_LANG)
154+OPENCLBUILTIN(enqueue_kernel, "i.", "tn", OCLC2P_LANG,
155+ "__opencl_c_device_enqueue")
156+OPENCLBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC2P_LANG,
157+ "__opencl_c_device_enqueue")
158+OPENCLBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn",
159+ OCLC2P_LANG, "__opencl_c_device_enqueue")
160+OPENCLBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn",
161+ OCLC2P_LANG, "__opencl_c_device_enqueue")
162+OPENCLBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_device_enqueue")
163
164 // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
165 // FIXME: Pointer parameters of OpenCL builtins should have their address space
166 // requirement defined.
167-LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
168-LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
169-LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
170+OPENCLBUILTIN(to_global, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
171+OPENCLBUILTIN(to_local, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
172+OPENCLBUILTIN(to_private, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
173
174 // OpenCL half load/store builtin
175-LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES)
176-LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES)
177-LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES)
178-LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES)
179+OPENCLBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES, "")
180+OPENCLBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES, "")
181+OPENCLBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES, "")
182+OPENCLBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES, "")
183
184 // Builtins for os_log/os_trace
185 BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nut")
186@@ -1593,3 +1601,4 @@ BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n")
187 #undef BUILTIN
188 #undef LIBBUILTIN
189 #undef LANGBUILTIN
190+#undef OPENCLBUILTIN
191diff --git a/clang/include/clang/Basic/Builtins.h b/clang/include/clang/Basic/Builtins.h
192index 15bfcf797917..ba3e7853444c 100644
193--- a/clang/include/clang/Basic/Builtins.h
194+++ b/clang/include/clang/Basic/Builtins.h
195@@ -33,13 +33,13 @@ enum LanguageID {
196 CXX_LANG = 0x4, // builtin for cplusplus only.
197 OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
198 MS_LANG = 0x10, // builtin requires MS mode.
199- OCLC20_LANG = 0x20, // builtin for OpenCL C 2.0 only.
200+ OCLC2P_LANG = 0x20, // builtin for OpenCL C 2.0+ versions.
201 OCLC1X_LANG = 0x40, // builtin for OpenCL C 1.x only.
202 OMP_LANG = 0x80, // builtin requires OpenMP.
203 ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
204 ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
205 ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG, // builtin requires MS mode.
206- ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC20_LANG // builtin for OCLC languages.
207+ ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC2P_LANG // builtin for OCLC languages.
208 };
209
210 namespace Builtin {
211@@ -235,6 +235,10 @@ public:
212 /// for non-builtins.
213 bool canBeRedeclared(unsigned ID) const;
214
215+ bool requiresFeatures(unsigned ID) const {
216+ return requiresFeatures(getRecord(ID));
217+ }
218+
219 private:
220 const Info &getRecord(unsigned ID) const;
221
222@@ -242,6 +246,11 @@ private:
223 bool builtinIsSupported(const Builtin::Info &BuiltinInfo,
224 const LangOptions &LangOpts);
225
226+ bool OclBuiltinIsSupported(const Builtin::Info &BuiltinInfo,
227+ const LangOptions &LangOpts) const;
228+
229+ bool requiresFeatures(const Builtin::Info &BuiltinInfo) const;
230+
231 /// Helper function for isPrintfLike and isScanfLike.
232 bool isLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg,
233 const char *Fmt) const;
234diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
235index 1038a4119d4c..ba1b1b67a131 100644
236--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
237+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
238@@ -1206,6 +1206,8 @@ def warn_pragma_unsupported_extension : Warning<
239 "unsupported OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
240 def warn_pragma_extension_is_core : Warning<
241 "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup<DiagGroup<"pedantic-core-features">>, DefaultIgnore;
242+def warn_opencl_pragma_feature_ignore : Warning<
243+ "OpenCL feature support can't be controlled via pragma, ignoring">, InGroup<IgnoredPragmas>;
244
245 // OpenCL errors.
246 def err_opencl_taking_function_address_parser : Error<
247diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
248index 941f2cafc372..aa9e8b7b011b 100644
249--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
250+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
251@@ -9741,6 +9741,13 @@ def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
252 def err_openclcxx_placement_new : Error<
253 "use of placement new requires explicit declaration">;
254
255+def err_opencl_pipes_require_feat : Error<
256+ "usage of OpenCL pipes requires feature support">;
257+def err_opencl_memory_scope_require_feat : Error<
258+ "usage of memory scope requires feature support">;
259+def err_opencl_memory_ordering_require_feat : Error<
260+ "usage of memory ordering requires feature support">;
261+
262 // MIG routine annotations.
263 def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
264 "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
265diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
266index 70f68d664bb7..e683f5956975 100644
267--- a/clang/include/clang/Basic/LangOptions.def
268+++ b/clang/include/clang/Basic/LangOptions.def
269@@ -215,6 +215,8 @@ LANGOPT(OpenCL , 1, 0, "OpenCL")
270 LANGOPT(OpenCLVersion , 32, 0, "OpenCL C version")
271 LANGOPT(OpenCLCPlusPlus , 1, 0, "C++ for OpenCL")
272 LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "C++ for OpenCL version")
273+LANGOPT(OpenCLGenericKeyword , 1, 0, "OpenCL generic keyword")
274+LANGOPT(OpenCLPipeKeyword , 1, 0, "OpenCL pipe keyword")
275 LANGOPT(NativeHalfType , 1, 0, "Native half type support")
276 LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
277 LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
278diff --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
279index b09568e8b3e8..7b915c312746 100644
280--- a/clang/include/clang/Basic/LangStandards.def
281+++ b/clang/include/clang/Basic/LangStandards.def
282@@ -167,6 +167,9 @@ LANGSTANDARD(opencl12, "cl1.2",
283 LANGSTANDARD(opencl20, "cl2.0",
284 OpenCL, "OpenCL 2.0",
285 LineComment | C99 | Digraphs | HexFloat | OpenCL)
286+LANGSTANDARD(opencl30, "cl3.0",
287+ OpenCL, "OpenCL 3.0",
288+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
289 LANGSTANDARD(openclcpp, "clc++",
290 OpenCL, "C++ for OpenCL",
291 LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
292@@ -176,6 +179,7 @@ LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
293 LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
294 LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
295 LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
296+LANGSTANDARD_ALIAS_DEPR(opencl30, "CL3.0")
297 LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++")
298
299 // CUDA
300diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
301index 1ae36b32fb0a..d1574164f9b2 100644
302--- a/clang/include/clang/Basic/OpenCLExtensions.def
303+++ b/clang/include/clang/Basic/OpenCLExtensions.def
304@@ -100,6 +100,21 @@ OPENCLEXT_INTERNAL(cl_intel_subgroups, 120, ~0U)
305 OPENCLEXT_INTERNAL(cl_intel_subgroups_short, 120, ~0U)
306 OPENCLEXT_INTERNAL(cl_intel_device_side_avc_motion_estimation, 120, ~0U)
307
308+OPENCLEXT_INTERNAL(__opencl_c_pipes, 200, ~0U)
309+OPENCLEXT_INTERNAL(__opencl_c_generic_address_space, 200, ~0U)
310+OPENCLEXT_INTERNAL(__opencl_c_work_group_collective_functions, 200, ~0U)
311+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_acq_rel, 200, ~0U)
312+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_seq_cst, 200, ~0U)
313+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_device, 200, ~0U)
314+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_all_devices, 200, ~0U)
315+OPENCLEXT_INTERNAL(__opencl_c_subgroups, 200, ~0U)
316+OPENCLEXT_INTERNAL(__opencl_c_3d_image_writes, 100, ~0U)
317+OPENCLEXT_INTERNAL(__opencl_c_device_enqueue, 200, ~0U)
318+OPENCLEXT_INTERNAL(__opencl_c_read_write_images, 200, ~0U)
319+OPENCLEXT_INTERNAL(__opencl_c_program_scope_global_variables, 200, ~0U)
320+OPENCLEXT_INTERNAL(__opencl_c_fp64, 120, ~0U)
321+OPENCLEXT_INTERNAL(__opencl_c_int64, 100, ~0U)
322+OPENCLEXT_INTERNAL(__opencl_c_images, 100, ~0U)
323 #undef OPENCLEXT_INTERNAL
324
325 #ifdef OPENCLEXT
326diff --git a/clang/include/clang/Basic/OpenCLOptions.h b/clang/include/clang/Basic/OpenCLOptions.h
327index 15661154eab5..d5800f5611c6 100644
328--- a/clang/include/clang/Basic/OpenCLOptions.h
329+++ b/clang/include/clang/Basic/OpenCLOptions.h
330@@ -21,6 +21,10 @@ namespace clang {
331
332 /// OpenCL supported extensions and optional core features
333 class OpenCLOptions {
334+ // OpenCL Version
335+ unsigned CLVer = 120;
336+ bool IsOpenCLCPlusPlus = false;
337+
338 struct Info {
339 bool Supported; // Is this option supported
340 bool Enabled; // Is this option enabled
341@@ -31,7 +35,38 @@ class OpenCLOptions {
342 :Supported(S), Enabled(E), Avail(A), Core(C){}
343 };
344 llvm::StringMap<Info> OptMap;
345+
346 public:
347+ void setOpenCLVersion(const LangOptions &LO) {
348+ IsOpenCLCPlusPlus = LO.OpenCLCPlusPlus;
349+ CLVer = IsOpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
350+ }
351+
352+ // Get extension which is semantically equivalent to a given feature
353+ // if exists (e.g. __opencl_c_subgroups -> cl_khr_subgroups)
354+ llvm::Optional<StringRef> getEquivalentExtension(StringRef Feature) const {
355+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Feature)
356+ .Case("__opencl_c_3d_image_writes",
357+ Optional<StringRef>("cl_khr_3d_image_writes"))
358+ .Case("__opencl_c_subgroups", Optional<StringRef>("cl_khr_subgroups"))
359+ .Case("__opencl_c_fp64", Optional<StringRef>("cl_khr_fp64"))
360+ .Default(Optional<StringRef>());
361+ }
362+
363+ // Same as above but for extensions
364+ llvm::Optional<StringRef> getEquivalentFeature(StringRef Extension) const {
365+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Extension)
366+ .Case("cl_khr_3d_image_writes",
367+ Optional<StringRef>("__opencl_c_3d_image_writes"))
368+ .Case("cl_khr_subgroups", Optional<StringRef>("__opencl_c_subgroups"))
369+ .Case("cl_khr_fp64", Optional<StringRef>("__opencl_c_fp64"))
370+ .Default(Optional<StringRef>());
371+ }
372+
373+ bool isFeature(llvm::StringRef Ext) const {
374+ return Ext.startswith("__opencl_c");
375+ }
376+
377 bool isKnown(llvm::StringRef Ext) const {
378 return OptMap.find(Ext) != OptMap.end();
379 }
380@@ -42,32 +77,88 @@ public:
381
382 // Is supported as either an extension or an (optional) core feature for
383 // OpenCL version \p CLVer.
384- bool isSupported(llvm::StringRef Ext, const LangOptions &LO) const {
385+ bool isSupported(llvm::StringRef Ext) const {
386 // In C++ mode all extensions should work at least as in v2.0.
387- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
388 auto I = OptMap.find(Ext)->getValue();
389 return I.Supported && I.Avail <= CLVer;
390 }
391
392 // Is supported (optional) OpenCL core features for OpenCL version \p CLVer.
393 // For supported extension, return false.
394- bool isSupportedCore(llvm::StringRef Ext, const LangOptions &LO) const {
395+ bool isSupportedCore(llvm::StringRef Ext) const {
396 // In C++ mode all extensions should work at least as in v2.0.
397- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
398 auto I = OptMap.find(Ext)->getValue();
399 return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core;
400 }
401
402 // Is supported OpenCL extension for OpenCL version \p CLVer.
403 // For supported (optional) core feature, return false.
404- bool isSupportedExtension(llvm::StringRef Ext, const LangOptions &LO) const {
405+ bool isSupportedExtension(llvm::StringRef Ext) const {
406 // In C++ mode all extensions should work at least as in v2.0.
407- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
408 auto I = OptMap.find(Ext)->getValue();
409 return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core);
410 }
411
412+ // Support features whose support is directly related to the
413+ // specific OpenCL version. For example, OpenCL 2.0 supports
414+ // all features that are optional in 3.0
415+ void adjustFeatures() {
416+ // Support int64 by default (assume compiling for FULL profile)
417+ OptMap["__opencl_c_int64"].Supported = true;
418+
419+ if (CLVer >= 300) {
420+ // Simultaneously support extension and corresponding feature
421+ for (llvm::StringRef F :
422+ {"__opencl_c_subgroups", "__opencl_c_3d_image_writes",
423+ "__opencl_c_fp64"}) {
424+ auto Ext = getEquivalentExtension(F);
425+ OptMap[*Ext].Supported = OptMap[F].Supported;
426+ }
427+
428+ // OpenCL C compilers that define the feature macro __opencl_c_pipes or
429+ // or __opencl_c_device_enqueue must also define the
430+ // feature macro __opencl_c_generic_address_space.
431+ if (OptMap["__opencl_c_pipes"].Supported ||
432+ OptMap["__opencl_c_device_enqueue"].Supported)
433+ OptMap["__opencl_c_generic_address_space"].Supported = true;
434+
435+ // OpenCL C compilers that define the feature macro
436+ // __opencl_c_3d_image_writes or __opencl_c_read_write_images must also
437+ // define the feature macro __opencl_c_images
438+ if (OptMap["__opencl_c_3d_image_writes"].Supported ||
439+ OptMap["__opencl_c_read_write_images"].Supported)
440+ OptMap["__opencl_c_images"].Supported = true;
441+
442+ // All other features are already supported with options
443+ // or in target settings
444+ return;
445+ }
446+
447+ auto FeaturesRange = llvm::make_filter_range(
448+ OptMap, [&](llvm::StringMapEntry<Info> &OptVal) {
449+ auto Opt = OptVal.getKey();
450+ return isFeature(Opt);
451+ });
452+
453+ for (auto &It : FeaturesRange) {
454+ auto &Info = It.getValue();
455+ // For OpenCL version less then 3.0 some
456+ // features should be supported simulateneously
457+ // with specific extension
458+ if (Optional<llvm::StringRef> Ext = getEquivalentExtension(It.getKey()))
459+ Info.Supported = Info.Enabled = OptMap[*Ext].Supported;
460+ else if (Info.Avail <= CLVer)
461+ Info.Supported = Info.Enabled = true;
462+ }
463+ }
464+
465 void enable(llvm::StringRef Ext, bool V = true) {
466+ // Ignore disabling extensions if corresponding features
467+ // already supported for OpenCL version higher then 3.0
468+ if (CLVer >= 300)
469+ if (Optional<llvm::StringRef> F = getEquivalentFeature(Ext))
470+ if (V != OptMap[*F].Enabled)
471+ return;
472 OptMap[Ext].Enabled = V;
473 }
474
475@@ -96,7 +187,7 @@ public:
476 OptMap[Ext].Supported = V;
477 }
478
479- OpenCLOptions(){
480+ OpenCLOptions() {
481 #define OPENCLEXT_INTERNAL(Ext, AvailVer, CoreVer) \
482 OptMap[#Ext].Avail = AvailVer; \
483 OptMap[#Ext].Core = CoreVer;
484@@ -104,35 +195,86 @@ public:
485 }
486
487 void addSupport(const OpenCLOptions &Opts) {
488+ assert(IsOpenCLCPlusPlus == Opts.IsOpenCLCPlusPlus && CLVer == Opts.CLVer);
489 for (auto &I:Opts.OptMap)
490- if (I.second.Supported)
491+ if (I.second.Supported) {
492 OptMap[I.getKey()].Supported = true;
493+ // All features are enabled as they are supported
494+ if (isFeature(I.getKey()))
495+ OptMap[I.getKey()].Enabled = true;
496+ }
497+ if (CLVer >= 300) {
498+ // Enabling extensions with respect to features
499+ for (llvm::StringRef Ext :
500+ {"cl_khr_3d_image_writes", "cl_khr_subgroups", "cl_khr_fp64"}) {
501+ auto Feature = getEquivalentFeature(Ext);
502+ enable(Ext, OptMap[*Feature].Enabled);
503+ }
504+ }
505 }
506
507 void copy(const OpenCLOptions &Opts) {
508+ CLVer = Opts.CLVer;
509+ IsOpenCLCPlusPlus = Opts.IsOpenCLCPlusPlus;
510 OptMap = Opts.OptMap;
511 }
512
513 // Turn on or off support of all options.
514 void supportAll(bool On = true) {
515- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
516- E = OptMap.end(); I != E; ++I)
517- I->second.Supported = On;
518+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
519+ I != E; ++I)
520+ if (!isFeature(I->getKey()))
521+ I->second.Supported = On;
522 }
523
524 void disableAll() {
525- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
526- E = OptMap.end(); I != E; ++I)
527- I->second.Enabled = false;
528+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
529+ I != E; ++I) {
530+ auto Ext = I->getKey();
531+ if (!isFeature(Ext))
532+ enable(Ext, false);
533+ }
534 }
535
536- void enableSupportedCore(LangOptions LO) {
537+ void enableSupportedCore() {
538 for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
539 I != E; ++I)
540- if (isSupportedCore(I->getKey(), LO))
541+ if (isSupportedCore(I->getKey()))
542 I->second.Enabled = true;
543 }
544
545+ // This enum specifies how OpenCL versions map into values
546+ // for encoding. This is used when generating built-ins
547+ // from tablegen
548+ enum OpenCLVersionsEncodings : unsigned short {
549+ OPENCL_C_100_CODE = 0x1,
550+ OPENCL_C_110_CODE = 0x2,
551+ OPENCL_C_120_CODE = 0x4,
552+ OPENCL_C_200_CODE = 0x8,
553+ OPENCL_C_300_CODE = 0x10,
554+ OPENCL_C_ALL_CODE = 0x1f
555+ };
556+
557+ // Encode version into single integer
558+ static unsigned short EncodeVersion(unsigned OpenCLVersion) {
559+ switch (OpenCLVersion) {
560+ default:
561+ llvm_unreachable("Unknown OpenCL version");
562+ case 0:
563+ return OpenCLVersionsEncodings::OPENCL_C_ALL_CODE;
564+ case 100:
565+ return OpenCLVersionsEncodings::OPENCL_C_100_CODE;
566+ case 110:
567+ return OpenCLVersionsEncodings::OPENCL_C_110_CODE;
568+ case 120:
569+ return OpenCLVersionsEncodings::OPENCL_C_120_CODE;
570+ case 200:
571+ return OpenCLVersionsEncodings::OPENCL_C_200_CODE;
572+ case 300:
573+ return OpenCLVersionsEncodings::OPENCL_C_300_CODE;
574+ }
575+ }
576+
577 friend class ASTWriter;
578 friend class ASTReader;
579 };
580diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
581index 966cb907b7e2..62536f2470c2 100644
582--- a/clang/include/clang/Driver/Options.td
583+++ b/clang/include/clang/Driver/Options.td
584@@ -557,7 +557,7 @@ def cl_mad_enable : Flag<["-"], "cl-mad-enable">, Group<opencl_Group>, Flags<[CC
585 def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, Group<opencl_Group>, Flags<[CC1Option]>,
586 HelpText<"OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.">;
587 def cl_std_EQ : Joined<["-"], "cl-std=">, Group<opencl_Group>, Flags<[CC1Option]>,
588- HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,clc++,CLC++">;
589+ HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,cl3.0,CL3.0,clc++,CLC++">;
590 def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, Group<opencl_Group>,
591 HelpText<"OpenCL only. Allow denormals to be flushed to zero.">;
592 def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-rounded-divide-sqrt">, Group<opencl_Group>, Flags<[CC1Option]>,
593diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
594index 16a7084f6b08..5920c27229d8 100644
595--- a/clang/include/clang/Sema/Sema.h
596+++ b/clang/include/clang/Sema/Sema.h
597@@ -9930,6 +9930,10 @@ public:
598 /// \return true if type is disabled.
599 bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
600
601+ bool checkOpenCLSubgroupExtForCallExpr(CallExpr *Call);
602+
603+ bool isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const;
604+
605 //===--------------------------------------------------------------------===//
606 // OpenMP directives and clauses.
607 //
608@@ -11527,6 +11531,11 @@ public:
609 /// that the user intended an assignment used as condition.
610 void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE);
611
612+ template <typename DiagLocT, typename DiagInfoT>
613+ void DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
614+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
615+ unsigned Selector, SourceRange SrcRange);
616+
617 /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
618 ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
619
620diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
621index bf51d35d9693..a54ea8475d7d 100644
622--- a/clang/lib/AST/ASTContext.cpp
623+++ b/clang/lib/AST/ASTContext.cpp
624@@ -1433,7 +1433,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
625 ObjCSuperType = QualType();
626
627 // void * type
628- if (LangOpts.OpenCLVersion >= 200) {
629+ if (Target.getSupportedOpenCLOpts().isEnabled(
630+ "__opencl_c_generic_address_space")) {
631 auto Q = VoidTy.getQualifiers();
632 Q.setAddressSpace(LangAS::opencl_generic);
633 VoidPtrTy = getPointerType(getCanonicalType(
634diff --git a/clang/lib/Basic/Builtins.cpp b/clang/lib/Basic/Builtins.cpp
635index 0cd89df41b67..7a3067345098 100644
636--- a/clang/lib/Basic/Builtins.cpp
637+++ b/clang/lib/Basic/Builtins.cpp
638@@ -23,6 +23,8 @@ static const Builtin::Info BuiltinInfo[] = {
639 { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr },
640 #define LANGBUILTIN(ID, TYPE, ATTRS, LANGS) \
641 { #ID, TYPE, ATTRS, nullptr, LANGS, nullptr },
642+#define OPENCLBUILTIN(ID, TYPE, ATTRS, LANGS, FEATURE) \
643+ {#ID, TYPE, ATTRS, nullptr, LANGS, FEATURE},
644 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, LANGS) \
645 { #ID, TYPE, ATTRS, HEADER, LANGS, nullptr },
646 #include "clang/Basic/Builtins.def"
647@@ -69,16 +71,17 @@ bool Builtin::Context::builtinIsSupported(const Builtin::Info &BuiltinInfo,
648 bool ObjCUnsupported = !LangOpts.ObjC && BuiltinInfo.Langs == OBJC_LANG;
649 bool OclC1Unsupported = (LangOpts.OpenCLVersion / 100) != 1 &&
650 (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES ) == OCLC1X_LANG;
651- bool OclC2Unsupported =
652- (LangOpts.OpenCLVersion != 200 && !LangOpts.OpenCLCPlusPlus) &&
653- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC20_LANG;
654+ bool OclC2PUnsupported =
655+ (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC2P_LANG &&
656+ ((LangOpts.OpenCLVersion < 200 && !LangOpts.OpenCLCPlusPlus) ||
657+ !OclBuiltinIsSupported(BuiltinInfo, LangOpts));
658 bool OclCUnsupported = !LangOpts.OpenCL &&
659 (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES);
660 bool OpenMPUnsupported = !LangOpts.OpenMP && BuiltinInfo.Langs == OMP_LANG;
661 bool CPlusPlusUnsupported =
662 !LangOpts.CPlusPlus && BuiltinInfo.Langs == CXX_LANG;
663 return !BuiltinsUnsupported && !MathBuiltinsUnsupported && !OclCUnsupported &&
664- !OclC1Unsupported && !OclC2Unsupported && !OpenMPUnsupported &&
665+ !OclC1Unsupported && !OclC2PUnsupported && !OpenMPUnsupported &&
666 !GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported &&
667 !CPlusPlusUnsupported;
668 }
669@@ -191,3 +194,20 @@ bool Builtin::Context::canBeRedeclared(unsigned ID) const {
670 (!hasReferenceArgsOrResult(ID) &&
671 !hasCustomTypechecking(ID));
672 }
673+
674+bool Builtin::Context::OclBuiltinIsSupported(
675+ const Builtin::Info &BuiltinInfo, const LangOptions &LangOpts) const {
676+ if (!requiresFeatures(BuiltinInfo))
677+ return true;
678+
679+ return llvm::StringSwitch<bool>(BuiltinInfo.Features)
680+ .Case("__opencl_c_device_enqueue", LangOpts.Blocks)
681+ .Case("__opencl_c_generic_address_space", LangOpts.OpenCLGenericKeyword)
682+ .Case("__opencl_c_pipes", LangOpts.OpenCLPipeKeyword)
683+ .Default(false);
684+}
685+
686+bool Builtin::Context::requiresFeatures(
687+ const Builtin::Info &BuiltinInfo) const {
688+ return BuiltinInfo.Features && llvm::StringRef(BuiltinInfo.Features) != "";
689+}
690diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
691index eccdc21d724a..6b4f524d5271 100644
692--- a/clang/lib/Basic/TargetInfo.cpp
693+++ b/clang/lib/Basic/TargetInfo.cpp
694@@ -387,6 +387,17 @@ void TargetInfo::adjust(LangOptions &Opts) {
695 HalfFormat = &llvm::APFloat::IEEEhalf();
696 FloatFormat = &llvm::APFloat::IEEEsingle();
697 LongDoubleFormat = &llvm::APFloat::IEEEquad();
698+
699+ auto &SupportedOCLOpts = getTargetOpts().SupportedOpenCLOptions;
700+
701+ SupportedOCLOpts.setOpenCLVersion(Opts);
702+ SupportedOCLOpts.adjustFeatures();
703+
704+ if (!Opts.OpenCLCPlusPlus && Opts.OpenCLVersion >= 200)
705+ Opts.Blocks = SupportedOCLOpts.isSupported("__opencl_c_device_enqueue");
706+ Opts.OpenCLGenericKeyword =
707+ SupportedOCLOpts.isSupported("__opencl_c_generic_address_space");
708+ Opts.OpenCLPipeKeyword = SupportedOCLOpts.isSupported("__opencl_c_pipes");
709 }
710
711 if (Opts.DoubleSize) {
712diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
713index 965f273892bd..046d7c15f835 100644
714--- a/clang/lib/Basic/Targets.cpp
715+++ b/clang/lib/Basic/Targets.cpp
716@@ -40,7 +40,6 @@
717 #include "clang/Basic/Diagnostic.h"
718 #include "llvm/ADT/StringExtras.h"
719 #include "llvm/ADT/Triple.h"
720-
721 using namespace clang;
722
723 namespace clang {
724diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
725index 8ce488f35dd3..ca4cb0fbf018 100644
726--- a/clang/lib/CodeGen/CodeGenFunction.cpp
727+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
728@@ -2306,11 +2306,11 @@ void CodeGenFunction::checkTargetFeatures(SourceLocation Loc,
729 std::string MissingFeature;
730 if (BuiltinID) {
731 SmallVector<StringRef, 1> ReqFeatures;
732- const char *FeatureList =
733- CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
734 // Return if the builtin doesn't have any required features.
735- if (!FeatureList || StringRef(FeatureList) == "")
736+ if (!CGM.getContext().BuiltinInfo.requiresFeatures(BuiltinID))
737 return;
738+ const char *FeatureList =
739+ CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
740 StringRef(FeatureList).split(ReqFeatures, ',');
741 if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
742 CGM.getDiags().Report(Loc, diag::err_builtin_needs_feature)
743diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
744index 73114c6d76cb..bc54d231b97a 100644
745--- a/clang/lib/Frontend/CompilerInvocation.cpp
746+++ b/clang/lib/Frontend/CompilerInvocation.cpp
747@@ -2344,6 +2344,8 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
748 Opts.OpenCLVersion = 120;
749 else if (LangStd == LangStandard::lang_opencl20)
750 Opts.OpenCLVersion = 200;
751+ else if (LangStd == LangStandard::lang_opencl30)
752+ Opts.OpenCLVersion = 300;
753 else if (LangStd == LangStandard::lang_openclcpp)
754 Opts.OpenCLCPlusPlusVersion = 100;
755
756@@ -2544,14 +2546,15 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
757 // -cl-std only applies for OpenCL language standards.
758 // Override the -std option in this case.
759 if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
760- LangStandard::Kind OpenCLLangStd
761- = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
762- .Cases("cl", "CL", LangStandard::lang_opencl10)
763- .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
764- .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
765- .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
766- .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
767- .Default(LangStandard::lang_unspecified);
768+ LangStandard::Kind OpenCLLangStd =
769+ llvm::StringSwitch<LangStandard::Kind>(A->getValue())
770+ .Cases("cl", "CL", LangStandard::lang_opencl10)
771+ .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
772+ .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
773+ .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
774+ .Cases("cl3.0", "CL3.0", LangStandard::lang_opencl30)
775+ .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
776+ .Default(LangStandard::lang_unspecified);
777
778 if (OpenCLLangStd == LangStandard::lang_unspecified) {
779 Diags.Report(diag::err_drv_invalid_value)
780@@ -2852,8 +2855,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
781
782 Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
783 Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
784- Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
785- && Opts.OpenCLVersion == 200);
786+ Opts.Blocks = Args.hasArg(OPT_fblocks);
787 Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
788 Opts.Coroutines = Opts.CPlusPlus20 || Args.hasArg(OPT_fcoroutines_ts);
789
790diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
791index 6eef1e2376f6..5bb489c11909 100644
792--- a/clang/lib/Frontend/InitPreprocessor.cpp
793+++ b/clang/lib/Frontend/InitPreprocessor.cpp
794@@ -445,6 +445,9 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
795 case 200:
796 Builder.defineMacro("__OPENCL_C_VERSION__", "200");
797 break;
798+ case 300:
799+ Builder.defineMacro("__OPENCL_C_VERSION__", "300");
800+ break;
801 default:
802 llvm_unreachable("Unsupported OpenCL version");
803 }
804@@ -453,6 +456,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
805 Builder.defineMacro("CL_VERSION_1_1", "110");
806 Builder.defineMacro("CL_VERSION_1_2", "120");
807 Builder.defineMacro("CL_VERSION_2_0", "200");
808+ Builder.defineMacro("CL_VERSION_3_0", "300");
809
810 if (TI.isLittleEndian())
811 Builder.defineMacro("__ENDIAN_LITTLE__");
812@@ -1108,7 +1112,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
813 // OpenCL definitions.
814 if (LangOpts.OpenCL) {
815 #define OPENCLEXT(Ext) \
816- if (TI.getSupportedOpenCLOpts().isSupported(#Ext, LangOpts)) \
817+ if (TI.getSupportedOpenCLOpts().isSupported(#Ext)) \
818 Builder.defineMacro(#Ext);
819 #include "clang/Basic/OpenCLExtensions.def"
820
821diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
822index 430e07d36f62..afa900ab24d9 100644
823--- a/clang/lib/Headers/opencl-c-base.h
824+++ b/clang/lib/Headers/opencl-c-base.h
825@@ -9,6 +9,59 @@
826 #ifndef _OPENCL_BASE_H_
827 #define _OPENCL_BASE_H_
828
829+// Add predefined macros to build headers with standalone executable
830+#ifndef CL_VERSION_3_0
831+ #define CL_VERSION_3_0 300
832+#endif
833+
834+// Define features for 2.0 for header backward compatibility
835+#ifndef __opencl_c_int64
836+ #define __opencl_c_int64 1
837+#endif
838+#if __OPENCL_C_VERSION__ != CL_VERSION_3_0
839+ #ifndef __opencl_c_images
840+ #define __opencl_c_images 1
841+ #endif
842+#endif
843+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
844+#ifndef __opencl_c_pipes
845+ #define __opencl_c_pipes 1
846+#endif
847+#ifndef __opencl_c_generic_address_space
848+ #define __opencl_c_generic_address_space 1
849+#endif
850+#ifndef __opencl_c_work_group_collective_functions
851+ #define __opencl_c_work_group_collective_functions 1
852+#endif
853+#ifndef __opencl_c_atomic_order_acq_rel
854+ #define __opencl_c_atomic_order_acq_rel 1
855+#endif
856+#ifndef __opencl_c_atomic_order_seq_cst
857+ #define __opencl_c_atomic_order_seq_cst 1
858+#endif
859+#ifndef __opencl_c_atomic_scope_device
860+ #define __opencl_c_atomic_scope_device 1
861+#endif
862+#ifndef __opencl_c_atomic_scope_all_devices
863+ #define __opencl_c_atomic_scope_all_devices 1
864+#endif
865+#ifndef __opencl_c_subgroups
866+ #define __opencl_c_subgroups 1
867+#endif
868+#ifndef __opencl_c_3d_image_writes
869+ #define __opencl_c_3d_image_writes 1
870+#endif
871+#ifndef __opencl_c_device_enqueue
872+ #define __opencl_c_device_enqueue 1
873+#endif
874+#ifndef __opencl_c_read_write_images
875+ #define __opencl_c_read_write_images 1
876+#endif
877+#ifndef __opencl_c_program_scope_global_variables
878+ #define __opencl_c_program_scope_global_variables 1
879+#endif
880+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
881+
882 // built-in scalar data types:
883
884 /**
885@@ -115,7 +168,12 @@ typedef half half4 __attribute__((ext_vector_type(4)));
886 typedef half half8 __attribute__((ext_vector_type(8)));
887 typedef half half16 __attribute__((ext_vector_type(16)));
888 #endif
889-#ifdef cl_khr_fp64
890+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
891+
892+#ifndef __opencl_c_fp64
893+ #define __opencl_c_fp64 1
894+#endif
895+
896 #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
897 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
898 #endif
899@@ -281,9 +339,17 @@ typedef uint cl_mem_fence_flags;
900 typedef enum memory_scope {
901 memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM,
902 memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP,
903+#ifdef __opencl_c_atomic_scope_device
904 memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE,
905+#endif
906+#ifdef __opencl_c_atomic_scope_all_devices
907+ #if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
908+ memory_scope_all_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
909+ #endif //(__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
910 memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
911-#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
912+#endif // __opencl_c_atomic_scope_all_devices
913+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
914+ defined(__opencl_c_subgroups)
915 memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
916 #endif
917 } memory_scope;
918@@ -301,13 +367,14 @@ typedef enum memory_scope {
919 #define ATOMIC_FLAG_INIT 0
920
921 // enum values aligned with what clang uses in EmitAtomicExpr()
922-typedef enum memory_order
923-{
924+typedef enum memory_order {
925 memory_order_relaxed = __ATOMIC_RELAXED,
926 memory_order_acquire = __ATOMIC_ACQUIRE,
927 memory_order_release = __ATOMIC_RELEASE,
928 memory_order_acq_rel = __ATOMIC_ACQ_REL,
929+#ifdef __opencl_c_atomic_order_seq_cst
930 memory_order_seq_cst = __ATOMIC_SEQ_CST
931+#endif //__opencl_c_atomic_order_seq_cst
932 } memory_order;
933
934 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
935diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
936index 66e18bdd47bb..67d900eb1c3d 100644
937--- a/clang/lib/Headers/opencl-c.h
938+++ b/clang/lib/Headers/opencl-c.h
939@@ -35,7 +35,6 @@
940 #define __purefn __attribute__((pure))
941 #define __cnfn __attribute__((const))
942
943-
944 // OpenCL v1.1/1.2/2.0 s6.2.3 - Explicit conversions
945
946 char __ovld __cnfn convert_char_rte(char);
947@@ -4632,7 +4631,7 @@ float16 __ovld __cnfn convert_float16(float16);
948
949 // Conversions with double data type parameters or return value.
950
951-#ifdef cl_khr_fp64
952+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
953 char __ovld __cnfn convert_char(double);
954 char __ovld __cnfn convert_char_rte(double);
955 char __ovld __cnfn convert_char_rtn(double);
956@@ -5452,7 +5451,7 @@ double16 __ovld __cnfn convert_double16_rtz(uchar16);
957 double16 __ovld __cnfn convert_double16_rtz(uint16);
958 double16 __ovld __cnfn convert_double16_rtz(ulong16);
959 double16 __ovld __cnfn convert_double16_rtz(ushort16);
960-#endif //cl_khr_fp64
961+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
962
963 #ifdef cl_khr_fp16
964 // Convert half types to non-double types.
965@@ -6270,7 +6269,7 @@ half16 __ovld __cnfn convert_half16_rtz(float16);
966 half16 __ovld __cnfn convert_half16_rtz(half16);
967
968 // Convert half types to double types.
969-#ifdef cl_khr_fp64
970+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
971 double __ovld __cnfn convert_double(half);
972 double __ovld __cnfn convert_double_rte(half);
973 double __ovld __cnfn convert_double_rtp(half);
974@@ -6333,7 +6332,7 @@ half16 __ovld __cnfn convert_half16_rte(double16);
975 half16 __ovld __cnfn convert_half16_rtp(double16);
976 half16 __ovld __cnfn convert_half16_rtn(double16);
977 half16 __ovld __cnfn convert_half16_rtz(double16);
978-#endif //cl_khr_fp64
979+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
980
981 #endif // cl_khr_fp16
982
983@@ -6404,14 +6403,14 @@ half16 __ovld __cnfn convert_half16_rtz(double16);
984 #define as_float8(x) __builtin_astype((x), float8)
985 #define as_float16(x) __builtin_astype((x), float16)
986
987-#ifdef cl_khr_fp64
988+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
989 #define as_double(x) __builtin_astype((x), double)
990 #define as_double2(x) __builtin_astype((x), double2)
991 #define as_double3(x) __builtin_astype((x), double3)
992 #define as_double4(x) __builtin_astype((x), double4)
993 #define as_double8(x) __builtin_astype((x), double8)
994 #define as_double16(x) __builtin_astype((x), double16)
995-#endif //cl_khr_fp64
996+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
997
998 #ifdef cl_khr_fp16
999 #define as_half(x) __builtin_astype((x), half)
1000@@ -6534,14 +6533,14 @@ float3 __ovld __cnfn acos(float3);
1001 float4 __ovld __cnfn acos(float4);
1002 float8 __ovld __cnfn acos(float8);
1003 float16 __ovld __cnfn acos(float16);
1004-#ifdef cl_khr_fp64
1005+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1006 double __ovld __cnfn acos(double);
1007 double2 __ovld __cnfn acos(double2);
1008 double3 __ovld __cnfn acos(double3);
1009 double4 __ovld __cnfn acos(double4);
1010 double8 __ovld __cnfn acos(double8);
1011 double16 __ovld __cnfn acos(double16);
1012-#endif //cl_khr_fp64
1013+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1014 #ifdef cl_khr_fp16
1015 half __ovld __cnfn acos(half);
1016 half2 __ovld __cnfn acos(half2);
1017@@ -6560,14 +6559,14 @@ float3 __ovld __cnfn acosh(float3);
1018 float4 __ovld __cnfn acosh(float4);
1019 float8 __ovld __cnfn acosh(float8);
1020 float16 __ovld __cnfn acosh(float16);
1021-#ifdef cl_khr_fp64
1022+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1023 double __ovld __cnfn acosh(double);
1024 double2 __ovld __cnfn acosh(double2);
1025 double3 __ovld __cnfn acosh(double3);
1026 double4 __ovld __cnfn acosh(double4);
1027 double8 __ovld __cnfn acosh(double8);
1028 double16 __ovld __cnfn acosh(double16);
1029-#endif //cl_khr_fp64
1030+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1031 #ifdef cl_khr_fp16
1032 half __ovld __cnfn acosh(half);
1033 half2 __ovld __cnfn acosh(half2);
1034@@ -6586,14 +6585,14 @@ float3 __ovld __cnfn acospi(float3 x);
1035 float4 __ovld __cnfn acospi(float4 x);
1036 float8 __ovld __cnfn acospi(float8 x);
1037 float16 __ovld __cnfn acospi(float16 x);
1038-#ifdef cl_khr_fp64
1039+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1040 double __ovld __cnfn acospi(double x);
1041 double2 __ovld __cnfn acospi(double2 x);
1042 double3 __ovld __cnfn acospi(double3 x);
1043 double4 __ovld __cnfn acospi(double4 x);
1044 double8 __ovld __cnfn acospi(double8 x);
1045 double16 __ovld __cnfn acospi(double16 x);
1046-#endif //cl_khr_fp64
1047+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1048 #ifdef cl_khr_fp16
1049 half __ovld __cnfn acospi(half x);
1050 half2 __ovld __cnfn acospi(half2 x);
1051@@ -6612,14 +6611,14 @@ float3 __ovld __cnfn asin(float3);
1052 float4 __ovld __cnfn asin(float4);
1053 float8 __ovld __cnfn asin(float8);
1054 float16 __ovld __cnfn asin(float16);
1055-#ifdef cl_khr_fp64
1056+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1057 double __ovld __cnfn asin(double);
1058 double2 __ovld __cnfn asin(double2);
1059 double3 __ovld __cnfn asin(double3);
1060 double4 __ovld __cnfn asin(double4);
1061 double8 __ovld __cnfn asin(double8);
1062 double16 __ovld __cnfn asin(double16);
1063-#endif //cl_khr_fp64
1064+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1065 #ifdef cl_khr_fp16
1066 half __ovld __cnfn asin(half);
1067 half2 __ovld __cnfn asin(half2);
1068@@ -6638,14 +6637,14 @@ float3 __ovld __cnfn asinh(float3);
1069 float4 __ovld __cnfn asinh(float4);
1070 float8 __ovld __cnfn asinh(float8);
1071 float16 __ovld __cnfn asinh(float16);
1072-#ifdef cl_khr_fp64
1073+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1074 double __ovld __cnfn asinh(double);
1075 double2 __ovld __cnfn asinh(double2);
1076 double3 __ovld __cnfn asinh(double3);
1077 double4 __ovld __cnfn asinh(double4);
1078 double8 __ovld __cnfn asinh(double8);
1079 double16 __ovld __cnfn asinh(double16);
1080-#endif //cl_khr_fp64
1081+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1082 #ifdef cl_khr_fp16
1083 half __ovld __cnfn asinh(half);
1084 half2 __ovld __cnfn asinh(half2);
1085@@ -6664,14 +6663,14 @@ float3 __ovld __cnfn asinpi(float3 x);
1086 float4 __ovld __cnfn asinpi(float4 x);
1087 float8 __ovld __cnfn asinpi(float8 x);
1088 float16 __ovld __cnfn asinpi(float16 x);
1089-#ifdef cl_khr_fp64
1090+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1091 double __ovld __cnfn asinpi(double x);
1092 double2 __ovld __cnfn asinpi(double2 x);
1093 double3 __ovld __cnfn asinpi(double3 x);
1094 double4 __ovld __cnfn asinpi(double4 x);
1095 double8 __ovld __cnfn asinpi(double8 x);
1096 double16 __ovld __cnfn asinpi(double16 x);
1097-#endif //cl_khr_fp64
1098+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1099 #ifdef cl_khr_fp16
1100 half __ovld __cnfn asinpi(half x);
1101 half2 __ovld __cnfn asinpi(half2 x);
1102@@ -6690,14 +6689,14 @@ float3 __ovld __cnfn atan(float3 y_over_x);
1103 float4 __ovld __cnfn atan(float4 y_over_x);
1104 float8 __ovld __cnfn atan(float8 y_over_x);
1105 float16 __ovld __cnfn atan(float16 y_over_x);
1106-#ifdef cl_khr_fp64
1107+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1108 double __ovld __cnfn atan(double y_over_x);
1109 double2 __ovld __cnfn atan(double2 y_over_x);
1110 double3 __ovld __cnfn atan(double3 y_over_x);
1111 double4 __ovld __cnfn atan(double4 y_over_x);
1112 double8 __ovld __cnfn atan(double8 y_over_x);
1113 double16 __ovld __cnfn atan(double16 y_over_x);
1114-#endif //cl_khr_fp64
1115+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1116 #ifdef cl_khr_fp16
1117 half __ovld __cnfn atan(half y_over_x);
1118 half2 __ovld __cnfn atan(half2 y_over_x);
1119@@ -6716,14 +6715,14 @@ float3 __ovld __cnfn atan2(float3 y, float3 x);
1120 float4 __ovld __cnfn atan2(float4 y, float4 x);
1121 float8 __ovld __cnfn atan2(float8 y, float8 x);
1122 float16 __ovld __cnfn atan2(float16 y, float16 x);
1123-#ifdef cl_khr_fp64
1124+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1125 double __ovld __cnfn atan2(double y, double x);
1126 double2 __ovld __cnfn atan2(double2 y, double2 x);
1127 double3 __ovld __cnfn atan2(double3 y, double3 x);
1128 double4 __ovld __cnfn atan2(double4 y, double4 x);
1129 double8 __ovld __cnfn atan2(double8 y, double8 x);
1130 double16 __ovld __cnfn atan2(double16 y, double16 x);
1131-#endif //cl_khr_fp64
1132+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1133 #ifdef cl_khr_fp16
1134 half __ovld __cnfn atan2(half y, half x);
1135 half2 __ovld __cnfn atan2(half2 y, half2 x);
1136@@ -6742,14 +6741,14 @@ float3 __ovld __cnfn atanh(float3);
1137 float4 __ovld __cnfn atanh(float4);
1138 float8 __ovld __cnfn atanh(float8);
1139 float16 __ovld __cnfn atanh(float16);
1140-#ifdef cl_khr_fp64
1141+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1142 double __ovld __cnfn atanh(double);
1143 double2 __ovld __cnfn atanh(double2);
1144 double3 __ovld __cnfn atanh(double3);
1145 double4 __ovld __cnfn atanh(double4);
1146 double8 __ovld __cnfn atanh(double8);
1147 double16 __ovld __cnfn atanh(double16);
1148-#endif //cl_khr_fp64
1149+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1150 #ifdef cl_khr_fp16
1151 half __ovld __cnfn atanh(half);
1152 half2 __ovld __cnfn atanh(half2);
1153@@ -6768,14 +6767,14 @@ float3 __ovld __cnfn atanpi(float3 x);
1154 float4 __ovld __cnfn atanpi(float4 x);
1155 float8 __ovld __cnfn atanpi(float8 x);
1156 float16 __ovld __cnfn atanpi(float16 x);
1157-#ifdef cl_khr_fp64
1158+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1159 double __ovld __cnfn atanpi(double x);
1160 double2 __ovld __cnfn atanpi(double2 x);
1161 double3 __ovld __cnfn atanpi(double3 x);
1162 double4 __ovld __cnfn atanpi(double4 x);
1163 double8 __ovld __cnfn atanpi(double8 x);
1164 double16 __ovld __cnfn atanpi(double16 x);
1165-#endif //cl_khr_fp64
1166+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1167 #ifdef cl_khr_fp16
1168 half __ovld __cnfn atanpi(half x);
1169 half2 __ovld __cnfn atanpi(half2 x);
1170@@ -6794,14 +6793,14 @@ float3 __ovld __cnfn atan2pi(float3 y, float3 x);
1171 float4 __ovld __cnfn atan2pi(float4 y, float4 x);
1172 float8 __ovld __cnfn atan2pi(float8 y, float8 x);
1173 float16 __ovld __cnfn atan2pi(float16 y, float16 x);
1174-#ifdef cl_khr_fp64
1175+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1176 double __ovld __cnfn atan2pi(double y, double x);
1177 double2 __ovld __cnfn atan2pi(double2 y, double2 x);
1178 double3 __ovld __cnfn atan2pi(double3 y, double3 x);
1179 double4 __ovld __cnfn atan2pi(double4 y, double4 x);
1180 double8 __ovld __cnfn atan2pi(double8 y, double8 x);
1181 double16 __ovld __cnfn atan2pi(double16 y, double16 x);
1182-#endif //cl_khr_fp64
1183+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1184 #ifdef cl_khr_fp16
1185 half __ovld __cnfn atan2pi(half y, half x);
1186 half2 __ovld __cnfn atan2pi(half2 y, half2 x);
1187@@ -6820,14 +6819,14 @@ float3 __ovld __cnfn cbrt(float3);
1188 float4 __ovld __cnfn cbrt(float4);
1189 float8 __ovld __cnfn cbrt(float8);
1190 float16 __ovld __cnfn cbrt(float16);
1191-#ifdef cl_khr_fp64
1192+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1193 double __ovld __cnfn cbrt(double);
1194 double2 __ovld __cnfn cbrt(double2);
1195 double3 __ovld __cnfn cbrt(double3);
1196 double4 __ovld __cnfn cbrt(double4);
1197 double8 __ovld __cnfn cbrt(double8);
1198 double16 __ovld __cnfn cbrt(double16);
1199-#endif //cl_khr_fp64
1200+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1201 #ifdef cl_khr_fp16
1202 half __ovld __cnfn cbrt(half);
1203 half2 __ovld __cnfn cbrt(half2);
1204@@ -6847,14 +6846,14 @@ float3 __ovld __cnfn ceil(float3);
1205 float4 __ovld __cnfn ceil(float4);
1206 float8 __ovld __cnfn ceil(float8);
1207 float16 __ovld __cnfn ceil(float16);
1208-#ifdef cl_khr_fp64
1209+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1210 double __ovld __cnfn ceil(double);
1211 double2 __ovld __cnfn ceil(double2);
1212 double3 __ovld __cnfn ceil(double3);
1213 double4 __ovld __cnfn ceil(double4);
1214 double8 __ovld __cnfn ceil(double8);
1215 double16 __ovld __cnfn ceil(double16);
1216-#endif //cl_khr_fp64
1217+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1218 #ifdef cl_khr_fp16
1219 half __ovld __cnfn ceil(half);
1220 half2 __ovld __cnfn ceil(half2);
1221@@ -6873,14 +6872,14 @@ float3 __ovld __cnfn copysign(float3 x, float3 y);
1222 float4 __ovld __cnfn copysign(float4 x, float4 y);
1223 float8 __ovld __cnfn copysign(float8 x, float8 y);
1224 float16 __ovld __cnfn copysign(float16 x, float16 y);
1225-#ifdef cl_khr_fp64
1226+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1227 double __ovld __cnfn copysign(double x, double y);
1228 double2 __ovld __cnfn copysign(double2 x, double2 y);
1229 double3 __ovld __cnfn copysign(double3 x, double3 y);
1230 double4 __ovld __cnfn copysign(double4 x, double4 y);
1231 double8 __ovld __cnfn copysign(double8 x, double8 y);
1232 double16 __ovld __cnfn copysign(double16 x, double16 y);
1233-#endif //cl_khr_fp64
1234+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1235 #ifdef cl_khr_fp16
1236 half __ovld __cnfn copysign(half x, half y);
1237 half2 __ovld __cnfn copysign(half2 x, half2 y);
1238@@ -6899,14 +6898,14 @@ float3 __ovld __cnfn cos(float3);
1239 float4 __ovld __cnfn cos(float4);
1240 float8 __ovld __cnfn cos(float8);
1241 float16 __ovld __cnfn cos(float16);
1242-#ifdef cl_khr_fp64
1243+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1244 double __ovld __cnfn cos(double);
1245 double2 __ovld __cnfn cos(double2);
1246 double3 __ovld __cnfn cos(double3);
1247 double4 __ovld __cnfn cos(double4);
1248 double8 __ovld __cnfn cos(double8);
1249 double16 __ovld __cnfn cos(double16);
1250-#endif //cl_khr_fp64
1251+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1252 #ifdef cl_khr_fp16
1253 half __ovld __cnfn cos(half);
1254 half2 __ovld __cnfn cos(half2);
1255@@ -6925,14 +6924,14 @@ float3 __ovld __cnfn cosh(float3);
1256 float4 __ovld __cnfn cosh(float4);
1257 float8 __ovld __cnfn cosh(float8);
1258 float16 __ovld __cnfn cosh(float16);
1259-#ifdef cl_khr_fp64
1260+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1261 double __ovld __cnfn cosh(double);
1262 double2 __ovld __cnfn cosh(double2);
1263 double3 __ovld __cnfn cosh(double3);
1264 double4 __ovld __cnfn cosh(double4);
1265 double8 __ovld __cnfn cosh(double8);
1266 double16 __ovld __cnfn cosh(double16);
1267-#endif //cl_khr_fp64
1268+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1269 #ifdef cl_khr_fp16
1270 half __ovld __cnfn cosh(half);
1271 half2 __ovld __cnfn cosh(half2);
1272@@ -6951,14 +6950,14 @@ float3 __ovld __cnfn cospi(float3 x);
1273 float4 __ovld __cnfn cospi(float4 x);
1274 float8 __ovld __cnfn cospi(float8 x);
1275 float16 __ovld __cnfn cospi(float16 x);
1276-#ifdef cl_khr_fp64
1277+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1278 double __ovld __cnfn cospi(double x);
1279 double2 __ovld __cnfn cospi(double2 x);
1280 double3 __ovld __cnfn cospi(double3 x);
1281 double4 __ovld __cnfn cospi(double4 x);
1282 double8 __ovld __cnfn cospi(double8 x);
1283 double16 __ovld __cnfn cospi(double16 x);
1284-#endif //cl_khr_fp64
1285+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1286 #ifdef cl_khr_fp16
1287 half __ovld __cnfn cospi(half x);
1288 half2 __ovld __cnfn cospi(half2 x);
1289@@ -6977,14 +6976,14 @@ float3 __ovld __cnfn erfc(float3);
1290 float4 __ovld __cnfn erfc(float4);
1291 float8 __ovld __cnfn erfc(float8);
1292 float16 __ovld __cnfn erfc(float16);
1293-#ifdef cl_khr_fp64
1294+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1295 double __ovld __cnfn erfc(double);
1296 double2 __ovld __cnfn erfc(double2);
1297 double3 __ovld __cnfn erfc(double3);
1298 double4 __ovld __cnfn erfc(double4);
1299 double8 __ovld __cnfn erfc(double8);
1300 double16 __ovld __cnfn erfc(double16);
1301-#endif //cl_khr_fp64
1302+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1303 #ifdef cl_khr_fp16
1304 half __ovld __cnfn erfc(half);
1305 half2 __ovld __cnfn erfc(half2);
1306@@ -7004,14 +7003,14 @@ float3 __ovld __cnfn erf(float3);
1307 float4 __ovld __cnfn erf(float4);
1308 float8 __ovld __cnfn erf(float8);
1309 float16 __ovld __cnfn erf(float16);
1310-#ifdef cl_khr_fp64
1311+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1312 double __ovld __cnfn erf(double);
1313 double2 __ovld __cnfn erf(double2);
1314 double3 __ovld __cnfn erf(double3);
1315 double4 __ovld __cnfn erf(double4);
1316 double8 __ovld __cnfn erf(double8);
1317 double16 __ovld __cnfn erf(double16);
1318-#endif //cl_khr_fp64
1319+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1320 #ifdef cl_khr_fp16
1321 half __ovld __cnfn erf(half);
1322 half2 __ovld __cnfn erf(half2);
1323@@ -7030,14 +7029,14 @@ float3 __ovld __cnfn exp(float3 x);
1324 float4 __ovld __cnfn exp(float4 x);
1325 float8 __ovld __cnfn exp(float8 x);
1326 float16 __ovld __cnfn exp(float16 x);
1327-#ifdef cl_khr_fp64
1328+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1329 double __ovld __cnfn exp(double x);
1330 double2 __ovld __cnfn exp(double2 x);
1331 double3 __ovld __cnfn exp(double3 x);
1332 double4 __ovld __cnfn exp(double4 x);
1333 double8 __ovld __cnfn exp(double8 x);
1334 double16 __ovld __cnfn exp(double16 x);
1335-#endif //cl_khr_fp64
1336+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1337 #ifdef cl_khr_fp16
1338 half __ovld __cnfn exp(half x);
1339 half2 __ovld __cnfn exp(half2 x);
1340@@ -7056,14 +7055,14 @@ float3 __ovld __cnfn exp2(float3);
1341 float4 __ovld __cnfn exp2(float4);
1342 float8 __ovld __cnfn exp2(float8);
1343 float16 __ovld __cnfn exp2(float16);
1344-#ifdef cl_khr_fp64
1345+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1346 double __ovld __cnfn exp2(double);
1347 double2 __ovld __cnfn exp2(double2);
1348 double3 __ovld __cnfn exp2(double3);
1349 double4 __ovld __cnfn exp2(double4);
1350 double8 __ovld __cnfn exp2(double8);
1351 double16 __ovld __cnfn exp2(double16);
1352-#endif //cl_khr_fp64
1353+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1354 #ifdef cl_khr_fp16
1355 half __ovld __cnfn exp2(half);
1356 half2 __ovld __cnfn exp2(half2);
1357@@ -7082,14 +7081,14 @@ float3 __ovld __cnfn exp10(float3);
1358 float4 __ovld __cnfn exp10(float4);
1359 float8 __ovld __cnfn exp10(float8);
1360 float16 __ovld __cnfn exp10(float16);
1361-#ifdef cl_khr_fp64
1362+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1363 double __ovld __cnfn exp10(double);
1364 double2 __ovld __cnfn exp10(double2);
1365 double3 __ovld __cnfn exp10(double3);
1366 double4 __ovld __cnfn exp10(double4);
1367 double8 __ovld __cnfn exp10(double8);
1368 double16 __ovld __cnfn exp10(double16);
1369-#endif //cl_khr_fp64
1370+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1371 #ifdef cl_khr_fp16
1372 half __ovld __cnfn exp10(half);
1373 half2 __ovld __cnfn exp10(half2);
1374@@ -7108,14 +7107,14 @@ float3 __ovld __cnfn expm1(float3 x);
1375 float4 __ovld __cnfn expm1(float4 x);
1376 float8 __ovld __cnfn expm1(float8 x);
1377 float16 __ovld __cnfn expm1(float16 x);
1378-#ifdef cl_khr_fp64
1379+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1380 double __ovld __cnfn expm1(double x);
1381 double2 __ovld __cnfn expm1(double2 x);
1382 double3 __ovld __cnfn expm1(double3 x);
1383 double4 __ovld __cnfn expm1(double4 x);
1384 double8 __ovld __cnfn expm1(double8 x);
1385 double16 __ovld __cnfn expm1(double16 x);
1386-#endif //cl_khr_fp64
1387+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1388 #ifdef cl_khr_fp16
1389 half __ovld __cnfn expm1(half x);
1390 half2 __ovld __cnfn expm1(half2 x);
1391@@ -7134,14 +7133,14 @@ float3 __ovld __cnfn fabs(float3);
1392 float4 __ovld __cnfn fabs(float4);
1393 float8 __ovld __cnfn fabs(float8);
1394 float16 __ovld __cnfn fabs(float16);
1395-#ifdef cl_khr_fp64
1396+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1397 double __ovld __cnfn fabs(double);
1398 double2 __ovld __cnfn fabs(double2);
1399 double3 __ovld __cnfn fabs(double3);
1400 double4 __ovld __cnfn fabs(double4);
1401 double8 __ovld __cnfn fabs(double8);
1402 double16 __ovld __cnfn fabs(double16);
1403-#endif //cl_khr_fp64
1404+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1405 #ifdef cl_khr_fp16
1406 half __ovld __cnfn fabs(half);
1407 half2 __ovld __cnfn fabs(half2);
1408@@ -7160,14 +7159,14 @@ float3 __ovld __cnfn fdim(float3 x, float3 y);
1409 float4 __ovld __cnfn fdim(float4 x, float4 y);
1410 float8 __ovld __cnfn fdim(float8 x, float8 y);
1411 float16 __ovld __cnfn fdim(float16 x, float16 y);
1412-#ifdef cl_khr_fp64
1413+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1414 double __ovld __cnfn fdim(double x, double y);
1415 double2 __ovld __cnfn fdim(double2 x, double2 y);
1416 double3 __ovld __cnfn fdim(double3 x, double3 y);
1417 double4 __ovld __cnfn fdim(double4 x, double4 y);
1418 double8 __ovld __cnfn fdim(double8 x, double8 y);
1419 double16 __ovld __cnfn fdim(double16 x, double16 y);
1420-#endif //cl_khr_fp64
1421+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1422 #ifdef cl_khr_fp16
1423 half __ovld __cnfn fdim(half x, half y);
1424 half2 __ovld __cnfn fdim(half2 x, half2 y);
1425@@ -7187,14 +7186,14 @@ float3 __ovld __cnfn floor(float3);
1426 float4 __ovld __cnfn floor(float4);
1427 float8 __ovld __cnfn floor(float8);
1428 float16 __ovld __cnfn floor(float16);
1429-#ifdef cl_khr_fp64
1430+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1431 double __ovld __cnfn floor(double);
1432 double2 __ovld __cnfn floor(double2);
1433 double3 __ovld __cnfn floor(double3);
1434 double4 __ovld __cnfn floor(double4);
1435 double8 __ovld __cnfn floor(double8);
1436 double16 __ovld __cnfn floor(double16);
1437-#endif //cl_khr_fp64
1438+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1439 #ifdef cl_khr_fp16
1440 half __ovld __cnfn floor(half);
1441 half2 __ovld __cnfn floor(half2);
1442@@ -7217,14 +7216,14 @@ float3 __ovld __cnfn fma(float3 a, float3 b, float3 c);
1443 float4 __ovld __cnfn fma(float4 a, float4 b, float4 c);
1444 float8 __ovld __cnfn fma(float8 a, float8 b, float8 c);
1445 float16 __ovld __cnfn fma(float16 a, float16 b, float16 c);
1446-#ifdef cl_khr_fp64
1447+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1448 double __ovld __cnfn fma(double a, double b, double c);
1449 double2 __ovld __cnfn fma(double2 a, double2 b, double2 c);
1450 double3 __ovld __cnfn fma(double3 a, double3 b, double3 c);
1451 double4 __ovld __cnfn fma(double4 a, double4 b, double4 c);
1452 double8 __ovld __cnfn fma(double8 a, double8 b, double8 c);
1453 double16 __ovld __cnfn fma(double16 a, double16 b, double16 c);
1454-#endif //cl_khr_fp64
1455+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1456 #ifdef cl_khr_fp16
1457 half __ovld __cnfn fma(half a, half b, half c);
1458 half2 __ovld __cnfn fma(half2 a, half2 b, half2 c);
1459@@ -7251,7 +7250,7 @@ float3 __ovld __cnfn fmax(float3 x, float y);
1460 float4 __ovld __cnfn fmax(float4 x, float y);
1461 float8 __ovld __cnfn fmax(float8 x, float y);
1462 float16 __ovld __cnfn fmax(float16 x, float y);
1463-#ifdef cl_khr_fp64
1464+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1465 double __ovld __cnfn fmax(double x, double y);
1466 double2 __ovld __cnfn fmax(double2 x, double2 y);
1467 double3 __ovld __cnfn fmax(double3 x, double3 y);
1468@@ -7263,7 +7262,7 @@ double3 __ovld __cnfn fmax(double3 x, double y);
1469 double4 __ovld __cnfn fmax(double4 x, double y);
1470 double8 __ovld __cnfn fmax(double8 x, double y);
1471 double16 __ovld __cnfn fmax(double16 x, double y);
1472-#endif //cl_khr_fp64
1473+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1474 #ifdef cl_khr_fp16
1475 half __ovld __cnfn fmax(half x, half y);
1476 half2 __ovld __cnfn fmax(half2 x, half2 y);
1477@@ -7295,7 +7294,7 @@ float3 __ovld __cnfn fmin(float3 x, float y);
1478 float4 __ovld __cnfn fmin(float4 x, float y);
1479 float8 __ovld __cnfn fmin(float8 x, float y);
1480 float16 __ovld __cnfn fmin(float16 x, float y);
1481-#ifdef cl_khr_fp64
1482+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1483 double __ovld __cnfn fmin(double x, double y);
1484 double2 __ovld __cnfn fmin(double2 x, double2 y);
1485 double3 __ovld __cnfn fmin(double3 x, double3 y);
1486@@ -7307,7 +7306,7 @@ double3 __ovld __cnfn fmin(double3 x, double y);
1487 double4 __ovld __cnfn fmin(double4 x, double y);
1488 double8 __ovld __cnfn fmin(double8 x, double y);
1489 double16 __ovld __cnfn fmin(double16 x, double y);
1490-#endif //cl_khr_fp64
1491+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1492 #ifdef cl_khr_fp16
1493 half __ovld __cnfn fmin(half x, half y);
1494 half2 __ovld __cnfn fmin(half2 x, half2 y);
1495@@ -7331,14 +7330,14 @@ float3 __ovld __cnfn fmod(float3 x, float3 y);
1496 float4 __ovld __cnfn fmod(float4 x, float4 y);
1497 float8 __ovld __cnfn fmod(float8 x, float8 y);
1498 float16 __ovld __cnfn fmod(float16 x, float16 y);
1499-#ifdef cl_khr_fp64
1500+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1501 double __ovld __cnfn fmod(double x, double y);
1502 double2 __ovld __cnfn fmod(double2 x, double2 y);
1503 double3 __ovld __cnfn fmod(double3 x, double3 y);
1504 double4 __ovld __cnfn fmod(double4 x, double4 y);
1505 double8 __ovld __cnfn fmod(double8 x, double8 y);
1506 double16 __ovld __cnfn fmod(double16 x, double16 y);
1507-#endif //cl_khr_fp64
1508+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1509 #ifdef cl_khr_fp16
1510 half __ovld __cnfn fmod(half x, half y);
1511 half2 __ovld __cnfn fmod(half2 x, half2 y);
1512@@ -7352,21 +7351,21 @@ half16 __ovld __cnfn fmod(half16 x, half16 y);
1513 * Returns fmin(x - floor (x), 0x1.fffffep-1f ).
1514 * floor(x) is returned in iptr.
1515 */
1516-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1517+#ifdef __opencl_c_generic_address_space
1518 float __ovld fract(float x, float *iptr);
1519 float2 __ovld fract(float2 x, float2 *iptr);
1520 float3 __ovld fract(float3 x, float3 *iptr);
1521 float4 __ovld fract(float4 x, float4 *iptr);
1522 float8 __ovld fract(float8 x, float8 *iptr);
1523 float16 __ovld fract(float16 x, float16 *iptr);
1524-#ifdef cl_khr_fp64
1525+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1526 double __ovld fract(double x, double *iptr);
1527 double2 __ovld fract(double2 x, double2 *iptr);
1528 double3 __ovld fract(double3 x, double3 *iptr);
1529 double4 __ovld fract(double4 x, double4 *iptr);
1530 double8 __ovld fract(double8 x, double8 *iptr);
1531 double16 __ovld fract(double16 x, double16 *iptr);
1532-#endif //cl_khr_fp64
1533+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1534 #ifdef cl_khr_fp16
1535 half __ovld fract(half x, half *iptr);
1536 half2 __ovld fract(half2 x, half2 *iptr);
1537@@ -7375,7 +7374,9 @@ half4 __ovld fract(half4 x, half4 *iptr);
1538 half8 __ovld fract(half8 x, half8 *iptr);
1539 half16 __ovld fract(half16 x, half16 *iptr);
1540 #endif //cl_khr_fp16
1541-#else
1542+#endif //__opencl_c_generic_address_space
1543+
1544+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1545 float __ovld fract(float x, __global float *iptr);
1546 float2 __ovld fract(float2 x, __global float2 *iptr);
1547 float3 __ovld fract(float3 x, __global float3 *iptr);
1548@@ -7394,7 +7395,7 @@ float3 __ovld fract(float3 x, __private float3 *iptr);
1549 float4 __ovld fract(float4 x, __private float4 *iptr);
1550 float8 __ovld fract(float8 x, __private float8 *iptr);
1551 float16 __ovld fract(float16 x, __private float16 *iptr);
1552-#ifdef cl_khr_fp64
1553+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1554 double __ovld fract(double x, __global double *iptr);
1555 double2 __ovld fract(double2 x, __global double2 *iptr);
1556 double3 __ovld fract(double3 x, __global double3 *iptr);
1557@@ -7413,7 +7414,7 @@ double3 __ovld fract(double3 x, __private double3 *iptr);
1558 double4 __ovld fract(double4 x, __private double4 *iptr);
1559 double8 __ovld fract(double8 x, __private double8 *iptr);
1560 double16 __ovld fract(double16 x, __private double16 *iptr);
1561-#endif //cl_khr_fp64
1562+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1563 #ifdef cl_khr_fp16
1564 half __ovld fract(half x, __global half *iptr);
1565 half2 __ovld fract(half2 x, __global half2 *iptr);
1566@@ -7434,29 +7435,29 @@ half4 __ovld fract(half4 x, __private half4 *iptr);
1567 half8 __ovld fract(half8 x, __private half8 *iptr);
1568 half16 __ovld fract(half16 x, __private half16 *iptr);
1569 #endif //cl_khr_fp16
1570-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1571-
1572+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1573+ //! CL_VERSION_2_0)
1574 /**
1575 * Extract mantissa and exponent from x. For each
1576 * component the mantissa returned is a float with
1577 * magnitude in the interval [1/2, 1) or 0. Each
1578 * component of x equals mantissa returned * 2^exp.
1579 */
1580-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1581+#ifdef __opencl_c_generic_address_space
1582 float __ovld frexp(float x, int *exp);
1583 float2 __ovld frexp(float2 x, int2 *exp);
1584 float3 __ovld frexp(float3 x, int3 *exp);
1585 float4 __ovld frexp(float4 x, int4 *exp);
1586 float8 __ovld frexp(float8 x, int8 *exp);
1587 float16 __ovld frexp(float16 x, int16 *exp);
1588-#ifdef cl_khr_fp64
1589+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1590 double __ovld frexp(double x, int *exp);
1591 double2 __ovld frexp(double2 x, int2 *exp);
1592 double3 __ovld frexp(double3 x, int3 *exp);
1593 double4 __ovld frexp(double4 x, int4 *exp);
1594 double8 __ovld frexp(double8 x, int8 *exp);
1595 double16 __ovld frexp(double16 x, int16 *exp);
1596-#endif //cl_khr_fp64
1597+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1598 #ifdef cl_khr_fp16
1599 half __ovld frexp(half x, int *exp);
1600 half2 __ovld frexp(half2 x, int2 *exp);
1601@@ -7465,7 +7466,9 @@ half4 __ovld frexp(half4 x, int4 *exp);
1602 half8 __ovld frexp(half8 x, int8 *exp);
1603 half16 __ovld frexp(half16 x, int16 *exp);
1604 #endif //cl_khr_fp16
1605-#else
1606+#endif //__opencl_c_generic_address_space
1607+
1608+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1609 float __ovld frexp(float x, __global int *exp);
1610 float2 __ovld frexp(float2 x, __global int2 *exp);
1611 float3 __ovld frexp(float3 x, __global int3 *exp);
1612@@ -7484,7 +7487,7 @@ float3 __ovld frexp(float3 x, __private int3 *exp);
1613 float4 __ovld frexp(float4 x, __private int4 *exp);
1614 float8 __ovld frexp(float8 x, __private int8 *exp);
1615 float16 __ovld frexp(float16 x, __private int16 *exp);
1616-#ifdef cl_khr_fp64
1617+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1618 double __ovld frexp(double x, __global int *exp);
1619 double2 __ovld frexp(double2 x, __global int2 *exp);
1620 double3 __ovld frexp(double3 x, __global int3 *exp);
1621@@ -7503,7 +7506,7 @@ double3 __ovld frexp(double3 x, __private int3 *exp);
1622 double4 __ovld frexp(double4 x, __private int4 *exp);
1623 double8 __ovld frexp(double8 x, __private int8 *exp);
1624 double16 __ovld frexp(double16 x, __private int16 *exp);
1625-#endif //cl_khr_fp64
1626+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1627 #ifdef cl_khr_fp16
1628 half __ovld frexp(half x, __global int *exp);
1629 half2 __ovld frexp(half2 x, __global int2 *exp);
1630@@ -7524,7 +7527,8 @@ half4 __ovld frexp(half4 x, __private int4 *exp);
1631 half8 __ovld frexp(half8 x, __private int8 *exp);
1632 half16 __ovld frexp(half16 x, __private int16 *exp);
1633 #endif //cl_khr_fp16
1634-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1635+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1636+ //! CL_VERSION_2_0)
1637
1638 /**
1639 * Compute the value of the square root of x^2 + y^2
1640@@ -7536,14 +7540,14 @@ float3 __ovld __cnfn hypot(float3 x, float3 y);
1641 float4 __ovld __cnfn hypot(float4 x, float4 y);
1642 float8 __ovld __cnfn hypot(float8 x, float8 y);
1643 float16 __ovld __cnfn hypot(float16 x, float16 y);
1644-#ifdef cl_khr_fp64
1645+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1646 double __ovld __cnfn hypot(double x, double y);
1647 double2 __ovld __cnfn hypot(double2 x, double2 y);
1648 double3 __ovld __cnfn hypot(double3 x, double3 y);
1649 double4 __ovld __cnfn hypot(double4 x, double4 y);
1650 double8 __ovld __cnfn hypot(double8 x, double8 y);
1651 double16 __ovld __cnfn hypot(double16 x, double16 y);
1652-#endif //cl_khr_fp64
1653+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1654 #ifdef cl_khr_fp16
1655 half __ovld __cnfn hypot(half x, half y);
1656 half2 __ovld __cnfn hypot(half2 x, half2 y);
1657@@ -7562,14 +7566,14 @@ int3 __ovld __cnfn ilogb(float3 x);
1658 int4 __ovld __cnfn ilogb(float4 x);
1659 int8 __ovld __cnfn ilogb(float8 x);
1660 int16 __ovld __cnfn ilogb(float16 x);
1661-#ifdef cl_khr_fp64
1662+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1663 int __ovld __cnfn ilogb(double x);
1664 int2 __ovld __cnfn ilogb(double2 x);
1665 int3 __ovld __cnfn ilogb(double3 x);
1666 int4 __ovld __cnfn ilogb(double4 x);
1667 int8 __ovld __cnfn ilogb(double8 x);
1668 int16 __ovld __cnfn ilogb(double16 x);
1669-#endif //cl_khr_fp64
1670+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1671 #ifdef cl_khr_fp16
1672 int __ovld __cnfn ilogb(half x);
1673 int2 __ovld __cnfn ilogb(half2 x);
1674@@ -7593,7 +7597,7 @@ float3 __ovld __cnfn ldexp(float3 x, int n);
1675 float4 __ovld __cnfn ldexp(float4 x, int n);
1676 float8 __ovld __cnfn ldexp(float8 x, int n);
1677 float16 __ovld __cnfn ldexp(float16 x, int n);
1678-#ifdef cl_khr_fp64
1679+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1680 double __ovld __cnfn ldexp(double x, int n);
1681 double2 __ovld __cnfn ldexp(double2 x, int2 n);
1682 double3 __ovld __cnfn ldexp(double3 x, int3 n);
1683@@ -7605,7 +7609,7 @@ double3 __ovld __cnfn ldexp(double3 x, int n);
1684 double4 __ovld __cnfn ldexp(double4 x, int n);
1685 double8 __ovld __cnfn ldexp(double8 x, int n);
1686 double16 __ovld __cnfn ldexp(double16 x, int n);
1687-#endif //cl_khr_fp64
1688+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1689 #ifdef cl_khr_fp16
1690 half __ovld __cnfn ldexp(half x, int n);
1691 half2 __ovld __cnfn ldexp(half2 x, int2 n);
1692@@ -7632,14 +7636,14 @@ float3 __ovld __cnfn lgamma(float3 x);
1693 float4 __ovld __cnfn lgamma(float4 x);
1694 float8 __ovld __cnfn lgamma(float8 x);
1695 float16 __ovld __cnfn lgamma(float16 x);
1696-#ifdef cl_khr_fp64
1697+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1698 double __ovld __cnfn lgamma(double x);
1699 double2 __ovld __cnfn lgamma(double2 x);
1700 double3 __ovld __cnfn lgamma(double3 x);
1701 double4 __ovld __cnfn lgamma(double4 x);
1702 double8 __ovld __cnfn lgamma(double8 x);
1703 double16 __ovld __cnfn lgamma(double16 x);
1704-#endif //cl_khr_fp64
1705+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1706 #ifdef cl_khr_fp16
1707 half __ovld __cnfn lgamma(half x);
1708 half2 __ovld __cnfn lgamma(half2 x);
1709@@ -7649,21 +7653,21 @@ half8 __ovld __cnfn lgamma(half8 x);
1710 half16 __ovld __cnfn lgamma(half16 x);
1711 #endif //cl_khr_fp16
1712
1713-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1714+#ifdef __opencl_c_generic_address_space
1715 float __ovld lgamma_r(float x, int *signp);
1716 float2 __ovld lgamma_r(float2 x, int2 *signp);
1717 float3 __ovld lgamma_r(float3 x, int3 *signp);
1718 float4 __ovld lgamma_r(float4 x, int4 *signp);
1719 float8 __ovld lgamma_r(float8 x, int8 *signp);
1720 float16 __ovld lgamma_r(float16 x, int16 *signp);
1721-#ifdef cl_khr_fp64
1722+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1723 double __ovld lgamma_r(double x, int *signp);
1724 double2 __ovld lgamma_r(double2 x, int2 *signp);
1725 double3 __ovld lgamma_r(double3 x, int3 *signp);
1726 double4 __ovld lgamma_r(double4 x, int4 *signp);
1727 double8 __ovld lgamma_r(double8 x, int8 *signp);
1728 double16 __ovld lgamma_r(double16 x, int16 *signp);
1729-#endif //cl_khr_fp64
1730+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1731 #ifdef cl_khr_fp16
1732 half __ovld lgamma_r(half x, int *signp);
1733 half2 __ovld lgamma_r(half2 x, int2 *signp);
1734@@ -7672,7 +7676,9 @@ half4 __ovld lgamma_r(half4 x, int4 *signp);
1735 half8 __ovld lgamma_r(half8 x, int8 *signp);
1736 half16 __ovld lgamma_r(half16 x, int16 *signp);
1737 #endif //cl_khr_fp16
1738-#else
1739+#endif //__opencl_c_generic_address_space
1740+
1741+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1742 float __ovld lgamma_r(float x, __global int *signp);
1743 float2 __ovld lgamma_r(float2 x, __global int2 *signp);
1744 float3 __ovld lgamma_r(float3 x, __global int3 *signp);
1745@@ -7691,7 +7697,7 @@ float3 __ovld lgamma_r(float3 x, __private int3 *signp);
1746 float4 __ovld lgamma_r(float4 x, __private int4 *signp);
1747 float8 __ovld lgamma_r(float8 x, __private int8 *signp);
1748 float16 __ovld lgamma_r(float16 x, __private int16 *signp);
1749-#ifdef cl_khr_fp64
1750+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1751 double __ovld lgamma_r(double x, __global int *signp);
1752 double2 __ovld lgamma_r(double2 x, __global int2 *signp);
1753 double3 __ovld lgamma_r(double3 x, __global int3 *signp);
1754@@ -7710,7 +7716,7 @@ double3 __ovld lgamma_r(double3 x, __private int3 *signp);
1755 double4 __ovld lgamma_r(double4 x, __private int4 *signp);
1756 double8 __ovld lgamma_r(double8 x, __private int8 *signp);
1757 double16 __ovld lgamma_r(double16 x, __private int16 *signp);
1758-#endif //cl_khr_fp64
1759+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1760 #ifdef cl_khr_fp16
1761 half __ovld lgamma_r(half x, __global int *signp);
1762 half2 __ovld lgamma_r(half2 x, __global int2 *signp);
1763@@ -7731,8 +7737,8 @@ half4 __ovld lgamma_r(half4 x, __private int4 *signp);
1764 half8 __ovld lgamma_r(half8 x, __private int8 *signp);
1765 half16 __ovld lgamma_r(half16 x, __private int16 *signp);
1766 #endif //cl_khr_fp16
1767-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1768-
1769+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1770+ //! CL_VERSION_2_0)
1771 /**
1772 * Compute natural logarithm.
1773 */
1774@@ -7742,14 +7748,14 @@ float3 __ovld __cnfn log(float3);
1775 float4 __ovld __cnfn log(float4);
1776 float8 __ovld __cnfn log(float8);
1777 float16 __ovld __cnfn log(float16);
1778-#ifdef cl_khr_fp64
1779+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1780 double __ovld __cnfn log(double);
1781 double2 __ovld __cnfn log(double2);
1782 double3 __ovld __cnfn log(double3);
1783 double4 __ovld __cnfn log(double4);
1784 double8 __ovld __cnfn log(double8);
1785 double16 __ovld __cnfn log(double16);
1786-#endif //cl_khr_fp64
1787+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1788 #ifdef cl_khr_fp16
1789 half __ovld __cnfn log(half);
1790 half2 __ovld __cnfn log(half2);
1791@@ -7760,7 +7766,7 @@ half16 __ovld __cnfn log(half16);
1792 #endif //cl_khr_fp16
1793
1794 /**
1795- * Compute a base 2 logarithm.
1796+ * Compute a base 2 logarithm
1797 */
1798 float __ovld __cnfn log2(float);
1799 float2 __ovld __cnfn log2(float2);
1800@@ -7768,14 +7774,14 @@ float3 __ovld __cnfn log2(float3);
1801 float4 __ovld __cnfn log2(float4);
1802 float8 __ovld __cnfn log2(float8);
1803 float16 __ovld __cnfn log2(float16);
1804-#ifdef cl_khr_fp64
1805+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1806 double __ovld __cnfn log2(double);
1807 double2 __ovld __cnfn log2(double2);
1808 double3 __ovld __cnfn log2(double3);
1809 double4 __ovld __cnfn log2(double4);
1810 double8 __ovld __cnfn log2(double8);
1811 double16 __ovld __cnfn log2(double16);
1812-#endif //cl_khr_fp64
1813+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1814 #ifdef cl_khr_fp16
1815 half __ovld __cnfn log2(half);
1816 half2 __ovld __cnfn log2(half2);
1817@@ -7794,14 +7800,14 @@ float3 __ovld __cnfn log10(float3);
1818 float4 __ovld __cnfn log10(float4);
1819 float8 __ovld __cnfn log10(float8);
1820 float16 __ovld __cnfn log10(float16);
1821-#ifdef cl_khr_fp64
1822+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1823 double __ovld __cnfn log10(double);
1824 double2 __ovld __cnfn log10(double2);
1825 double3 __ovld __cnfn log10(double3);
1826 double4 __ovld __cnfn log10(double4);
1827 double8 __ovld __cnfn log10(double8);
1828 double16 __ovld __cnfn log10(double16);
1829-#endif //cl_khr_fp64
1830+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1831 #ifdef cl_khr_fp16
1832 half __ovld __cnfn log10(half);
1833 half2 __ovld __cnfn log10(half2);
1834@@ -7820,14 +7826,14 @@ float3 __ovld __cnfn log1p(float3 x);
1835 float4 __ovld __cnfn log1p(float4 x);
1836 float8 __ovld __cnfn log1p(float8 x);
1837 float16 __ovld __cnfn log1p(float16 x);
1838-#ifdef cl_khr_fp64
1839+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1840 double __ovld __cnfn log1p(double x);
1841 double2 __ovld __cnfn log1p(double2 x);
1842 double3 __ovld __cnfn log1p(double3 x);
1843 double4 __ovld __cnfn log1p(double4 x);
1844 double8 __ovld __cnfn log1p(double8 x);
1845 double16 __ovld __cnfn log1p(double16 x);
1846-#endif //cl_khr_fp64
1847+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1848 #ifdef cl_khr_fp16
1849 half __ovld __cnfn log1p(half x);
1850 half2 __ovld __cnfn log1p(half2 x);
1851@@ -7847,14 +7853,14 @@ float3 __ovld __cnfn logb(float3 x);
1852 float4 __ovld __cnfn logb(float4 x);
1853 float8 __ovld __cnfn logb(float8 x);
1854 float16 __ovld __cnfn logb(float16 x);
1855-#ifdef cl_khr_fp64
1856+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1857 double __ovld __cnfn logb(double x);
1858 double2 __ovld __cnfn logb(double2 x);
1859 double3 __ovld __cnfn logb(double3 x);
1860 double4 __ovld __cnfn logb(double4 x);
1861 double8 __ovld __cnfn logb(double8 x);
1862 double16 __ovld __cnfn logb(double16 x);
1863-#endif //cl_khr_fp64
1864+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1865 #ifdef cl_khr_fp16
1866 half __ovld __cnfn logb(half x);
1867 half2 __ovld __cnfn logb(half2 x);
1868@@ -7877,14 +7883,14 @@ float3 __ovld __cnfn mad(float3 a, float3 b, float3 c);
1869 float4 __ovld __cnfn mad(float4 a, float4 b, float4 c);
1870 float8 __ovld __cnfn mad(float8 a, float8 b, float8 c);
1871 float16 __ovld __cnfn mad(float16 a, float16 b, float16 c);
1872-#ifdef cl_khr_fp64
1873+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1874 double __ovld __cnfn mad(double a, double b, double c);
1875 double2 __ovld __cnfn mad(double2 a, double2 b, double2 c);
1876 double3 __ovld __cnfn mad(double3 a, double3 b, double3 c);
1877 double4 __ovld __cnfn mad(double4 a, double4 b, double4 c);
1878 double8 __ovld __cnfn mad(double8 a, double8 b, double8 c);
1879 double16 __ovld __cnfn mad(double16 a, double16 b, double16 c);
1880-#endif //cl_khr_fp64
1881+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1882 #ifdef cl_khr_fp16
1883 half __ovld __cnfn mad(half a, half b, half c);
1884 half2 __ovld __cnfn mad(half2 a, half2 b, half2 c);
1885@@ -7904,14 +7910,14 @@ float3 __ovld __cnfn maxmag(float3 x, float3 y);
1886 float4 __ovld __cnfn maxmag(float4 x, float4 y);
1887 float8 __ovld __cnfn maxmag(float8 x, float8 y);
1888 float16 __ovld __cnfn maxmag(float16 x, float16 y);
1889-#ifdef cl_khr_fp64
1890+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1891 double __ovld __cnfn maxmag(double x, double y);
1892 double2 __ovld __cnfn maxmag(double2 x, double2 y);
1893 double3 __ovld __cnfn maxmag(double3 x, double3 y);
1894 double4 __ovld __cnfn maxmag(double4 x, double4 y);
1895 double8 __ovld __cnfn maxmag(double8 x, double8 y);
1896 double16 __ovld __cnfn maxmag(double16 x, double16 y);
1897-#endif //cl_khr_fp64
1898+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1899 #ifdef cl_khr_fp16
1900 half __ovld __cnfn maxmag(half x, half y);
1901 half2 __ovld __cnfn maxmag(half2 x, half2 y);
1902@@ -7931,14 +7937,14 @@ float3 __ovld __cnfn minmag(float3 x, float3 y);
1903 float4 __ovld __cnfn minmag(float4 x, float4 y);
1904 float8 __ovld __cnfn minmag(float8 x, float8 y);
1905 float16 __ovld __cnfn minmag(float16 x, float16 y);
1906-#ifdef cl_khr_fp64
1907+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1908 double __ovld __cnfn minmag(double x, double y);
1909 double2 __ovld __cnfn minmag(double2 x, double2 y);
1910 double3 __ovld __cnfn minmag(double3 x, double3 y);
1911 double4 __ovld __cnfn minmag(double4 x, double4 y);
1912 double8 __ovld __cnfn minmag(double8 x, double8 y);
1913 double16 __ovld __cnfn minmag(double16 x, double16 y);
1914-#endif //cl_khr_fp64
1915+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1916 #ifdef cl_khr_fp16
1917 half __ovld __cnfn minmag(half x, half y);
1918 half2 __ovld __cnfn minmag(half2 x, half2 y);
1919@@ -7955,21 +7961,21 @@ half16 __ovld __cnfn minmag(half16 x, half16 y);
1920 * the argument. It stores the integral part in the object
1921 * pointed to by iptr.
1922 */
1923-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1924+#ifdef __opencl_c_generic_address_space
1925 float __ovld modf(float x, float *iptr);
1926 float2 __ovld modf(float2 x, float2 *iptr);
1927 float3 __ovld modf(float3 x, float3 *iptr);
1928 float4 __ovld modf(float4 x, float4 *iptr);
1929 float8 __ovld modf(float8 x, float8 *iptr);
1930 float16 __ovld modf(float16 x, float16 *iptr);
1931-#ifdef cl_khr_fp64
1932+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1933 double __ovld modf(double x, double *iptr);
1934 double2 __ovld modf(double2 x, double2 *iptr);
1935 double3 __ovld modf(double3 x, double3 *iptr);
1936 double4 __ovld modf(double4 x, double4 *iptr);
1937 double8 __ovld modf(double8 x, double8 *iptr);
1938 double16 __ovld modf(double16 x, double16 *iptr);
1939-#endif //cl_khr_fp64
1940+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1941 #ifdef cl_khr_fp16
1942 half __ovld modf(half x, half *iptr);
1943 half2 __ovld modf(half2 x, half2 *iptr);
1944@@ -7978,7 +7984,9 @@ half4 __ovld modf(half4 x, half4 *iptr);
1945 half8 __ovld modf(half8 x, half8 *iptr);
1946 half16 __ovld modf(half16 x, half16 *iptr);
1947 #endif //cl_khr_fp16
1948-#else
1949+#endif //__opencl_c_generic_address_space
1950+
1951+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1952 float __ovld modf(float x, __global float *iptr);
1953 float2 __ovld modf(float2 x, __global float2 *iptr);
1954 float3 __ovld modf(float3 x, __global float3 *iptr);
1955@@ -7997,7 +8005,7 @@ float3 __ovld modf(float3 x, __private float3 *iptr);
1956 float4 __ovld modf(float4 x, __private float4 *iptr);
1957 float8 __ovld modf(float8 x, __private float8 *iptr);
1958 float16 __ovld modf(float16 x, __private float16 *iptr);
1959-#ifdef cl_khr_fp64
1960+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1961 double __ovld modf(double x, __global double *iptr);
1962 double2 __ovld modf(double2 x, __global double2 *iptr);
1963 double3 __ovld modf(double3 x, __global double3 *iptr);
1964@@ -8016,7 +8024,7 @@ double3 __ovld modf(double3 x, __private double3 *iptr);
1965 double4 __ovld modf(double4 x, __private double4 *iptr);
1966 double8 __ovld modf(double8 x, __private double8 *iptr);
1967 double16 __ovld modf(double16 x, __private double16 *iptr);
1968-#endif //cl_khr_fp64
1969+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1970 #ifdef cl_khr_fp16
1971 half __ovld modf(half x, __global half *iptr);
1972 half2 __ovld modf(half2 x, __global half2 *iptr);
1973@@ -8037,7 +8045,8 @@ half4 __ovld modf(half4 x, __private half4 *iptr);
1974 half8 __ovld modf(half8 x, __private half8 *iptr);
1975 half16 __ovld modf(half16 x, __private half16 *iptr);
1976 #endif //cl_khr_fp16
1977-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1978+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1979+ //! CL_VERSION_2_0)
1980
1981 /**
1982 * Returns a quiet NaN. The nancode may be placed
1983@@ -8049,14 +8058,14 @@ float3 __ovld __cnfn nan(uint3 nancode);
1984 float4 __ovld __cnfn nan(uint4 nancode);
1985 float8 __ovld __cnfn nan(uint8 nancode);
1986 float16 __ovld __cnfn nan(uint16 nancode);
1987-#ifdef cl_khr_fp64
1988+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1989 double __ovld __cnfn nan(ulong nancode);
1990 double2 __ovld __cnfn nan(ulong2 nancode);
1991 double3 __ovld __cnfn nan(ulong3 nancode);
1992 double4 __ovld __cnfn nan(ulong4 nancode);
1993 double8 __ovld __cnfn nan(ulong8 nancode);
1994 double16 __ovld __cnfn nan(ulong16 nancode);
1995-#endif //cl_khr_fp64
1996+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1997 #ifdef cl_khr_fp16
1998 half __ovld __cnfn nan(ushort nancode);
1999 half2 __ovld __cnfn nan(ushort2 nancode);
2000@@ -8079,14 +8088,14 @@ float3 __ovld __cnfn nextafter(float3 x, float3 y);
2001 float4 __ovld __cnfn nextafter(float4 x, float4 y);
2002 float8 __ovld __cnfn nextafter(float8 x, float8 y);
2003 float16 __ovld __cnfn nextafter(float16 x, float16 y);
2004-#ifdef cl_khr_fp64
2005+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2006 double __ovld __cnfn nextafter(double x, double y);
2007 double2 __ovld __cnfn nextafter(double2 x, double2 y);
2008 double3 __ovld __cnfn nextafter(double3 x, double3 y);
2009 double4 __ovld __cnfn nextafter(double4 x, double4 y);
2010 double8 __ovld __cnfn nextafter(double8 x, double8 y);
2011 double16 __ovld __cnfn nextafter(double16 x, double16 y);
2012-#endif //cl_khr_fp64
2013+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2014 #ifdef cl_khr_fp16
2015 half __ovld __cnfn nextafter(half x, half y);
2016 half2 __ovld __cnfn nextafter(half2 x, half2 y);
2017@@ -8105,14 +8114,14 @@ float3 __ovld __cnfn pow(float3 x, float3 y);
2018 float4 __ovld __cnfn pow(float4 x, float4 y);
2019 float8 __ovld __cnfn pow(float8 x, float8 y);
2020 float16 __ovld __cnfn pow(float16 x, float16 y);
2021-#ifdef cl_khr_fp64
2022+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2023 double __ovld __cnfn pow(double x, double y);
2024 double2 __ovld __cnfn pow(double2 x, double2 y);
2025 double3 __ovld __cnfn pow(double3 x, double3 y);
2026 double4 __ovld __cnfn pow(double4 x, double4 y);
2027 double8 __ovld __cnfn pow(double8 x, double8 y);
2028 double16 __ovld __cnfn pow(double16 x, double16 y);
2029-#endif //cl_khr_fp64
2030+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2031 #ifdef cl_khr_fp16
2032 half __ovld __cnfn pow(half x, half y);
2033 half2 __ovld __cnfn pow(half2 x, half2 y);
2034@@ -8131,14 +8140,14 @@ float3 __ovld __cnfn pown(float3 x, int3 y);
2035 float4 __ovld __cnfn pown(float4 x, int4 y);
2036 float8 __ovld __cnfn pown(float8 x, int8 y);
2037 float16 __ovld __cnfn pown(float16 x, int16 y);
2038-#ifdef cl_khr_fp64
2039+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2040 double __ovld __cnfn pown(double x, int y);
2041 double2 __ovld __cnfn pown(double2 x, int2 y);
2042 double3 __ovld __cnfn pown(double3 x, int3 y);
2043 double4 __ovld __cnfn pown(double4 x, int4 y);
2044 double8 __ovld __cnfn pown(double8 x, int8 y);
2045 double16 __ovld __cnfn pown(double16 x, int16 y);
2046-#endif //cl_khr_fp64
2047+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2048 #ifdef cl_khr_fp16
2049 half __ovld __cnfn pown(half x, int y);
2050 half2 __ovld __cnfn pown(half2 x, int2 y);
2051@@ -8157,14 +8166,14 @@ float3 __ovld __cnfn powr(float3 x, float3 y);
2052 float4 __ovld __cnfn powr(float4 x, float4 y);
2053 float8 __ovld __cnfn powr(float8 x, float8 y);
2054 float16 __ovld __cnfn powr(float16 x, float16 y);
2055-#ifdef cl_khr_fp64
2056+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2057 double __ovld __cnfn powr(double x, double y);
2058 double2 __ovld __cnfn powr(double2 x, double2 y);
2059 double3 __ovld __cnfn powr(double3 x, double3 y);
2060 double4 __ovld __cnfn powr(double4 x, double4 y);
2061 double8 __ovld __cnfn powr(double8 x, double8 y);
2062 double16 __ovld __cnfn powr(double16 x, double16 y);
2063-#endif //cl_khr_fp64
2064+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2065 #ifdef cl_khr_fp16
2066 half __ovld __cnfn powr(half x, half y);
2067 half2 __ovld __cnfn powr(half2 x, half2 y);
2068@@ -8186,14 +8195,14 @@ float3 __ovld __cnfn remainder(float3 x, float3 y);
2069 float4 __ovld __cnfn remainder(float4 x, float4 y);
2070 float8 __ovld __cnfn remainder(float8 x, float8 y);
2071 float16 __ovld __cnfn remainder(float16 x, float16 y);
2072-#ifdef cl_khr_fp64
2073+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2074 double __ovld __cnfn remainder(double x, double y);
2075 double2 __ovld __cnfn remainder(double2 x, double2 y);
2076 double3 __ovld __cnfn remainder(double3 x, double3 y);
2077 double4 __ovld __cnfn remainder(double4 x, double4 y);
2078 double8 __ovld __cnfn remainder(double8 x, double8 y);
2079 double16 __ovld __cnfn remainder(double16 x, double16 y);
2080-#endif //cl_khr_fp64
2081+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2082 #ifdef cl_khr_fp16
2083 half __ovld __cnfn remainder(half x, half y);
2084 half2 __ovld __cnfn remainder(half2 x, half2 y);
2085@@ -8215,21 +8224,21 @@ half16 __ovld __cnfn remainder(half16 x, half16 y);
2086 * sign as x/y. It stores this signed value in the object
2087 * pointed to by quo.
2088 */
2089-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2090+#ifdef __opencl_c_generic_address_space
2091 float __ovld remquo(float x, float y, int *quo);
2092 float2 __ovld remquo(float2 x, float2 y, int2 *quo);
2093 float3 __ovld remquo(float3 x, float3 y, int3 *quo);
2094 float4 __ovld remquo(float4 x, float4 y, int4 *quo);
2095 float8 __ovld remquo(float8 x, float8 y, int8 *quo);
2096 float16 __ovld remquo(float16 x, float16 y, int16 *quo);
2097-#ifdef cl_khr_fp64
2098+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2099 double __ovld remquo(double x, double y, int *quo);
2100 double2 __ovld remquo(double2 x, double2 y, int2 *quo);
2101 double3 __ovld remquo(double3 x, double3 y, int3 *quo);
2102 double4 __ovld remquo(double4 x, double4 y, int4 *quo);
2103 double8 __ovld remquo(double8 x, double8 y, int8 *quo);
2104 double16 __ovld remquo(double16 x, double16 y, int16 *quo);
2105-#endif //cl_khr_fp64
2106+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2107 #ifdef cl_khr_fp16
2108 half __ovld remquo(half x, half y, int *quo);
2109 half2 __ovld remquo(half2 x, half2 y, int2 *quo);
2110@@ -8237,9 +8246,10 @@ half3 __ovld remquo(half3 x, half3 y, int3 *quo);
2111 half4 __ovld remquo(half4 x, half4 y, int4 *quo);
2112 half8 __ovld remquo(half8 x, half8 y, int8 *quo);
2113 half16 __ovld remquo(half16 x, half16 y, int16 *quo);
2114-
2115 #endif //cl_khr_fp16
2116-#else
2117+#endif //__opencl_c_generic_address_space
2118+
2119+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
2120 float __ovld remquo(float x, float y, __global int *quo);
2121 float2 __ovld remquo(float2 x, float2 y, __global int2 *quo);
2122 float3 __ovld remquo(float3 x, float3 y, __global int3 *quo);
2123@@ -8258,7 +8268,7 @@ float3 __ovld remquo(float3 x, float3 y, __private int3 *quo);
2124 float4 __ovld remquo(float4 x, float4 y, __private int4 *quo);
2125 float8 __ovld remquo(float8 x, float8 y, __private int8 *quo);
2126 float16 __ovld remquo(float16 x, float16 y, __private int16 *quo);
2127-#ifdef cl_khr_fp64
2128+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2129 double __ovld remquo(double x, double y, __global int *quo);
2130 double2 __ovld remquo(double2 x, double2 y, __global int2 *quo);
2131 double3 __ovld remquo(double3 x, double3 y, __global int3 *quo);
2132@@ -8277,7 +8287,7 @@ double3 __ovld remquo(double3 x, double3 y, __private int3 *quo);
2133 double4 __ovld remquo(double4 x, double4 y, __private int4 *quo);
2134 double8 __ovld remquo(double8 x, double8 y, __private int8 *quo);
2135 double16 __ovld remquo(double16 x, double16 y, __private int16 *quo);
2136-#endif //cl_khr_fp64
2137+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2138 #ifdef cl_khr_fp16
2139 half __ovld remquo(half x, half y, __global int *quo);
2140 half2 __ovld remquo(half2 x, half2 y, __global int2 *quo);
2141@@ -8298,7 +8308,8 @@ half4 __ovld remquo(half4 x, half4 y, __private int4 *quo);
2142 half8 __ovld remquo(half8 x, half8 y, __private int8 *quo);
2143 half16 __ovld remquo(half16 x, half16 y, __private int16 *quo);
2144 #endif //cl_khr_fp16
2145-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2146+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
2147+ //! CL_VERSION_2_0)
2148 /**
2149 * Round to integral value (using round to nearest
2150 * even rounding mode) in floating-point format.
2151@@ -8311,14 +8322,14 @@ float3 __ovld __cnfn rint(float3);
2152 float4 __ovld __cnfn rint(float4);
2153 float8 __ovld __cnfn rint(float8);
2154 float16 __ovld __cnfn rint(float16);
2155-#ifdef cl_khr_fp64
2156+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2157 double __ovld __cnfn rint(double);
2158 double2 __ovld __cnfn rint(double2);
2159 double3 __ovld __cnfn rint(double3);
2160 double4 __ovld __cnfn rint(double4);
2161 double8 __ovld __cnfn rint(double8);
2162 double16 __ovld __cnfn rint(double16);
2163-#endif //cl_khr_fp64
2164+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2165 #ifdef cl_khr_fp16
2166 half __ovld __cnfn rint(half);
2167 half2 __ovld __cnfn rint(half2);
2168@@ -8337,14 +8348,14 @@ float3 __ovld __cnfn rootn(float3 x, int3 y);
2169 float4 __ovld __cnfn rootn(float4 x, int4 y);
2170 float8 __ovld __cnfn rootn(float8 x, int8 y);
2171 float16 __ovld __cnfn rootn(float16 x, int16 y);
2172-#ifdef cl_khr_fp64
2173+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2174 double __ovld __cnfn rootn(double x, int y);
2175 double2 __ovld __cnfn rootn(double2 x, int2 y);
2176 double3 __ovld __cnfn rootn(double3 x, int3 y);
2177 double4 __ovld __cnfn rootn(double4 x, int4 y);
2178 double8 __ovld __cnfn rootn(double8 x, int8 y);
2179 double16 __ovld __cnfn rootn(double16 x, int16 y);
2180-#endif //cl_khr_fp64
2181+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2182 #ifdef cl_khr_fp16
2183 half __ovld __cnfn rootn(half x, int y);
2184 half2 __ovld __cnfn rootn(half2 x, int2 y);
2185@@ -8365,14 +8376,14 @@ float3 __ovld __cnfn round(float3 x);
2186 float4 __ovld __cnfn round(float4 x);
2187 float8 __ovld __cnfn round(float8 x);
2188 float16 __ovld __cnfn round(float16 x);
2189-#ifdef cl_khr_fp64
2190+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2191 double __ovld __cnfn round(double x);
2192 double2 __ovld __cnfn round(double2 x);
2193 double3 __ovld __cnfn round(double3 x);
2194 double4 __ovld __cnfn round(double4 x);
2195 double8 __ovld __cnfn round(double8 x);
2196 double16 __ovld __cnfn round(double16 x);
2197-#endif //cl_khr_fp64
2198+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2199 #ifdef cl_khr_fp16
2200 half __ovld __cnfn round(half x);
2201 half2 __ovld __cnfn round(half2 x);
2202@@ -8391,14 +8402,14 @@ float3 __ovld __cnfn rsqrt(float3);
2203 float4 __ovld __cnfn rsqrt(float4);
2204 float8 __ovld __cnfn rsqrt(float8);
2205 float16 __ovld __cnfn rsqrt(float16);
2206-#ifdef cl_khr_fp64
2207+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2208 double __ovld __cnfn rsqrt(double);
2209 double2 __ovld __cnfn rsqrt(double2);
2210 double3 __ovld __cnfn rsqrt(double3);
2211 double4 __ovld __cnfn rsqrt(double4);
2212 double8 __ovld __cnfn rsqrt(double8);
2213 double16 __ovld __cnfn rsqrt(double16);
2214-#endif //cl_khr_fp64
2215+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2216 #ifdef cl_khr_fp16
2217 half __ovld __cnfn rsqrt(half);
2218 half2 __ovld __cnfn rsqrt(half2);
2219@@ -8417,14 +8428,14 @@ float3 __ovld __cnfn sin(float3);
2220 float4 __ovld __cnfn sin(float4);
2221 float8 __ovld __cnfn sin(float8);
2222 float16 __ovld __cnfn sin(float16);
2223-#ifdef cl_khr_fp64
2224+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2225 double __ovld __cnfn sin(double);
2226 double2 __ovld __cnfn sin(double2);
2227 double3 __ovld __cnfn sin(double3);
2228 double4 __ovld __cnfn sin(double4);
2229 double8 __ovld __cnfn sin(double8);
2230 double16 __ovld __cnfn sin(double16);
2231-#endif //cl_khr_fp64
2232+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2233 #ifdef cl_khr_fp16
2234 half __ovld __cnfn sin(half);
2235 half2 __ovld __cnfn sin(half2);
2236@@ -8439,21 +8450,21 @@ half16 __ovld __cnfn sin(half16);
2237 * is the return value and computed cosine is returned
2238 * in cosval.
2239 */
2240-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2241+#ifdef __opencl_c_generic_address_space
2242 float __ovld sincos(float x, float *cosval);
2243 float2 __ovld sincos(float2 x, float2 *cosval);
2244 float3 __ovld sincos(float3 x, float3 *cosval);
2245 float4 __ovld sincos(float4 x, float4 *cosval);
2246 float8 __ovld sincos(float8 x, float8 *cosval);
2247 float16 __ovld sincos(float16 x, float16 *cosval);
2248-#ifdef cl_khr_fp64
2249+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2250 double __ovld sincos(double x, double *cosval);
2251 double2 __ovld sincos(double2 x, double2 *cosval);
2252 double3 __ovld sincos(double3 x, double3 *cosval);
2253 double4 __ovld sincos(double4 x, double4 *cosval);
2254 double8 __ovld sincos(double8 x, double8 *cosval);
2255 double16 __ovld sincos(double16 x, double16 *cosval);
2256-#endif //cl_khr_fp64
2257+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2258 #ifdef cl_khr_fp16
2259 half __ovld sincos(half x, half *cosval);
2260 half2 __ovld sincos(half2 x, half2 *cosval);
2261@@ -8462,7 +8473,9 @@ half4 __ovld sincos(half4 x, half4 *cosval);
2262 half8 __ovld sincos(half8 x, half8 *cosval);
2263 half16 __ovld sincos(half16 x, half16 *cosval);
2264 #endif //cl_khr_fp16
2265-#else
2266+#endif //__opencl_c_generic_address_space
2267+
2268+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
2269 float __ovld sincos(float x, __global float *cosval);
2270 float2 __ovld sincos(float2 x, __global float2 *cosval);
2271 float3 __ovld sincos(float3 x, __global float3 *cosval);
2272@@ -8481,7 +8494,7 @@ float3 __ovld sincos(float3 x, __private float3 *cosval);
2273 float4 __ovld sincos(float4 x, __private float4 *cosval);
2274 float8 __ovld sincos(float8 x, __private float8 *cosval);
2275 float16 __ovld sincos(float16 x, __private float16 *cosval);
2276-#ifdef cl_khr_fp64
2277+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2278 double __ovld sincos(double x, __global double *cosval);
2279 double2 __ovld sincos(double2 x, __global double2 *cosval);
2280 double3 __ovld sincos(double3 x, __global double3 *cosval);
2281@@ -8500,7 +8513,7 @@ double3 __ovld sincos(double3 x, __private double3 *cosval);
2282 double4 __ovld sincos(double4 x, __private double4 *cosval);
2283 double8 __ovld sincos(double8 x, __private double8 *cosval);
2284 double16 __ovld sincos(double16 x, __private double16 *cosval);
2285-#endif //cl_khr_fp64
2286+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2287 #ifdef cl_khr_fp16
2288 half __ovld sincos(half x, __global half *cosval);
2289 half2 __ovld sincos(half2 x, __global half2 *cosval);
2290@@ -8521,8 +8534,8 @@ half4 __ovld sincos(half4 x, __private half4 *cosval);
2291 half8 __ovld sincos(half8 x, __private half8 *cosval);
2292 half16 __ovld sincos(half16 x, __private half16 *cosval);
2293 #endif //cl_khr_fp16
2294-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2295-
2296+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
2297+ //! CL_VERSION_2_0)
2298 /**
2299 * Compute hyperbolic sine.
2300 */
2301@@ -8532,14 +8545,14 @@ float3 __ovld __cnfn sinh(float3);
2302 float4 __ovld __cnfn sinh(float4);
2303 float8 __ovld __cnfn sinh(float8);
2304 float16 __ovld __cnfn sinh(float16);
2305-#ifdef cl_khr_fp64
2306+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2307 double __ovld __cnfn sinh(double);
2308 double2 __ovld __cnfn sinh(double2);
2309 double3 __ovld __cnfn sinh(double3);
2310 double4 __ovld __cnfn sinh(double4);
2311 double8 __ovld __cnfn sinh(double8);
2312 double16 __ovld __cnfn sinh(double16);
2313-#endif //cl_khr_fp64
2314+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2315 #ifdef cl_khr_fp16
2316 half __ovld __cnfn sinh(half);
2317 half2 __ovld __cnfn sinh(half2);
2318@@ -8558,14 +8571,14 @@ float3 __ovld __cnfn sinpi(float3 x);
2319 float4 __ovld __cnfn sinpi(float4 x);
2320 float8 __ovld __cnfn sinpi(float8 x);
2321 float16 __ovld __cnfn sinpi(float16 x);
2322-#ifdef cl_khr_fp64
2323+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2324 double __ovld __cnfn sinpi(double x);
2325 double2 __ovld __cnfn sinpi(double2 x);
2326 double3 __ovld __cnfn sinpi(double3 x);
2327 double4 __ovld __cnfn sinpi(double4 x);
2328 double8 __ovld __cnfn sinpi(double8 x);
2329 double16 __ovld __cnfn sinpi(double16 x);
2330-#endif //cl_khr_fp64
2331+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2332 #ifdef cl_khr_fp16
2333 half __ovld __cnfn sinpi(half x);
2334 half2 __ovld __cnfn sinpi(half2 x);
2335@@ -8584,14 +8597,14 @@ float3 __ovld __cnfn sqrt(float3);
2336 float4 __ovld __cnfn sqrt(float4);
2337 float8 __ovld __cnfn sqrt(float8);
2338 float16 __ovld __cnfn sqrt(float16);
2339-#ifdef cl_khr_fp64
2340+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2341 double __ovld __cnfn sqrt(double);
2342 double2 __ovld __cnfn sqrt(double2);
2343 double3 __ovld __cnfn sqrt(double3);
2344 double4 __ovld __cnfn sqrt(double4);
2345 double8 __ovld __cnfn sqrt(double8);
2346 double16 __ovld __cnfn sqrt(double16);
2347-#endif //cl_khr_fp64
2348+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2349 #ifdef cl_khr_fp16
2350 half __ovld __cnfn sqrt(half);
2351 half2 __ovld __cnfn sqrt(half2);
2352@@ -8610,14 +8623,14 @@ float3 __ovld __cnfn tan(float3);
2353 float4 __ovld __cnfn tan(float4);
2354 float8 __ovld __cnfn tan(float8);
2355 float16 __ovld __cnfn tan(float16);
2356-#ifdef cl_khr_fp64
2357+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2358 double __ovld __cnfn tan(double);
2359 double2 __ovld __cnfn tan(double2);
2360 double3 __ovld __cnfn tan(double3);
2361 double4 __ovld __cnfn tan(double4);
2362 double8 __ovld __cnfn tan(double8);
2363 double16 __ovld __cnfn tan(double16);
2364-#endif //cl_khr_fp64
2365+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2366 #ifdef cl_khr_fp16
2367 half __ovld __cnfn tan(half);
2368 half2 __ovld __cnfn tan(half2);
2369@@ -8636,14 +8649,14 @@ float3 __ovld __cnfn tanh(float3);
2370 float4 __ovld __cnfn tanh(float4);
2371 float8 __ovld __cnfn tanh(float8);
2372 float16 __ovld __cnfn tanh(float16);
2373-#ifdef cl_khr_fp64
2374+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2375 double __ovld __cnfn tanh(double);
2376 double2 __ovld __cnfn tanh(double2);
2377 double3 __ovld __cnfn tanh(double3);
2378 double4 __ovld __cnfn tanh(double4);
2379 double8 __ovld __cnfn tanh(double8);
2380 double16 __ovld __cnfn tanh(double16);
2381-#endif //cl_khr_fp64
2382+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2383 #ifdef cl_khr_fp16
2384 half __ovld __cnfn tanh(half);
2385 half2 __ovld __cnfn tanh(half2);
2386@@ -8662,14 +8675,14 @@ float3 __ovld __cnfn tanpi(float3 x);
2387 float4 __ovld __cnfn tanpi(float4 x);
2388 float8 __ovld __cnfn tanpi(float8 x);
2389 float16 __ovld __cnfn tanpi(float16 x);
2390-#ifdef cl_khr_fp64
2391+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2392 double __ovld __cnfn tanpi(double x);
2393 double2 __ovld __cnfn tanpi(double2 x);
2394 double3 __ovld __cnfn tanpi(double3 x);
2395 double4 __ovld __cnfn tanpi(double4 x);
2396 double8 __ovld __cnfn tanpi(double8 x);
2397 double16 __ovld __cnfn tanpi(double16 x);
2398-#endif //cl_khr_fp64
2399+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2400 #ifdef cl_khr_fp16
2401 half __ovld __cnfn tanpi(half x);
2402 half2 __ovld __cnfn tanpi(half2 x);
2403@@ -8688,14 +8701,14 @@ float3 __ovld __cnfn tgamma(float3);
2404 float4 __ovld __cnfn tgamma(float4);
2405 float8 __ovld __cnfn tgamma(float8);
2406 float16 __ovld __cnfn tgamma(float16);
2407-#ifdef cl_khr_fp64
2408+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2409 double __ovld __cnfn tgamma(double);
2410 double2 __ovld __cnfn tgamma(double2);
2411 double3 __ovld __cnfn tgamma(double3);
2412 double4 __ovld __cnfn tgamma(double4);
2413 double8 __ovld __cnfn tgamma(double8);
2414 double16 __ovld __cnfn tgamma(double16);
2415-#endif //cl_khr_fp64
2416+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2417 #ifdef cl_khr_fp16
2418 half __ovld __cnfn tgamma(half);
2419 half2 __ovld __cnfn tgamma(half2);
2420@@ -8715,14 +8728,14 @@ float3 __ovld __cnfn trunc(float3);
2421 float4 __ovld __cnfn trunc(float4);
2422 float8 __ovld __cnfn trunc(float8);
2423 float16 __ovld __cnfn trunc(float16);
2424-#ifdef cl_khr_fp64
2425+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2426 double __ovld __cnfn trunc(double);
2427 double2 __ovld __cnfn trunc(double2);
2428 double3 __ovld __cnfn trunc(double3);
2429 double4 __ovld __cnfn trunc(double4);
2430 double8 __ovld __cnfn trunc(double8);
2431 double16 __ovld __cnfn trunc(double16);
2432-#endif //cl_khr_fp64
2433+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2434 #ifdef cl_khr_fp16
2435 half __ovld __cnfn trunc(half);
2436 half2 __ovld __cnfn trunc(half2);
2437@@ -10108,7 +10121,7 @@ float3 __ovld __cnfn clamp(float3 x, float minval, float maxval);
2438 float4 __ovld __cnfn clamp(float4 x, float minval, float maxval);
2439 float8 __ovld __cnfn clamp(float8 x, float minval, float maxval);
2440 float16 __ovld __cnfn clamp(float16 x, float minval, float maxval);
2441-#ifdef cl_khr_fp64
2442+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2443 double __ovld __cnfn clamp(double x, double minval, double maxval);
2444 double2 __ovld __cnfn clamp(double2 x, double2 minval, double2 maxval);
2445 double3 __ovld __cnfn clamp(double3 x, double3 minval, double3 maxval);
2446@@ -10120,7 +10133,7 @@ double3 __ovld __cnfn clamp(double3 x, double minval, double maxval);
2447 double4 __ovld __cnfn clamp(double4 x, double minval, double maxval);
2448 double8 __ovld __cnfn clamp(double8 x, double minval, double maxval);
2449 double16 __ovld __cnfn clamp(double16 x, double minval, double maxval);
2450-#endif //cl_khr_fp64
2451+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2452 #ifdef cl_khr_fp16
2453 half __ovld __cnfn clamp(half x, half minval, half maxval);
2454 half2 __ovld __cnfn clamp(half2 x, half2 minval, half2 maxval);
2455@@ -10145,14 +10158,14 @@ float3 __ovld __cnfn degrees(float3 radians);
2456 float4 __ovld __cnfn degrees(float4 radians);
2457 float8 __ovld __cnfn degrees(float8 radians);
2458 float16 __ovld __cnfn degrees(float16 radians);
2459-#ifdef cl_khr_fp64
2460+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2461 double __ovld __cnfn degrees(double radians);
2462 double2 __ovld __cnfn degrees(double2 radians);
2463 double3 __ovld __cnfn degrees(double3 radians);
2464 double4 __ovld __cnfn degrees(double4 radians);
2465 double8 __ovld __cnfn degrees(double8 radians);
2466 double16 __ovld __cnfn degrees(double16 radians);
2467-#endif //cl_khr_fp64
2468+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2469 #ifdef cl_khr_fp16
2470 half __ovld __cnfn degrees(half radians);
2471 half2 __ovld __cnfn degrees(half2 radians);
2472@@ -10177,7 +10190,7 @@ float3 __ovld __cnfn max(float3 x, float y);
2473 float4 __ovld __cnfn max(float4 x, float y);
2474 float8 __ovld __cnfn max(float8 x, float y);
2475 float16 __ovld __cnfn max(float16 x, float y);
2476-#ifdef cl_khr_fp64
2477+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2478 double __ovld __cnfn max(double x, double y);
2479 double2 __ovld __cnfn max(double2 x, double2 y);
2480 double3 __ovld __cnfn max(double3 x, double3 y);
2481@@ -10189,7 +10202,7 @@ double3 __ovld __cnfn max(double3 x, double y);
2482 double4 __ovld __cnfn max(double4 x, double y);
2483 double8 __ovld __cnfn max(double8 x, double y);
2484 double16 __ovld __cnfn max(double16 x, double y);
2485-#endif //cl_khr_fp64
2486+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2487 #ifdef cl_khr_fp16
2488 half __ovld __cnfn max(half x, half y);
2489 half2 __ovld __cnfn max(half2 x, half2 y);
2490@@ -10219,7 +10232,7 @@ float3 __ovld __cnfn min(float3 x, float y);
2491 float4 __ovld __cnfn min(float4 x, float y);
2492 float8 __ovld __cnfn min(float8 x, float y);
2493 float16 __ovld __cnfn min(float16 x, float y);
2494-#ifdef cl_khr_fp64
2495+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2496 double __ovld __cnfn min(double x, double y);
2497 double2 __ovld __cnfn min(double2 x, double2 y);
2498 double3 __ovld __cnfn min(double3 x, double3 y);
2499@@ -10231,7 +10244,7 @@ double3 __ovld __cnfn min(double3 x, double y);
2500 double4 __ovld __cnfn min(double4 x, double y);
2501 double8 __ovld __cnfn min(double8 x, double y);
2502 double16 __ovld __cnfn min(double16 x, double y);
2503-#endif //cl_khr_fp64
2504+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2505 #ifdef cl_khr_fp16
2506 half __ovld __cnfn min(half x, half y);
2507 half2 __ovld __cnfn min(half2 x, half2 y);
2508@@ -10264,7 +10277,7 @@ float3 __ovld __cnfn mix(float3 x, float3 y, float a);
2509 float4 __ovld __cnfn mix(float4 x, float4 y, float a);
2510 float8 __ovld __cnfn mix(float8 x, float8 y, float a);
2511 float16 __ovld __cnfn mix(float16 x, float16 y, float a);
2512-#ifdef cl_khr_fp64
2513+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2514 double __ovld __cnfn mix(double x, double y, double a);
2515 double2 __ovld __cnfn mix(double2 x, double2 y, double2 a);
2516 double3 __ovld __cnfn mix(double3 x, double3 y, double3 a);
2517@@ -10276,7 +10289,7 @@ double3 __ovld __cnfn mix(double3 x, double3 y, double a);
2518 double4 __ovld __cnfn mix(double4 x, double4 y, double a);
2519 double8 __ovld __cnfn mix(double8 x, double8 y, double a);
2520 double16 __ovld __cnfn mix(double16 x, double16 y, double a);
2521-#endif //cl_khr_fp64
2522+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2523 #ifdef cl_khr_fp16
2524 half __ovld __cnfn mix(half x, half y, half a);
2525 half2 __ovld __cnfn mix(half2 x, half2 y, half2 a);
2526@@ -10301,14 +10314,14 @@ float3 __ovld __cnfn radians(float3 degrees);
2527 float4 __ovld __cnfn radians(float4 degrees);
2528 float8 __ovld __cnfn radians(float8 degrees);
2529 float16 __ovld __cnfn radians(float16 degrees);
2530-#ifdef cl_khr_fp64
2531+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2532 double __ovld __cnfn radians(double degrees);
2533 double2 __ovld __cnfn radians(double2 degrees);
2534 double3 __ovld __cnfn radians(double3 degrees);
2535 double4 __ovld __cnfn radians(double4 degrees);
2536 double8 __ovld __cnfn radians(double8 degrees);
2537 double16 __ovld __cnfn radians(double16 degrees);
2538-#endif //cl_khr_fp64
2539+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2540 #ifdef cl_khr_fp16
2541 half __ovld __cnfn radians(half degrees);
2542 half2 __ovld __cnfn radians(half2 degrees);
2543@@ -10332,7 +10345,7 @@ float3 __ovld __cnfn step(float edge, float3 x);
2544 float4 __ovld __cnfn step(float edge, float4 x);
2545 float8 __ovld __cnfn step(float edge, float8 x);
2546 float16 __ovld __cnfn step(float edge, float16 x);
2547-#ifdef cl_khr_fp64
2548+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2549 double __ovld __cnfn step(double edge, double x);
2550 double2 __ovld __cnfn step(double2 edge, double2 x);
2551 double3 __ovld __cnfn step(double3 edge, double3 x);
2552@@ -10344,7 +10357,7 @@ double3 __ovld __cnfn step(double edge, double3 x);
2553 double4 __ovld __cnfn step(double edge, double4 x);
2554 double8 __ovld __cnfn step(double edge, double8 x);
2555 double16 __ovld __cnfn step(double edge, double16 x);
2556-#endif //cl_khr_fp64
2557+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2558 #ifdef cl_khr_fp16
2559 half __ovld __cnfn step(half edge, half x);
2560 half2 __ovld __cnfn step(half2 edge, half2 x);
2561@@ -10383,7 +10396,7 @@ float3 __ovld __cnfn smoothstep(float edge0, float edge1, float3 x);
2562 float4 __ovld __cnfn smoothstep(float edge0, float edge1, float4 x);
2563 float8 __ovld __cnfn smoothstep(float edge0, float edge1, float8 x);
2564 float16 __ovld __cnfn smoothstep(float edge0, float edge1, float16 x);
2565-#ifdef cl_khr_fp64
2566+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2567 double __ovld __cnfn smoothstep(double edge0, double edge1, double x);
2568 double2 __ovld __cnfn smoothstep(double2 edge0, double2 edge1, double2 x);
2569 double3 __ovld __cnfn smoothstep(double3 edge0, double3 edge1, double3 x);
2570@@ -10395,7 +10408,7 @@ double3 __ovld __cnfn smoothstep(double edge0, double edge1, double3 x);
2571 double4 __ovld __cnfn smoothstep(double edge0, double edge1, double4 x);
2572 double8 __ovld __cnfn smoothstep(double edge0, double edge1, double8 x);
2573 double16 __ovld __cnfn smoothstep(double edge0, double edge1, double16 x);
2574-#endif //cl_khr_fp64
2575+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2576 #ifdef cl_khr_fp16
2577 half __ovld __cnfn smoothstep(half edge0, half edge1, half x);
2578 half2 __ovld __cnfn smoothstep(half2 edge0, half2 edge1, half2 x);
2579@@ -10420,14 +10433,14 @@ float3 __ovld __cnfn sign(float3 x);
2580 float4 __ovld __cnfn sign(float4 x);
2581 float8 __ovld __cnfn sign(float8 x);
2582 float16 __ovld __cnfn sign(float16 x);
2583-#ifdef cl_khr_fp64
2584+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2585 double __ovld __cnfn sign(double x);
2586 double2 __ovld __cnfn sign(double2 x);
2587 double3 __ovld __cnfn sign(double3 x);
2588 double4 __ovld __cnfn sign(double4 x);
2589 double8 __ovld __cnfn sign(double8 x);
2590 double16 __ovld __cnfn sign(double16 x);
2591-#endif //cl_khr_fp64
2592+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2593 #ifdef cl_khr_fp16
2594 half __ovld __cnfn sign(half x);
2595 half2 __ovld __cnfn sign(half2 x);
2596@@ -10445,10 +10458,10 @@ half16 __ovld __cnfn sign(half16 x);
2597 */
2598 float4 __ovld __cnfn cross(float4 p0, float4 p1);
2599 float3 __ovld __cnfn cross(float3 p0, float3 p1);
2600-#ifdef cl_khr_fp64
2601+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2602 double4 __ovld __cnfn cross(double4 p0, double4 p1);
2603 double3 __ovld __cnfn cross(double3 p0, double3 p1);
2604-#endif //cl_khr_fp64
2605+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2606 #ifdef cl_khr_fp16
2607 half4 __ovld __cnfn cross(half4 p0, half4 p1);
2608 half3 __ovld __cnfn cross(half3 p0, half3 p1);
2609@@ -10461,12 +10474,12 @@ float __ovld __cnfn dot(float p0, float p1);
2610 float __ovld __cnfn dot(float2 p0, float2 p1);
2611 float __ovld __cnfn dot(float3 p0, float3 p1);
2612 float __ovld __cnfn dot(float4 p0, float4 p1);
2613-#ifdef cl_khr_fp64
2614+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2615 double __ovld __cnfn dot(double p0, double p1);
2616 double __ovld __cnfn dot(double2 p0, double2 p1);
2617 double __ovld __cnfn dot(double3 p0, double3 p1);
2618 double __ovld __cnfn dot(double4 p0, double4 p1);
2619-#endif //cl_khr_fp64
2620+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2621 #ifdef cl_khr_fp16
2622 half __ovld __cnfn dot(half p0, half p1);
2623 half __ovld __cnfn dot(half2 p0, half2 p1);
2624@@ -10482,12 +10495,12 @@ float __ovld __cnfn distance(float p0, float p1);
2625 float __ovld __cnfn distance(float2 p0, float2 p1);
2626 float __ovld __cnfn distance(float3 p0, float3 p1);
2627 float __ovld __cnfn distance(float4 p0, float4 p1);
2628-#ifdef cl_khr_fp64
2629+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2630 double __ovld __cnfn distance(double p0, double p1);
2631 double __ovld __cnfn distance(double2 p0, double2 p1);
2632 double __ovld __cnfn distance(double3 p0, double3 p1);
2633 double __ovld __cnfn distance(double4 p0, double4 p1);
2634-#endif //cl_khr_fp64
2635+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2636 #ifdef cl_khr_fp16
2637 half __ovld __cnfn distance(half p0, half p1);
2638 half __ovld __cnfn distance(half2 p0, half2 p1);
2639@@ -10503,12 +10516,12 @@ float __ovld __cnfn length(float p);
2640 float __ovld __cnfn length(float2 p);
2641 float __ovld __cnfn length(float3 p);
2642 float __ovld __cnfn length(float4 p);
2643-#ifdef cl_khr_fp64
2644+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2645 double __ovld __cnfn length(double p);
2646 double __ovld __cnfn length(double2 p);
2647 double __ovld __cnfn length(double3 p);
2648 double __ovld __cnfn length(double4 p);
2649-#endif //cl_khr_fp64
2650+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2651 #ifdef cl_khr_fp16
2652 half __ovld __cnfn length(half p);
2653 half __ovld __cnfn length(half2 p);
2654@@ -10524,12 +10537,12 @@ float __ovld __cnfn normalize(float p);
2655 float2 __ovld __cnfn normalize(float2 p);
2656 float3 __ovld __cnfn normalize(float3 p);
2657 float4 __ovld __cnfn normalize(float4 p);
2658-#ifdef cl_khr_fp64
2659+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2660 double __ovld __cnfn normalize(double p);
2661 double2 __ovld __cnfn normalize(double2 p);
2662 double3 __ovld __cnfn normalize(double3 p);
2663 double4 __ovld __cnfn normalize(double4 p);
2664-#endif //cl_khr_fp64
2665+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2666 #ifdef cl_khr_fp16
2667 half __ovld __cnfn normalize(half p);
2668 half2 __ovld __cnfn normalize(half2 p);
2669@@ -10610,14 +10623,14 @@ int3 __ovld __cnfn isequal(float3 x, float3 y);
2670 int4 __ovld __cnfn isequal(float4 x, float4 y);
2671 int8 __ovld __cnfn isequal(float8 x, float8 y);
2672 int16 __ovld __cnfn isequal(float16 x, float16 y);
2673-#ifdef cl_khr_fp64
2674+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2675 int __ovld __cnfn isequal(double x, double y);
2676 long2 __ovld __cnfn isequal(double2 x, double2 y);
2677 long3 __ovld __cnfn isequal(double3 x, double3 y);
2678 long4 __ovld __cnfn isequal(double4 x, double4 y);
2679 long8 __ovld __cnfn isequal(double8 x, double8 y);
2680 long16 __ovld __cnfn isequal(double16 x, double16 y);
2681-#endif //cl_khr_fp64
2682+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2683 #ifdef cl_khr_fp16
2684 int __ovld __cnfn isequal(half x, half y);
2685 short2 __ovld __cnfn isequal(half2 x, half2 y);
2686@@ -10636,14 +10649,14 @@ int3 __ovld __cnfn isnotequal(float3 x, float3 y);
2687 int4 __ovld __cnfn isnotequal(float4 x, float4 y);
2688 int8 __ovld __cnfn isnotequal(float8 x, float8 y);
2689 int16 __ovld __cnfn isnotequal(float16 x, float16 y);
2690-#ifdef cl_khr_fp64
2691+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2692 int __ovld __cnfn isnotequal(double x, double y);
2693 long2 __ovld __cnfn isnotequal(double2 x, double2 y);
2694 long3 __ovld __cnfn isnotequal(double3 x, double3 y);
2695 long4 __ovld __cnfn isnotequal(double4 x, double4 y);
2696 long8 __ovld __cnfn isnotequal(double8 x, double8 y);
2697 long16 __ovld __cnfn isnotequal(double16 x, double16 y);
2698-#endif //cl_khr_fp64
2699+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2700 #ifdef cl_khr_fp16
2701 int __ovld __cnfn isnotequal(half x, half y);
2702 short2 __ovld __cnfn isnotequal(half2 x, half2 y);
2703@@ -10662,14 +10675,14 @@ int3 __ovld __cnfn isgreater(float3 x, float3 y);
2704 int4 __ovld __cnfn isgreater(float4 x, float4 y);
2705 int8 __ovld __cnfn isgreater(float8 x, float8 y);
2706 int16 __ovld __cnfn isgreater(float16 x, float16 y);
2707-#ifdef cl_khr_fp64
2708+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2709 int __ovld __cnfn isgreater(double x, double y);
2710 long2 __ovld __cnfn isgreater(double2 x, double2 y);
2711 long3 __ovld __cnfn isgreater(double3 x, double3 y);
2712 long4 __ovld __cnfn isgreater(double4 x, double4 y);
2713 long8 __ovld __cnfn isgreater(double8 x, double8 y);
2714 long16 __ovld __cnfn isgreater(double16 x, double16 y);
2715-#endif //cl_khr_fp64
2716+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2717 #ifdef cl_khr_fp16
2718 int __ovld __cnfn isgreater(half x, half y);
2719 short2 __ovld __cnfn isgreater(half2 x, half2 y);
2720@@ -10688,14 +10701,14 @@ int3 __ovld __cnfn isgreaterequal(float3 x, float3 y);
2721 int4 __ovld __cnfn isgreaterequal(float4 x, float4 y);
2722 int8 __ovld __cnfn isgreaterequal(float8 x, float8 y);
2723 int16 __ovld __cnfn isgreaterequal(float16 x, float16 y);
2724-#ifdef cl_khr_fp64
2725+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2726 int __ovld __cnfn isgreaterequal(double x, double y);
2727 long2 __ovld __cnfn isgreaterequal(double2 x, double2 y);
2728 long3 __ovld __cnfn isgreaterequal(double3 x, double3 y);
2729 long4 __ovld __cnfn isgreaterequal(double4 x, double4 y);
2730 long8 __ovld __cnfn isgreaterequal(double8 x, double8 y);
2731 long16 __ovld __cnfn isgreaterequal(double16 x, double16 y);
2732-#endif //cl_khr_fp64
2733+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2734 #ifdef cl_khr_fp16
2735 int __ovld __cnfn isgreaterequal(half x, half y);
2736 short2 __ovld __cnfn isgreaterequal(half2 x, half2 y);
2737@@ -10714,14 +10727,14 @@ int3 __ovld __cnfn isless(float3 x, float3 y);
2738 int4 __ovld __cnfn isless(float4 x, float4 y);
2739 int8 __ovld __cnfn isless(float8 x, float8 y);
2740 int16 __ovld __cnfn isless(float16 x, float16 y);
2741-#ifdef cl_khr_fp64
2742+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2743 int __ovld __cnfn isless(double x, double y);
2744 long2 __ovld __cnfn isless(double2 x, double2 y);
2745 long3 __ovld __cnfn isless(double3 x, double3 y);
2746 long4 __ovld __cnfn isless(double4 x, double4 y);
2747 long8 __ovld __cnfn isless(double8 x, double8 y);
2748 long16 __ovld __cnfn isless(double16 x, double16 y);
2749-#endif //cl_khr_fp64
2750+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2751 #ifdef cl_khr_fp16
2752 int __ovld __cnfn isless(half x, half y);
2753 short2 __ovld __cnfn isless(half2 x, half2 y);
2754@@ -10740,14 +10753,14 @@ int3 __ovld __cnfn islessequal(float3 x, float3 y);
2755 int4 __ovld __cnfn islessequal(float4 x, float4 y);
2756 int8 __ovld __cnfn islessequal(float8 x, float8 y);
2757 int16 __ovld __cnfn islessequal(float16 x, float16 y);
2758-#ifdef cl_khr_fp64
2759+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2760 int __ovld __cnfn islessequal(double x, double y);
2761 long2 __ovld __cnfn islessequal(double2 x, double2 y);
2762 long3 __ovld __cnfn islessequal(double3 x, double3 y);
2763 long4 __ovld __cnfn islessequal(double4 x, double4 y);
2764 long8 __ovld __cnfn islessequal(double8 x, double8 y);
2765 long16 __ovld __cnfn islessequal(double16 x, double16 y);
2766-#endif //cl_khr_fp64
2767+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2768 #ifdef cl_khr_fp16
2769 int __ovld __cnfn islessequal(half x, half y);
2770 short2 __ovld __cnfn islessequal(half2 x, half2 y);
2771@@ -10767,14 +10780,14 @@ int3 __ovld __cnfn islessgreater(float3 x, float3 y);
2772 int4 __ovld __cnfn islessgreater(float4 x, float4 y);
2773 int8 __ovld __cnfn islessgreater(float8 x, float8 y);
2774 int16 __ovld __cnfn islessgreater(float16 x, float16 y);
2775-#ifdef cl_khr_fp64
2776+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2777 int __ovld __cnfn islessgreater(double x, double y);
2778 long2 __ovld __cnfn islessgreater(double2 x, double2 y);
2779 long3 __ovld __cnfn islessgreater(double3 x, double3 y);
2780 long4 __ovld __cnfn islessgreater(double4 x, double4 y);
2781 long8 __ovld __cnfn islessgreater(double8 x, double8 y);
2782 long16 __ovld __cnfn islessgreater(double16 x, double16 y);
2783-#endif //cl_khr_fp64
2784+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2785 #ifdef cl_khr_fp16
2786 int __ovld __cnfn islessgreater(half x, half y);
2787 short2 __ovld __cnfn islessgreater(half2 x, half2 y);
2788@@ -10793,14 +10806,14 @@ int3 __ovld __cnfn isfinite(float3);
2789 int4 __ovld __cnfn isfinite(float4);
2790 int8 __ovld __cnfn isfinite(float8);
2791 int16 __ovld __cnfn isfinite(float16);
2792-#ifdef cl_khr_fp64
2793+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2794 int __ovld __cnfn isfinite(double);
2795 long2 __ovld __cnfn isfinite(double2);
2796 long3 __ovld __cnfn isfinite(double3);
2797 long4 __ovld __cnfn isfinite(double4);
2798 long8 __ovld __cnfn isfinite(double8);
2799 long16 __ovld __cnfn isfinite(double16);
2800-#endif //cl_khr_fp64
2801+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2802 #ifdef cl_khr_fp16
2803 int __ovld __cnfn isfinite(half);
2804 short2 __ovld __cnfn isfinite(half2);
2805@@ -10819,14 +10832,14 @@ int3 __ovld __cnfn isinf(float3);
2806 int4 __ovld __cnfn isinf(float4);
2807 int8 __ovld __cnfn isinf(float8);
2808 int16 __ovld __cnfn isinf(float16);
2809-#ifdef cl_khr_fp64
2810+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2811 int __ovld __cnfn isinf(double);
2812 long2 __ovld __cnfn isinf(double2);
2813 long3 __ovld __cnfn isinf(double3);
2814 long4 __ovld __cnfn isinf(double4);
2815 long8 __ovld __cnfn isinf(double8);
2816 long16 __ovld __cnfn isinf(double16);
2817-#endif //cl_khr_fp64
2818+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2819 #ifdef cl_khr_fp16
2820 int __ovld __cnfn isinf(half);
2821 short2 __ovld __cnfn isinf(half2);
2822@@ -10845,14 +10858,14 @@ int3 __ovld __cnfn isnan(float3);
2823 int4 __ovld __cnfn isnan(float4);
2824 int8 __ovld __cnfn isnan(float8);
2825 int16 __ovld __cnfn isnan(float16);
2826-#ifdef cl_khr_fp64
2827+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2828 int __ovld __cnfn isnan(double);
2829 long2 __ovld __cnfn isnan(double2);
2830 long3 __ovld __cnfn isnan(double3);
2831 long4 __ovld __cnfn isnan(double4);
2832 long8 __ovld __cnfn isnan(double8);
2833 long16 __ovld __cnfn isnan(double16);
2834-#endif //cl_khr_fp64
2835+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2836 #ifdef cl_khr_fp16
2837 int __ovld __cnfn isnan(half);
2838 short2 __ovld __cnfn isnan(half2);
2839@@ -10871,14 +10884,14 @@ int3 __ovld __cnfn isnormal(float3);
2840 int4 __ovld __cnfn isnormal(float4);
2841 int8 __ovld __cnfn isnormal(float8);
2842 int16 __ovld __cnfn isnormal(float16);
2843-#ifdef cl_khr_fp64
2844+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2845 int __ovld __cnfn isnormal(double);
2846 long2 __ovld __cnfn isnormal(double2);
2847 long3 __ovld __cnfn isnormal(double3);
2848 long4 __ovld __cnfn isnormal(double4);
2849 long8 __ovld __cnfn isnormal(double8);
2850 long16 __ovld __cnfn isnormal(double16);
2851-#endif //cl_khr_fp64
2852+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2853 #ifdef cl_khr_fp16
2854 int __ovld __cnfn isnormal(half);
2855 short2 __ovld __cnfn isnormal(half2);
2856@@ -10899,14 +10912,14 @@ int3 __ovld __cnfn isordered(float3 x, float3 y);
2857 int4 __ovld __cnfn isordered(float4 x, float4 y);
2858 int8 __ovld __cnfn isordered(float8 x, float8 y);
2859 int16 __ovld __cnfn isordered(float16 x, float16 y);
2860-#ifdef cl_khr_fp64
2861+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2862 int __ovld __cnfn isordered(double x, double y);
2863 long2 __ovld __cnfn isordered(double2 x, double2 y);
2864 long3 __ovld __cnfn isordered(double3 x, double3 y);
2865 long4 __ovld __cnfn isordered(double4 x, double4 y);
2866 long8 __ovld __cnfn isordered(double8 x, double8 y);
2867 long16 __ovld __cnfn isordered(double16 x, double16 y);
2868-#endif //cl_khr_fp64
2869+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2870 #ifdef cl_khr_fp16
2871 int __ovld __cnfn isordered(half x, half y);
2872 short2 __ovld __cnfn isordered(half2 x, half2 y);
2873@@ -10927,14 +10940,14 @@ int3 __ovld __cnfn isunordered(float3 x, float3 y);
2874 int4 __ovld __cnfn isunordered(float4 x, float4 y);
2875 int8 __ovld __cnfn isunordered(float8 x, float8 y);
2876 int16 __ovld __cnfn isunordered(float16 x, float16 y);
2877-#ifdef cl_khr_fp64
2878+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2879 int __ovld __cnfn isunordered(double x, double y);
2880 long2 __ovld __cnfn isunordered(double2 x, double2 y);
2881 long3 __ovld __cnfn isunordered(double3 x, double3 y);
2882 long4 __ovld __cnfn isunordered(double4 x, double4 y);
2883 long8 __ovld __cnfn isunordered(double8 x, double8 y);
2884 long16 __ovld __cnfn isunordered(double16 x, double16 y);
2885-#endif //cl_khr_fp64
2886+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2887 #ifdef cl_khr_fp16
2888 int __ovld __cnfn isunordered(half x, half y);
2889 short2 __ovld __cnfn isunordered(half2 x, half2 y);
2890@@ -10957,14 +10970,14 @@ int3 __ovld __cnfn signbit(float3);
2891 int4 __ovld __cnfn signbit(float4);
2892 int8 __ovld __cnfn signbit(float8);
2893 int16 __ovld __cnfn signbit(float16);
2894-#ifdef cl_khr_fp64
2895+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2896 int __ovld __cnfn signbit(double);
2897 long2 __ovld __cnfn signbit(double2);
2898 long3 __ovld __cnfn signbit(double3);
2899 long4 __ovld __cnfn signbit(double4);
2900 long8 __ovld __cnfn signbit(double8);
2901 long16 __ovld __cnfn signbit(double16);
2902-#endif //cl_khr_fp64
2903+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2904 #ifdef cl_khr_fp16