https://github.com/lamb-j created
https://github.com/llvm/llvm-project/pull/175993
Reverts llvm/llvm-project#175120
llvm-project/amd/device-libs/opencl/src/image/imwrap.cl:461:1: error: no
matching function for call to 'get_image_height'
461 | GD2GEN(_2Dad)
| ^~~~~~~~~~~~~
llvm-project/amd/device-libs/opencl/src/image/imwrap.cl:460:1: error: no
matching function for call to 'get_image_width'
460 | GD2GEN(_2Dd)
| ^~~~~~~~~~~~
"Depth images are required with other image support for OpenCL 2.0."
>From 2166ceb4da36b66e3e85fe79ebc411fddfafd96a Mon Sep 17 00:00:00 2001
From: Jacob Lambert <[email protected]>
Date: Wed, 14 Jan 2026 09:15:40 -0800
Subject: [PATCH] Revert "[OpenCL] Set KHR extensions minimum version to OpenCL
1.0 (#175120)"
This reverts commit 386d9399731d28532e38b9820f3a44a9cfbead77.
---
.../include/clang/Basic/OpenCLExtensions.def | 40 ++--
clang/lib/Headers/opencl-c-base.h | 7 -
clang/lib/Headers/opencl-c.h | 219 +++++++-----------
clang/lib/Sema/OpenCLBuiltins.td | 2 +-
clang/test/Headers/opencl-c-header.cl | 152 ++++--------
clang/test/Misc/amdgcn.languageOptsOpenCL.cl | 4 +-
clang/test/SemaOpenCL/extension-version.cl | 40 ++--
.../SemaOpenCL/fdeclare-opencl-builtins.cl | 190 ++-------------
8 files changed, 193 insertions(+), 461 deletions(-)
diff --git a/clang/include/clang/Basic/OpenCLExtensions.def
b/clang/include/clang/Basic/OpenCLExtensions.def
index d6c0b585d1809..3abc0279de791 100644
--- a/clang/include/clang/Basic/OpenCLExtensions.def
+++ b/clang/include/clang/Basic/OpenCLExtensions.def
@@ -68,31 +68,33 @@ OPENCL_OPTIONALCOREFEATURE(cl_khr_fp64, true, 100,
OCL_C_12P)
OPENCL_EXTENSION(cl_khr_fp16, true, 100)
OPENCL_EXTENSION(cl_khr_int64_base_atomics, true, 100)
OPENCL_EXTENSION(cl_khr_int64_extended_atomics, true, 100)
-OPENCL_EXTENSION(cl_khr_depth_images, true, 100)
-OPENCL_EXTENSION(cl_khr_extended_bit_ops, false, 100)
-OPENCL_EXTENSION(cl_ext_float_atomics, false, 100)
OPENCL_EXTENSION(cl_khr_gl_msaa_sharing, true, 100)
-OPENCL_EXTENSION(cl_khr_integer_dot_product, false, 100)
-OPENCL_EXTENSION(cl_khr_kernel_clock, false, 100)
-OPENCL_EXTENSION(cl_khr_mipmap_image, true, 100)
-OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 100)
-OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_shuffle_relative, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroup_shuffle, false, 100)
-OPENCL_EXTENSION(cl_khr_subgroups, true, 100)
OPENCL_GENERIC_EXTENSION(cl_khr_3d_image_writes, true, 100, OCL_C_20, OCL_C_30)
// EMBEDDED_PROFILE
-OPENCL_EXTENSION(cles_khr_int64, true, 100)
+OPENCL_EXTENSION(cles_khr_int64, true, 110)
+
+// OpenCL 1.2.
+OPENCL_EXTENSION(cl_khr_depth_images, true, 120)
// OpenCL 2.0.
+OPENCL_EXTENSION(cl_ext_float_atomics, false, 200)
+OPENCL_EXTENSION(cl_khr_extended_bit_ops, false, 200)
+OPENCL_EXTENSION(cl_khr_integer_dot_product, false, 200)
+OPENCL_EXTENSION(cl_khr_kernel_clock, false, 200)
+OPENCL_EXTENSION(cl_khr_mipmap_image, true, 200)
+OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 200)
+OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_shuffle_relative, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroup_shuffle, false, 200)
+OPENCL_EXTENSION(cl_khr_subgroups, true, 200)
OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_order_acq_rel, false, 200,
OCL_C_20, OCL_C_30)
OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_order_seq_cst, false, 200,
OCL_C_20, OCL_C_30)
OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_scope_all_devices, false, 200,
OCL_C_20, OCL_C_30)
diff --git a/clang/lib/Headers/opencl-c-base.h
b/clang/lib/Headers/opencl-c-base.h
index 5e24aa60b8d7f..898026c66614a 100644
--- a/clang/lib/Headers/opencl-c-base.h
+++ b/clang/lib/Headers/opencl-c-base.h
@@ -20,13 +20,6 @@
#define __opencl_subgroup_builtins 1
#endif
-#if defined(cl_khr_depth_images) || defined(__OPENCL_CPP_VERSION__) ||
\
- (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-// Internal feature macro to provide depth image builtins.
-#define __opencl_depth_image_builtins 1
-#endif // defined(cl_khr_depth_images) || defined(__OPENCL_CPP_VERSION__) ||
- // (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
// built-in scalar data types:
/**
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index f4c7dbae2a00c..8c19f0f72f6c8 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -15199,8 +15199,8 @@ float4 __ovld __purefn read_imagef(read_only
image2d_array_t, sampler_t, float4)
int4 __ovld __purefn read_imagei(read_only image2d_array_t, sampler_t, int4);
int4 __ovld __purefn read_imagei(read_only image2d_array_t, sampler_t, float4);
uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t, int4);
-uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t,
- float4);
+uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t,
float4);
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_only image1d_t, sampler_t, int);
float4 __ovld __purefn read_imagef(read_only image1d_t, sampler_t, float);
@@ -15210,6 +15210,7 @@ int4 __ovld __purefn read_imagei(read_only image1d_t,
sampler_t, float);
uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, int);
uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, float);
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_only image1d_array_t, sampler_t, int2);
float4 __ovld __purefn read_imagef(read_only image1d_array_t, sampler_t,
float2);
@@ -15219,13 +15220,13 @@ uint4 __ovld __purefn read_imageui(read_only
image1d_array_t, sampler_t, int2);
uint4 __ovld __purefn read_imageui(read_only image1d_array_t, sampler_t,
float2);
#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
CL_VERSION_1_2)
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
float __ovld __purefn read_imagef(read_only image2d_depth_t, sampler_t,
float2);
float __ovld __purefn read_imagef(read_only image2d_depth_t, sampler_t, int2);
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, sampler_t,
float4);
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, sampler_t,
int4);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
float4 __ovld __purefn read_imagef(read_only image2d_msaa_t, int2, int);
@@ -15242,10 +15243,9 @@ float __ovld __purefn read_imagef(read_only
image2d_array_msaa_depth_t, int4, in
#endif //cl_khr_gl_msaa_sharing
// OpenCL Extension v2.0 s9.18 - Mipmaps
-#if defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
#ifdef cl_khr_mipmap_image
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image1d_t, sampler_t, float,
float);
int4 __ovld __purefn read_imagei(read_only image1d_t, sampler_t, float, float);
uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, float,
float);
@@ -15253,31 +15253,27 @@ uint4 __ovld __purefn read_imageui(read_only
image1d_t, sampler_t, float, float)
float4 __ovld __purefn read_imagef(read_only image1d_array_t, sampler_t,
float2, float);
int4 __ovld __purefn read_imagei(read_only image1d_array_t, sampler_t, float2,
float);
uint4 __ovld __purefn read_imageui(read_only image1d_array_t, sampler_t,
float2, float);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image2d_t, sampler_t, float2,
float);
int4 __ovld __purefn read_imagei(read_only image2d_t, sampler_t, float2,
float);
uint4 __ovld __purefn read_imageui(read_only image2d_t, sampler_t, float2,
float);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
float __ovld __purefn read_imagef(read_only image2d_depth_t, sampler_t,
float2, float);
-#endif // defined(__opencl_depth_image_builtins)
+#endif // cl_khr_depth_images
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image2d_array_t, sampler_t,
float4, float);
int4 __ovld __purefn read_imagei(read_only image2d_array_t, sampler_t, float4,
float);
uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t,
float4, float);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, sampler_t,
float4, float);
-#endif // defined(__opencl_depth_image_builtins)
+#endif // cl_khr_depth_images
float4 __ovld __purefn read_imagef(read_only image3d_t, sampler_t, float4,
float);
int4 __ovld __purefn read_imagei(read_only image3d_t, sampler_t, float4,
float);
uint4 __ovld __purefn read_imageui(read_only image3d_t, sampler_t, float4,
float);
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image1d_t, sampler_t, float,
float, float);
int4 __ovld __purefn read_imagei(read_only image1d_t, sampler_t, float, float,
float);
uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, float,
float, float);
@@ -15285,34 +15281,31 @@ uint4 __ovld __purefn read_imageui(read_only
image1d_t, sampler_t, float, float,
float4 __ovld __purefn read_imagef(read_only image1d_array_t, sampler_t,
float2, float, float);
int4 __ovld __purefn read_imagei(read_only image1d_array_t, sampler_t, float2,
float, float);
uint4 __ovld __purefn read_imageui(read_only image1d_array_t, sampler_t,
float2, float, float);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image2d_t, sampler_t, float2,
float2, float2);
int4 __ovld __purefn read_imagei(read_only image2d_t, sampler_t, float2,
float2, float2);
uint4 __ovld __purefn read_imageui(read_only image2d_t, sampler_t, float2,
float2, float2);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
float __ovld __purefn read_imagef(read_only image2d_depth_t, sampler_t,
float2, float2, float2);
-#endif // defined(__opencl_depth_image_builtins)
+#endif // cl_khr_depth_images
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image2d_array_t, sampler_t,
float4, float2, float2);
int4 __ovld __purefn read_imagei(read_only image2d_array_t, sampler_t, float4,
float2, float2);
uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t,
float4, float2, float2);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, sampler_t,
float4, float2, float2);
-#endif // defined(__opencl_depth_image_builtins)
+#endif // cl_khr_depth_images
float4 __ovld __purefn read_imagef(read_only image3d_t, sampler_t, float4,
float4, float4);
int4 __ovld __purefn read_imagei(read_only image3d_t, sampler_t, float4,
float4, float4);
uint4 __ovld __purefn read_imageui(read_only image3d_t, sampler_t, float4,
float4, float4);
#endif //cl_khr_mipmap_image
-#endif // defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
+#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
CL_VERSION_2_0)
-#if defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
/**
* Sampler-less Image Access
@@ -15338,39 +15331,36 @@ float4 __ovld __purefn read_imagef(read_only
image2d_array_t, int4);
int4 __ovld __purefn read_imagei(read_only image2d_array_t, int4);
uint4 __ovld __purefn read_imageui(read_only image2d_array_t, int4);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
float __ovld __purefn read_imagef(read_only image2d_depth_t, int2);
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, int4);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
float4 __ovld __purefn read_imagef(read_only image3d_t, int4);
int4 __ovld __purefn read_imagei(read_only image3d_t, int4);
uint4 __ovld __purefn read_imageui(read_only image3d_t, int4);
-#endif // defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
CL_VERSION_1_2)
// Image read functions returning half4 type
#ifdef cl_khr_fp16
+half4 __ovld __purefn read_imageh(read_only image1d_t, sampler_t, int);
+half4 __ovld __purefn read_imageh(read_only image1d_t, sampler_t, float);
half4 __ovld __purefn read_imageh(read_only image2d_t, sampler_t, int2);
half4 __ovld __purefn read_imageh(read_only image2d_t, sampler_t, float2);
half4 __ovld __purefn read_imageh(read_only image3d_t, sampler_t, int4);
half4 __ovld __purefn read_imageh(read_only image3d_t, sampler_t, float4);
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
-half4 __ovld __purefn read_imageh(read_only image1d_t, sampler_t, int);
-half4 __ovld __purefn read_imageh(read_only image1d_t, sampler_t, float);
half4 __ovld __purefn read_imageh(read_only image1d_array_t, sampler_t, int2);
half4 __ovld __purefn read_imageh(read_only image1d_array_t, sampler_t,
float2);
half4 __ovld __purefn read_imageh(read_only image2d_array_t, sampler_t, int4);
half4 __ovld __purefn read_imageh(read_only image2d_array_t, sampler_t,
float4);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
- // CL_VERSION_1_2)
/**
* Sampler-less Image Access
*/
+half4 __ovld __purefn read_imageh(read_only image1d_t, int);
half4 __ovld __purefn read_imageh(read_only image2d_t, int2);
half4 __ovld __purefn read_imageh(read_only image3d_t, int4);
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
-half4 __ovld __purefn read_imageh(read_only image1d_t, int);
half4 __ovld __purefn read_imageh(read_only image1d_array_t, int2);
half4 __ovld __purefn read_imageh(read_only image2d_array_t, int4);
half4 __ovld __purefn read_imageh(read_only image1d_buffer_t, int);
@@ -15405,10 +15395,10 @@ int4 __ovld __purefn read_imagei(read_write
image3d_t, int4);
uint4 __ovld __purefn read_imageui(read_write image3d_t, int4);
#endif // cl_khr_3d_image_writes
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
float __ovld __purefn read_imagef(read_write image2d_depth_t, int2);
float __ovld __purefn read_imagef(read_write image2d_array_depth_t, int4);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if cl_khr_gl_msaa_sharing
float4 __ovld __purefn read_imagef(read_write image2d_msaa_t, int2, int);
@@ -15424,7 +15414,6 @@ float __ovld __purefn read_imagef(read_write
image2d_array_msaa_depth_t, int4, i
#endif //cl_khr_gl_msaa_sharing
#ifdef cl_khr_mipmap_image
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image1d_t, sampler_t, float,
float);
int4 __ovld __purefn read_imagei(read_write image1d_t, sampler_t, float,
float);
uint4 __ovld __purefn read_imageui(read_write image1d_t, sampler_t, float,
float);
@@ -15432,27 +15421,18 @@ uint4 __ovld __purefn read_imageui(read_write
image1d_t, sampler_t, float, float
float4 __ovld __purefn read_imagef(read_write image1d_array_t, sampler_t,
float2, float);
int4 __ovld __purefn read_imagei(read_write image1d_array_t, sampler_t,
float2, float);
uint4 __ovld __purefn read_imageui(read_write image1d_array_t, sampler_t,
float2, float);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
- // CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image2d_t, sampler_t, float2,
float);
int4 __ovld __purefn read_imagei(read_write image2d_t, sampler_t, float2,
float);
uint4 __ovld __purefn read_imageui(read_write image2d_t, sampler_t, float2,
float);
-#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_depth_t, sampler_t,
float2, float);
-#endif // defined(__opencl_depth_image_builtins)
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image2d_array_t, sampler_t,
float4, float);
int4 __ovld __purefn read_imagei(read_write image2d_array_t, sampler_t,
float4, float);
uint4 __ovld __purefn read_imageui(read_write image2d_array_t, sampler_t,
float4, float);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
- // CL_VERSION_1_2)
-#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_array_depth_t, sampler_t,
float4, float);
-#endif // defined(__opencl_depth_image_builtins)
#ifdef cl_khr_3d_image_writes
float4 __ovld __purefn read_imagef(read_write image3d_t, sampler_t, float4,
float);
@@ -15460,7 +15440,6 @@ int4 __ovld __purefn read_imagei(read_write image3d_t,
sampler_t, float4, float)
uint4 __ovld __purefn read_imageui(read_write image3d_t, sampler_t, float4,
float);
#endif // cl_khr_3d_image_writes
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image1d_t, sampler_t, float,
float, float);
int4 __ovld __purefn read_imagei(read_write image1d_t, sampler_t, float,
float, float);
uint4 __ovld __purefn read_imageui(read_write image1d_t, sampler_t, float,
float, float);
@@ -15468,27 +15447,18 @@ uint4 __ovld __purefn read_imageui(read_write
image1d_t, sampler_t, float, float
float4 __ovld __purefn read_imagef(read_write image1d_array_t, sampler_t,
float2, float, float);
int4 __ovld __purefn read_imagei(read_write image1d_array_t, sampler_t,
float2, float, float);
uint4 __ovld __purefn read_imageui(read_write image1d_array_t, sampler_t,
float2, float, float);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
- // CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image2d_t, sampler_t, float2,
float2, float2);
int4 __ovld __purefn read_imagei(read_write image2d_t, sampler_t, float2,
float2, float2);
uint4 __ovld __purefn read_imageui(read_write image2d_t, sampler_t, float2,
float2, float2);
-#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_depth_t, sampler_t,
float2, float2, float2);
-#endif // defined(__opencl_depth_image_builtins)
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image2d_array_t, sampler_t,
float4, float2, float2);
int4 __ovld __purefn read_imagei(read_write image2d_array_t, sampler_t,
float4, float2, float2);
uint4 __ovld __purefn read_imageui(read_write image2d_array_t, sampler_t,
float4, float2, float2);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
- // CL_VERSION_1_2)
-#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_array_depth_t, sampler_t,
float4, float2, float2);
-#endif // defined(__opencl_depth_image_builtins)
#ifdef cl_khr_3d_image_writes
float4 __ovld __purefn read_imagef(read_write image3d_t, sampler_t, float4,
float4, float4);
@@ -15604,14 +15574,14 @@ void __ovld write_imagei(write_only image3d_t, int4,
int4);
void __ovld write_imageui(write_only image3d_t, int4, uint4);
#endif
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
void __ovld write_imagef(write_only image2d_depth_t, int2, float);
void __ovld write_imagef(write_only image2d_array_depth_t, int4, float);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
// OpenCL Extension v2.0 s9.18 - Mipmaps
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
#if defined(cl_khr_mipmap_image_writes)
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
void __ovld write_imagef(write_only image1d_t, int, int, float4);
void __ovld write_imagei(write_only image1d_t, int, int, int4);
void __ovld write_imageui(write_only image1d_t, int, int, uint4);
@@ -15620,20 +15590,16 @@ void __ovld write_imagef(write_only image1d_array_t,
int2, int, float4);
void __ovld write_imagei(write_only image1d_array_t, int2, int, int4);
void __ovld write_imageui(write_only image1d_array_t, int2, int, uint4);
-void __ovld write_imagef(write_only image2d_array_t, int4, int, float4);
-void __ovld write_imagei(write_only image2d_array_t, int4, int, int4);
-void __ovld write_imageui(write_only image2d_array_t, int4, int, uint4);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
- // CL_VERSION_1_2)
-
void __ovld write_imagef(write_only image2d_t, int2, int, float4);
void __ovld write_imagei(write_only image2d_t, int2, int, int4);
void __ovld write_imageui(write_only image2d_t, int2, int, uint4);
-#if defined(__opencl_depth_image_builtins)
+void __ovld write_imagef(write_only image2d_array_t, int4, int, float4);
+void __ovld write_imagei(write_only image2d_array_t, int4, int, int4);
+void __ovld write_imageui(write_only image2d_array_t, int4, int, uint4);
+
void __ovld write_imagef(write_only image2d_depth_t, int2, int, float);
void __ovld write_imagef(write_only image2d_array_depth_t, int4, int, float);
-#endif // defined(__opencl_depth_image_builtins)
#ifdef cl_khr_3d_image_writes
void __ovld write_imagef(write_only image3d_t, int4, int, float4);
@@ -15641,7 +15607,8 @@ void __ovld write_imagei(write_only image3d_t, int4,
int, int4);
void __ovld write_imageui(write_only image3d_t, int4, int, uint4);
#endif //cl_khr_3d_image_writes
-#endif // defined(cl_khr_mipmap_image_writes)
+#endif //defined(cl_khr_mipmap_image_writes)
+#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
CL_VERSION_2_0)
// Image write functions for half4 type
#ifdef cl_khr_fp16
@@ -15683,13 +15650,12 @@ void __ovld write_imagei(read_write image3d_t, int4,
int4);
void __ovld write_imageui(read_write image3d_t, int4, uint4);
#endif
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
void __ovld write_imagef(read_write image2d_depth_t, int2, float);
void __ovld write_imagef(read_write image2d_array_depth_t, int4, float);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_mipmap_image_writes)
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
void __ovld write_imagef(read_write image1d_t, int, int, float4);
void __ovld write_imagei(read_write image1d_t, int, int, int4);
void __ovld write_imageui(read_write image1d_t, int, int, uint4);
@@ -15698,20 +15664,16 @@ void __ovld write_imagef(read_write image1d_array_t,
int2, int, float4);
void __ovld write_imagei(read_write image1d_array_t, int2, int, int4);
void __ovld write_imageui(read_write image1d_array_t, int2, int, uint4);
-void __ovld write_imagef(read_write image2d_array_t, int4, int, float4);
-void __ovld write_imagei(read_write image2d_array_t, int4, int, int4);
-void __ovld write_imageui(read_write image2d_array_t, int4, int, uint4);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
- // CL_VERSION_1_2)
-
void __ovld write_imagef(read_write image2d_t, int2, int, float4);
void __ovld write_imagei(read_write image2d_t, int2, int, int4);
void __ovld write_imageui(read_write image2d_t, int2, int, uint4);
-#if defined(__opencl_depth_image_builtins)
+void __ovld write_imagef(read_write image2d_array_t, int4, int, float4);
+void __ovld write_imagei(read_write image2d_array_t, int4, int, int4);
+void __ovld write_imageui(read_write image2d_array_t, int4, int, uint4);
+
void __ovld write_imagef(read_write image2d_depth_t, int2, int, float);
void __ovld write_imagef(read_write image2d_array_depth_t, int4, int, float);
-#endif // defined(__opencl_depth_image_builtins)
#ifdef cl_khr_3d_image_writes
void __ovld write_imagef(read_write image3d_t, int4, int, float4);
@@ -15748,10 +15710,10 @@ int __ovld __cnfn get_image_width(read_only
image2d_t);
int __ovld __cnfn get_image_width(read_only image3d_t);
int __ovld __cnfn get_image_width(read_only image1d_array_t);
int __ovld __cnfn get_image_width(read_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_width(read_only image2d_depth_t);
int __ovld __cnfn get_image_width(read_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_width(read_only image2d_msaa_t);
int __ovld __cnfn get_image_width(read_only image2d_msaa_depth_t);
@@ -15767,10 +15729,10 @@ int __ovld __cnfn get_image_width(write_only
image3d_t);
#endif
int __ovld __cnfn get_image_width(write_only image1d_array_t);
int __ovld __cnfn get_image_width(write_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_width(write_only image2d_depth_t);
int __ovld __cnfn get_image_width(write_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_width(write_only image2d_msaa_t);
int __ovld __cnfn get_image_width(write_only image2d_msaa_depth_t);
@@ -15787,10 +15749,10 @@ int __ovld __cnfn get_image_width(read_write
image3d_t);
#endif // cl_khr_3d_image_writes
int __ovld __cnfn get_image_width(read_write image1d_array_t);
int __ovld __cnfn get_image_width(read_write image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_width(read_write image2d_depth_t);
int __ovld __cnfn get_image_width(read_write image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_width(read_write image2d_msaa_t);
int __ovld __cnfn get_image_width(read_write image2d_msaa_depth_t);
@@ -15805,10 +15767,10 @@ int __ovld __cnfn get_image_width(read_write
image2d_array_msaa_depth_t);
int __ovld __cnfn get_image_height(read_only image2d_t);
int __ovld __cnfn get_image_height(read_only image3d_t);
int __ovld __cnfn get_image_height(read_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_height(read_only image2d_depth_t);
int __ovld __cnfn get_image_height(read_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_height(read_only image2d_msaa_t);
int __ovld __cnfn get_image_height(read_only image2d_msaa_depth_t);
@@ -15821,10 +15783,10 @@ int __ovld __cnfn get_image_height(write_only
image2d_t);
int __ovld __cnfn get_image_height(write_only image3d_t);
#endif
int __ovld __cnfn get_image_height(write_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_height(write_only image2d_depth_t);
int __ovld __cnfn get_image_height(write_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_height(write_only image2d_msaa_t);
int __ovld __cnfn get_image_height(write_only image2d_msaa_depth_t);
@@ -15838,10 +15800,10 @@ int __ovld __cnfn get_image_height(read_write
image2d_t);
int __ovld __cnfn get_image_height(read_write image3d_t);
#endif // cl_khr_3d_image_writes
int __ovld __cnfn get_image_height(read_write image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_height(read_write image2d_depth_t);
int __ovld __cnfn get_image_height(read_write image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_height(read_write image2d_msaa_t);
int __ovld __cnfn get_image_height(read_write image2d_msaa_depth_t);
@@ -15863,22 +15825,18 @@ int __ovld __cnfn get_image_depth(read_write
image3d_t);
#endif //defined(__opencl_c_read_write_images)
#endif // cl_khr_3d_image_writes
-// OpenCL Extension - Mipmaps
-#if defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
+// OpenCL Extension v2.0 s9.18 - Mipmaps
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
#ifdef cl_khr_mipmap_image
/**
* Return the image miplevels.
*/
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(read_only image1d_t);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(read_only image2d_t);
int __ovld get_image_num_mip_levels(read_only image3d_t);
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(write_only image1d_t);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(write_only image2d_t);
#ifdef cl_khr_3d_image_writes
int __ovld get_image_num_mip_levels(write_only image3d_t);
@@ -15892,37 +15850,31 @@ int __ovld get_image_num_mip_levels(read_write
image3d_t);
#endif // cl_khr_3d_image_writes
#endif //defined(__opencl_c_read_write_images)
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(read_only image1d_array_t);
int __ovld get_image_num_mip_levels(read_only image2d_array_t);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld get_image_num_mip_levels(read_only image2d_array_depth_t);
int __ovld get_image_num_mip_levels(read_only image2d_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif // cl_khr_depth_images
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(write_only image1d_array_t);
int __ovld get_image_num_mip_levels(write_only image2d_array_t);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld get_image_num_mip_levels(write_only image2d_array_depth_t);
int __ovld get_image_num_mip_levels(write_only image2d_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif // cl_khr_depth_images
#if defined(__opencl_c_read_write_images)
-#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(read_write image1d_array_t);
int __ovld get_image_num_mip_levels(read_write image2d_array_t);
-#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld get_image_num_mip_levels(read_write image2d_array_depth_t);
int __ovld get_image_num_mip_levels(read_write image2d_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif // cl_khr_depth_images
#endif //defined(__opencl_c_read_write_images)
-#endif // cl_khr_mipmap_image
-#endif // defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
+#endif //cl_khr_mipmap_image
+#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
CL_VERSION_2_0)
/**
* Return the channel data type. Valid values are:
@@ -15949,10 +15901,10 @@ int __ovld __cnfn
get_image_channel_data_type(read_only image2d_t);
int __ovld __cnfn get_image_channel_data_type(read_only image3d_t);
int __ovld __cnfn get_image_channel_data_type(read_only image1d_array_t);
int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_channel_data_type(read_only image2d_depth_t);
int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_data_type(read_only image2d_msaa_t);
int __ovld __cnfn get_image_channel_data_type(read_only image2d_msaa_depth_t);
@@ -15968,10 +15920,10 @@ int __ovld __cnfn
get_image_channel_data_type(write_only image3d_t);
#endif
int __ovld __cnfn get_image_channel_data_type(write_only image1d_array_t);
int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_channel_data_type(write_only image2d_depth_t);
int __ovld __cnfn get_image_channel_data_type(write_only
image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_data_type(write_only image2d_msaa_t);
int __ovld __cnfn get_image_channel_data_type(write_only image2d_msaa_depth_t);
@@ -15988,10 +15940,10 @@ int __ovld __cnfn
get_image_channel_data_type(read_write image3d_t);
#endif // cl_khr_3d_image_writes
int __ovld __cnfn get_image_channel_data_type(read_write image1d_array_t);
int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_channel_data_type(read_write image2d_depth_t);
int __ovld __cnfn get_image_channel_data_type(read_write
image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_t);
int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_depth_t);
@@ -16023,10 +15975,10 @@ int __ovld __cnfn get_image_channel_order(read_only
image2d_t);
int __ovld __cnfn get_image_channel_order(read_only image3d_t);
int __ovld __cnfn get_image_channel_order(read_only image1d_array_t);
int __ovld __cnfn get_image_channel_order(read_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_channel_order(read_only image2d_depth_t);
int __ovld __cnfn get_image_channel_order(read_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_order(read_only image2d_msaa_t);
int __ovld __cnfn get_image_channel_order(read_only image2d_msaa_depth_t);
@@ -16042,10 +15994,10 @@ int __ovld __cnfn get_image_channel_order(write_only
image3d_t);
#endif
int __ovld __cnfn get_image_channel_order(write_only image1d_array_t);
int __ovld __cnfn get_image_channel_order(write_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_channel_order(write_only image2d_depth_t);
int __ovld __cnfn get_image_channel_order(write_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_order(write_only image2d_msaa_t);
int __ovld __cnfn get_image_channel_order(write_only image2d_msaa_depth_t);
@@ -16062,10 +16014,10 @@ int __ovld __cnfn get_image_channel_order(read_write
image3d_t);
#endif // cl_khr_3d_image_writes
int __ovld __cnfn get_image_channel_order(read_write image1d_array_t);
int __ovld __cnfn get_image_channel_order(read_write image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int __ovld __cnfn get_image_channel_order(read_write image2d_depth_t);
int __ovld __cnfn get_image_channel_order(read_write image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_t);
int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_depth_t);
@@ -16081,10 +16033,10 @@ int __ovld __cnfn get_image_channel_order(read_write
image2d_array_msaa_depth_t)
*/
int2 __ovld __cnfn get_image_dim(read_only image2d_t);
int2 __ovld __cnfn get_image_dim(read_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int2 __ovld __cnfn get_image_dim(read_only image2d_array_depth_t);
int2 __ovld __cnfn get_image_dim(read_only image2d_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int2 __ovld __cnfn get_image_dim(read_only image2d_msaa_t);
int2 __ovld __cnfn get_image_dim(read_only image2d_msaa_depth_t);
@@ -16094,10 +16046,10 @@ int2 __ovld __cnfn get_image_dim(read_only
image2d_array_msaa_depth_t);
int2 __ovld __cnfn get_image_dim(write_only image2d_t);
int2 __ovld __cnfn get_image_dim(write_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int2 __ovld __cnfn get_image_dim(write_only image2d_array_depth_t);
int2 __ovld __cnfn get_image_dim(write_only image2d_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int2 __ovld __cnfn get_image_dim(write_only image2d_msaa_t);
int2 __ovld __cnfn get_image_dim(write_only image2d_msaa_depth_t);
@@ -16108,10 +16060,10 @@ int2 __ovld __cnfn get_image_dim(write_only
image2d_array_msaa_depth_t);
#if defined(__opencl_c_read_write_images)
int2 __ovld __cnfn get_image_dim(read_write image2d_t);
int2 __ovld __cnfn get_image_dim(read_write image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
int2 __ovld __cnfn get_image_dim(read_write image2d_array_depth_t);
int2 __ovld __cnfn get_image_dim(read_write image2d_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_t);
int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_depth_t);
@@ -16140,9 +16092,9 @@ int4 __ovld __cnfn get_image_dim(read_write image3d_t);
size_t __ovld __cnfn get_image_array_size(read_only image1d_array_t);
size_t __ovld __cnfn get_image_array_size(read_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
size_t __ovld __cnfn get_image_array_size(read_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
size_t __ovld __cnfn get_image_array_size(read_only image2d_array_msaa_t);
size_t __ovld __cnfn get_image_array_size(read_only
image2d_array_msaa_depth_t);
@@ -16150,9 +16102,9 @@ size_t __ovld __cnfn get_image_array_size(read_only
image2d_array_msaa_depth_t);
size_t __ovld __cnfn get_image_array_size(write_only image1d_array_t);
size_t __ovld __cnfn get_image_array_size(write_only image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
size_t __ovld __cnfn get_image_array_size(write_only image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_t);
size_t __ovld __cnfn get_image_array_size(write_only
image2d_array_msaa_depth_t);
@@ -16161,9 +16113,9 @@ size_t __ovld __cnfn get_image_array_size(write_only
image2d_array_msaa_depth_t)
#if defined(__opencl_c_read_write_images)
size_t __ovld __cnfn get_image_array_size(read_write image1d_array_t);
size_t __ovld __cnfn get_image_array_size(read_write image2d_array_t);
-#if defined(__opencl_depth_image_builtins)
+#ifdef cl_khr_depth_images
size_t __ovld __cnfn get_image_array_size(read_write image2d_array_depth_t);
-#endif // defined(__opencl_depth_image_builtins)
+#endif //cl_khr_depth_images
#if defined(cl_khr_gl_msaa_sharing)
size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_t);
size_t __ovld __cnfn get_image_array_size(read_write
image2d_array_msaa_depth_t);
@@ -18733,5 +18685,4 @@ int __ovld arm_dot_acc_sat(char4, char4, int);
#undef __cnfn
#undef __ovld
-
#endif //_OPENCL_H_
diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
index 6b377a5a31bfc..fe86d42dac4db 100644
--- a/clang/lib/Sema/OpenCLBuiltins.td
+++ b/clang/lib/Sema/OpenCLBuiltins.td
@@ -250,7 +250,7 @@ class ImageType<Type _Ty, string _AccessQualifier> :
let Extension = !cond(
!and(!eq(_Ty.Name, "image3d_t"), !eq(_AccessQualifier, "WO")) :
TypeExtension<"cl_khr_3d_image_writes">,
!and(!eq(_Ty.Name, "image3d_t"), !eq(_AccessQualifier, "RW")) :
TypeExtension<"cl_khr_3d_image_writes __opencl_c_read_write_images">,
- !or(!eq(_Ty.Name, "image2d_depth_t"), !eq(_Ty.Name,
"image2d_array_depth_t")) : TypeExtension<"__opencl_depth_image_builtins">,
+ !or(!eq(_Ty.Name, "image2d_depth_t"), !eq(_Ty.Name,
"image2d_array_depth_t")) : TypeExtension<"cl_khr_depth_images">,
!eq(_AccessQualifier, "RW") :
TypeExtension<"__opencl_c_read_write_images">,
true : _Ty.Extension);
}
diff --git a/clang/test/Headers/opencl-c-header.cl
b/clang/test/Headers/opencl-c-header.cl
index 0be2efce28d2f..e26f16827b20f 100644
--- a/clang/test/Headers/opencl-c-header.cl
+++ b/clang/test/Headers/opencl-c-header.cl
@@ -104,130 +104,47 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
#endif //__OPENCL_C_VERSION__
#pragma OPENCL EXTENSION cl_intel_planar_yuv : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-#if cl_khr_depth_images != 1
-#error "Incorrectly defined cl_khr_depth_images"
-#endif
-#if cl_khr_extended_bit_ops != 1
-#error "Incorrectly defined cl_khr_extended_bit_ops"
-#endif
-#if cl_ext_float_atomics != 1
-#error "Incorrectly defined cl_ext_float_atomics"
-#endif
-#if cl_khr_gl_msaa_sharing != 1
-#error "Incorrectly defined cl_khr_gl_msaa_sharing"
-#endif
-#if cl_khr_integer_dot_product != 1
-#error "Incorrectly defined cl_khr_integer_dot_product"
-#endif
-#if cl_khr_kernel_clock != 1
-#error "Incorrectly defined cl_khr_kernel_clock"
-#endif
-#if cl_khr_mipmap_image != 1
-#error "Incorrectly defined cl_khr_mipmap_image"
-#endif
-#if cl_khr_mipmap_image_writes != 1
-#error "Incorrectly defined cl_khr_mipmap_image_writes"
-#endif
-#if cl_khr_subgroup_ballot != 1
-#error "Incorrectly defined cl_khr_subgroup_ballot"
-#endif
-#if cl_khr_subgroup_clustered_reduce != 1
-#error "Incorrectly defined cl_khr_subgroup_clustered_reduce"
-#endif
#if cl_khr_subgroup_extended_types != 1
#error "Incorrectly defined cl_khr_subgroup_extended_types"
#endif
-#if cl_khr_subgroup_non_uniform_arithmetic != 1
-#error "Incorrectly defined cl_khr_subgroup_non_uniform_arithmetic"
-#endif
#if cl_khr_subgroup_non_uniform_vote != 1
#error "Incorrectly defined cl_khr_subgroup_non_uniform_vote"
#endif
-#if cl_khr_subgroup_rotate != 1
-#error "Incorrectly defined cl_khr_subgroup_rotate"
+#if cl_khr_subgroup_ballot != 1
+#error "Incorrectly defined cl_khr_subgroup_ballot"
#endif
-#if cl_khr_subgroup_shuffle_relative != 1
-#error "Incorrectly defined cl_khr_subgroup_shuffle_relative"
+#if cl_khr_subgroup_non_uniform_arithmetic != 1
+#error "Incorrectly defined cl_khr_subgroup_non_uniform_arithmetic"
#endif
#if cl_khr_subgroup_shuffle != 1
#error "Incorrectly defined cl_khr_subgroup_shuffle"
#endif
-#if cl_khr_subgroups != 1
-#error "Incorrectly defined cl_khr_subgroups"
-#endif
-#if cl_khr_3d_image_writes != 1
-#error "Incorrectly defined cl_khr_3d_image_writes"
-#endif
-
-#else
-
-#ifdef cl_khr_depth_images
-#error "Incorrect cl_khr_depth_images define"
-#endif
-#ifdef cl_khr_extended_bit_ops
-#error "Incorrect cl_khr_extended_bit_ops define"
-#endif
-#ifdef cl_ext_float_atomics
-#error "Incorrect cl_ext_float_atomics define"
-#endif
-#ifdef cl_khr_gl_msaa_sharing
-#error "Incorrect cl_khr_gl_msaa_sharing define"
-#endif
-#ifdef cl_khr_integer_dot_product
-#error "Incorrect cl_khr_integer_dot_product define"
-#endif
-#ifdef cl_khr_kernel_clock
-#error "Incorrect cl_khr_kernel_clock define"
-#endif
-#ifdef cl_khr_mipmap_image
-#error "Incorrect cl_khr_mipmap_image define"
-#endif
-#ifdef cl_khr_mipmap_image_writes
-#error "Incorrect cl_khr_mipmap_image_writes define"
-#endif
-#ifdef cl_khr_subgroup_ballot
-#error "Incorrect cl_khr_subgroup_ballot define"
-#endif
-#ifdef cl_khr_subgroup_clustered_reduce
-#error "Incorrect cl_khr_subgroup_clustered_reduce define"
-#endif
-#ifdef cl_khr_subgroup_extended_types
-#error "Incorrect cl_khr_subgroup_extended_types define"
-#endif
-#ifdef cl_khr_subgroup_non_uniform_arithmetic
-#error "Incorrect cl_khr_subgroup_non_uniform_arithmetic define"
-#endif
-#ifdef cl_khr_subgroup_non_uniform_vote
-#error "Incorrect cl_khr_subgroup_non_uniform_vote define"
-#endif
-#ifdef cl_khr_subgroup_rotate
-#error "Incorrect cl_khr_subgroup_rotate define"
+#if cl_khr_subgroup_shuffle_relative != 1
+#error "Incorrectly defined cl_khr_subgroup_shuffle_relative"
#endif
-#ifdef cl_khr_subgroup_shuffle_relative
-#error "Incorrect cl_khr_subgroup_shuffle_relative define"
+#if cl_khr_subgroup_clustered_reduce != 1
+#error "Incorrectly defined cl_khr_subgroup_clustered_reduce"
#endif
-#ifdef cl_khr_subgroup_shuffle
-#error "Incorrect cl_khr_subgroup_shuffle define"
+#if cl_khr_subgroup_rotate != 1
+#error "Incorrectly defined cl_khr_subgroup_rotate"
#endif
-#ifdef cl_khr_subgroups
-#error "Incorrect cl_khr_subgroups define"
+#if cl_khr_extended_bit_ops != 1
+#error "Incorrectly defined cl_khr_extended_bit_ops"
#endif
-#ifdef cl_khr_3d_image_writes
-#error "Incorrect cl_khr_3d_image_writes define"
+#if cl_khr_integer_dot_product != 1
+#error "Incorrectly defined cl_khr_integer_dot_product"
#endif
-
-#endif // (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
-
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-
#if __opencl_c_integer_dot_product_input_4x8bit != 1
#error "Incorrectly defined __opencl_c_integer_dot_product_input_4x8bit"
#endif
#if __opencl_c_integer_dot_product_input_4x8bit_packed != 1
#error "Incorrectly defined __opencl_c_integer_dot_product_input_4x8bit_packed"
#endif
+#if cl_ext_float_atomics != 1
+#error "Incorrectly defined cl_ext_float_atomics"
+#endif
#if __opencl_c_ext_fp16_global_atomic_load_store != 1
#error "Incorrectly defined __opencl_c_ext_fp16_global_atomic_load_store"
#endif
@@ -282,12 +199,45 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
#else
+#ifdef cl_khr_subgroup_extended_types
+#error "Incorrect cl_khr_subgroup_extended_types define"
+#endif
+#ifdef cl_khr_subgroup_non_uniform_vote
+#error "Incorrect cl_khr_subgroup_non_uniform_vote define"
+#endif
+#ifdef cl_khr_subgroup_ballot
+#error "Incorrect cl_khr_subgroup_ballot define"
+#endif
+#ifdef cl_khr_subgroup_non_uniform_arithmetic
+#error "Incorrect cl_khr_subgroup_non_uniform_arithmetic define"
+#endif
+#ifdef cl_khr_subgroup_shuffle
+#error "Incorrect cl_khr_subgroup_shuffle define"
+#endif
+#ifdef cl_khr_subgroup_shuffle_relative
+#error "Incorrect cl_khr_subgroup_shuffle_relative define"
+#endif
+#ifdef cl_khr_subgroup_clustered_reduce
+#error "Incorrect cl_khr_subgroup_clustered_reduce define"
+#endif
+#ifdef cl_khr_subgroup_rotate
+#error "Incorrect cl_khr_subgroup_rotate define"
+#endif
+#ifdef cl_khr_extended_bit_ops
+#error "Incorrect cl_khr_extended_bit_ops define"
+#endif
+#ifdef cl_khr_integer_dot_product
+#error "Incorrect cl_khr_integer_dot_product define"
+#endif
#ifdef __opencl_c_integer_dot_product_input_4x8bit
#error "Incorrect __opencl_c_integer_dot_product_input_4x8bit define"
#endif
#ifdef __opencl_c_integer_dot_product_input_4x8bit_packed
#error "Incorrect __opencl_c_integer_dot_product_input_4x8bit_packed define"
#endif
+#ifdef cl_ext_float_atomics
+#error "Incorrect cl_ext_float_atomics define"
+#endif
#ifdef __opencl_c_ext_fp16_global_atomic_load_store
#error "Incorrect __opencl_c_ext_fp16_global_atomic_load_store define"
#endif
diff --git a/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
b/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
index ee33f86080e82..86b558530810e 100644
--- a/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
+++ b/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -121,7 +121,7 @@
#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing'
- ignoring}}
-#if defined(__OPENCL_C_VERSION__)
+#if (__OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_mipmap_image
#error "Missing cl_khr_mipmap_image define"
#endif
@@ -139,7 +139,7 @@
#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable
// expected-warning@-1{{unsupported OpenCL extension
'cl_khr_srgb_image_writes' - ignoring}}
-#if defined(__OPENCL_C_VERSION__)
+#if (__OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroups
#error "Missing cl_khr_subgroups define"
#endif
diff --git a/clang/test/SemaOpenCL/extension-version.cl
b/clang/test/SemaOpenCL/extension-version.cl
index b24c1b4bb6272..85d7aac0e0f2a 100644
--- a/clang/test/SemaOpenCL/extension-version.cl
+++ b/clang/test/SemaOpenCL/extension-version.cl
@@ -102,7 +102,7 @@
// expected-warning@-2{{OpenCL extension 'cl_khr_3d_image_writes' is core
feature or supported optional core feature - ignoring}}
#endif
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110)
#ifndef cles_khr_int64
#error "Missing cles_khr_int64 define"
#endif
@@ -111,7 +111,7 @@
#endif
#pragma OPENCL EXTENSION cles_khr_int64 : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 100)
#ifndef cl_khr_gl_msaa_sharing
#error "Missing cl_khr_gl_msaa_sharing define"
#endif
@@ -120,7 +120,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_mipmap_image
#error "Missing cl_khr_mipmap_image define"
#endif
@@ -132,7 +132,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_mipmap_image : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_mipmap_image_writes
#error "Missing cl_khr_mipmap_image_writes define"
#endif
@@ -144,7 +144,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_srgb_image_writes
#error "Missing cl_khr_srgb_image_writes define"
#endif
@@ -153,7 +153,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_srgb_image_writes : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroups
#error "Missing cl_khr_subgroups define"
#endif
@@ -165,7 +165,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_subgroups : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_ext_float_atomics
#error "Missing cl_ext_float_atomics define"
#endif
@@ -177,7 +177,7 @@
// expected-warning@+1{{OpenCL extension 'cl_ext_float_atomics' unknown or
does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_ext_float_atomics : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_extended_bit_ops
#error "Missing cl_khr_extended_bit_ops define"
#endif
@@ -189,7 +189,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_extended_bit_ops' unknown or
does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_extended_bit_ops : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_integer_dot_product
#error "Missing cl_khr_integer_dot_product define"
#endif
@@ -201,7 +201,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_integer_dot_product' unknown
or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_integer_dot_product : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_kernel_clock
#error "Missing cl_khr_kernel_clock define"
#endif
@@ -213,7 +213,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_kernel_clock' unknown or does
not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_kernel_clock : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_ballot
#error "Missing cl_khr_subgroup_ballot define"
#endif
@@ -225,7 +225,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_ballot' unknown or
does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_ballot : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_clustered_reduce
#error "Missing cl_khr_subgroup_clustered_reduce define"
#endif
@@ -237,7 +237,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_clustered_reduce'
unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_clustered_reduce : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_extended_types
#error "Missing cl_khr_subgroup_extended_types define"
#endif
@@ -249,7 +249,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_extended_types'
unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_extended_types : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_named_barrier
#error "Missing cl_khr_subgroup_named_barrier define"
#endif
@@ -261,7 +261,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_named_barrier'
unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_named_barrier : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_non_uniform_arithmetic
#error "Missing cl_khr_subgroup_non_uniform_arithmetic define"
#endif
@@ -273,7 +273,7 @@
// expected-warning@+1{{OpenCL extension
'cl_khr_subgroup_non_uniform_arithmetic' unknown or does not require pragma -
ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_arithmetic : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_non_uniform_vote
#error "Missing cl_khr_subgroup_non_uniform_vote define"
#endif
@@ -285,7 +285,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_non_uniform_vote'
unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_vote : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_rotate
#error "Missing cl_khr_subgroup_rotate define"
#endif
@@ -297,7 +297,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_rotate' unknown or
does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_rotate : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_shuffle_relative
#error "Missing cl_khr_subgroup_shuffle_relative define"
#endif
@@ -309,7 +309,7 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_shuffle_relative'
unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_shuffle_relative : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_shuffle
#error "Missing cl_khr_subgroup_shuffle define"
#endif
@@ -331,7 +331,7 @@
#endif
#pragma OPENCL EXTENSION cl_amd_media_ops2 : enable
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120)
#ifndef cl_khr_depth_images
#error "Missing cl_khr_depth_images define"
#endif
diff --git a/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
b/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
index dc41afd860dca..bf943a400320c 100644
--- a/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
+++ b/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
@@ -50,7 +50,6 @@ typedef char char2 __attribute__((ext_vector_type(2)));
typedef char char4 __attribute__((ext_vector_type(4)));
typedef uchar uchar4 __attribute__((ext_vector_type(4)));
typedef uchar uchar16 __attribute__((ext_vector_type(16)));
-typedef float float2 __attribute__((ext_vector_type(2)));
typedef float float4 __attribute__((ext_vector_type(4)));
typedef float float16 __attribute__((ext_vector_type(16)));
typedef half half4 __attribute__((ext_vector_type(4)));
@@ -73,7 +72,7 @@ typedef uint cl_mem_fence_flags;
typedef struct {int a;} ndrange_t;
// Enable extensions that are enabled in opencl-c-base.h.
-#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#define __opencl_c_device_enqueue 1
#define __opencl_c_generic_address_space 1
#define cl_khr_subgroup_extended_types 1
@@ -82,7 +81,6 @@ typedef struct {int a;} ndrange_t;
#define cl_khr_subgroup_clustered_reduce 1
#define __opencl_c_read_write_images 1
#define __opencl_subgroup_builtins 1
-#define __opencl_depth_image_builtins 1
#endif
#if (__OPENCL_CPP_VERSION__ == 100 || __OPENCL_C_VERSION__ == 200)
@@ -301,10 +299,16 @@ kernel void basic_image_writeonly(write_only
image1d_buffer_t image_write_only_i
int4 i4;
write_imagef(image3dwo, i4, i, f4);
+#if __OPENCL_C_VERSION__ <= CL_VERSION_1_2 && !defined(__OPENCL_CPP_VERSION__)
+ // expected-error@-2{{no matching function for call to 'write_imagef'}}
+#endif
}
kernel void basic_subgroup(global uint *out) {
out[0] = get_sub_group_size();
+#if __OPENCL_C_VERSION__ <= CL_VERSION_1_2 && !defined(__OPENCL_CPP_VERSION__)
+ // expected-error@-2{{use of undeclared identifier 'get_sub_group_size'}}
+#endif
// Only test when the base header is included, because we need the enum
declarations.
#if !defined(NO_HEADER) && (defined(__OPENCL_CPP_VERSION__) ||
__OPENCL_C_VERSION__ >= 200)
@@ -312,185 +316,17 @@ kernel void basic_subgroup(global uint *out) {
#endif
}
-kernel void basic_image_readonly_depth(read_only image2d_depth_t
image_read_only_image2d_depth) {
- int2 i2;
- float f;
- float2 f2;
- sampler_t sampler;
- float resf;
-
- resf = read_imagef(image_read_only_image2d_depth, sampler, f2);
- resf = read_imagef(image_read_only_image2d_depth, sampler, i2);
- resf = read_imagef(image_read_only_image2d_depth, sampler, f2, f);
- resf = read_imagef(image_read_only_image2d_depth, sampler, f2, f2, f2);
- resf = read_imagef(image_read_only_image2d_depth, sampler, i2);
-}
-
-kernel void basic_image_readonly_array_depth(read_only image2d_array_depth_t
image_read_only_image2d_array_depth) {
- int4 i4;
- float f;
- float2 f2;
- float4 f4;
- sampler_t sampler;
- float resf;
-
- resf = read_imagef(image_read_only_image2d_array_depth, sampler, f4);
- resf = read_imagef(image_read_only_image2d_array_depth, sampler, i4);
- resf = read_imagef(image_read_only_image2d_array_depth, sampler, f4, f);
- resf = read_imagef(image_read_only_image2d_array_depth, sampler, f4, f2, f2);
- resf = read_imagef(image_read_only_image2d_array_depth, sampler, i4);
-}
-
-kernel void basic_image_readwrite_depth(read_write image2d_depth_t
image_read_write_image2d_depth) {
-#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error@-2{{access qualifier 'read_write' cannot be used for
'__read_write image2d_depth_t' prior to OpenCL C version 2.0 or in version 3.0
and without __opencl_c_read_write_images feature}}
-#endif
- int2 i2;
- float f;
- float2 f2;
- sampler_t sampler;
- float resf;
-
- resf = read_imagef(image_read_write_image2d_depth, i2);
-}
-
-kernel void basic_image_readwrite_array_depth(read_write image2d_array_depth_t
image_read_write_image2d_array_depth) {
-#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error@-2{{access qualifier 'read_write' cannot be used for
'__read_write image2d_array_depth_t' prior to OpenCL C version 2.0 or in
version 3.0 and without __opencl_c_read_write_images feature}}
-#endif
- int4 i4;
- float f;
- float2 f2;
- float4 f4;
- sampler_t sampler;
- float resf;
-
- resf = read_imagef(image_read_write_image2d_array_depth, i4);
-}
-
-kernel void basic_image_write_writeonly_depth(write_only image2d_depth_t
image_write_only_image2d_depth) {
- int i;
- int2 i2;
- float f;
-
- write_imagef(image_write_only_image2d_depth, i2, f);
- write_imagef(image_write_only_image2d_depth, i2, i, f);
-}
-
-kernel void basic_image_write_readwrite_depth(read_write image2d_depth_t
image_read_write_image2d_depth) {
-#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error@-2{{access qualifier 'read_write' cannot be used for
'__read_write image2d_depth_t' prior to OpenCL C version 2.0 or in version 3.0
and without __opencl_c_read_write_images feature}}
-#endif
- int i;
- int2 i2;
- float f;
-
- write_imagef(image_read_write_image2d_depth, i2, f);
-}
-
-kernel void basic_image_write_writeonly_array_depth(write_only
image2d_array_depth_t image_write_only_image2d_array_depth) {
- int i;
- int4 i4;
- float f;
- float resf;
-
- write_imagef(image_write_only_image2d_array_depth, i4, f);
- write_imagef(image_write_only_image2d_array_depth, i4, i, f);
-}
-
-kernel void basic_image_write_readwrite_array_depth(read_write
image2d_array_depth_t image_read_write_image2d_array_depth) {
-#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error@-2{{access qualifier 'read_write' cannot be used for
'__read_write image2d_array_depth_t' prior to OpenCL C version 2.0 or in
version 3.0 and without __opencl_c_read_write_images feature}}
-#endif
- int i;
- int4 i4;
- float f;
- float resf;
-
- write_imagef(image_read_write_image2d_array_depth, i4, f);
-}
-
-kernel void basic_image_query_read_only_depth(read_only image2d_depth_t
image_read_only_image2d_depth, read_only image2d_array_depth_t
image_read_only_image2d_array_depth) {
- int i;
- int2 i2;
- i = get_image_width(image_read_only_image2d_depth);
- i = get_image_width(image_read_only_image2d_array_depth);
-
- i = get_image_height(image_read_only_image2d_depth);
- i = get_image_height(image_read_only_image2d_array_depth);
-
- i = get_image_num_mip_levels(image_read_only_image2d_depth);
- i = get_image_num_mip_levels(image_read_only_image2d_array_depth);
-
- i = get_image_channel_order(image_read_only_image2d_depth);
- i = get_image_channel_order(image_read_only_image2d_array_depth);
-
- i = get_image_channel_data_type(image_read_only_image2d_depth);
- i = get_image_channel_data_type(image_read_only_image2d_array_depth);
-
- i2 = get_image_dim(image_read_only_image2d_depth);
- i2 = get_image_dim(image_read_only_image2d_array_depth);
-
- size_t s = get_image_array_size(image_read_only_image2d_array_depth);
-}
-
-kernel void basic_image_query_write_only_depth(write_only image2d_depth_t
image_write_only_image2d_depth, write_only image2d_array_depth_t
image_write_only_image2d_array_depth) {
- int i;
- int2 i2;
- i = get_image_width(image_write_only_image2d_depth);
- i = get_image_width(image_write_only_image2d_array_depth);
-
- i = get_image_height(image_write_only_image2d_depth);
- i = get_image_height(image_write_only_image2d_array_depth);
-
- i = get_image_num_mip_levels(image_write_only_image2d_depth);
- i = get_image_num_mip_levels(image_write_only_image2d_array_depth);
-
- i = get_image_channel_data_type(image_write_only_image2d_depth);
- i = get_image_channel_data_type(image_write_only_image2d_array_depth);
-
- i = get_image_channel_order(image_write_only_image2d_depth);
- i = get_image_channel_order(image_write_only_image2d_array_depth);
-
- i2 = get_image_dim(image_write_only_image2d_depth);
- i2 = get_image_dim(image_write_only_image2d_array_depth);
-
- size_t s = get_image_array_size(image_write_only_image2d_array_depth);
-}
-
-kernel void basic_image_query_read_write_depth(read_write image2d_depth_t
image_read_write_image2d_depth, read_write image2d_array_depth_t
image_read_write_image2d_array_depth) {
-#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error@-2{{access qualifier 'read_write' cannot be used for
'__read_write image2d_depth_t' prior to OpenCL C version 2.0 or in version 3.0
and without __opencl_c_read_write_images feature}}
- // expected-error@-3{{access qualifier 'read_write' cannot be used for
'__read_write image2d_array_depth_t' prior to OpenCL C version 2.0 or in
version 3.0 and without __opencl_c_read_write_images feature}}
-#endif
- int i;
- int2 i2;
- i = get_image_width(image_read_write_image2d_depth);
- i = get_image_width(image_read_write_image2d_array_depth);
-
- i = get_image_height(image_read_write_image2d_depth);
- i = get_image_height(image_read_write_image2d_array_depth);
-
- i = get_image_num_mip_levels(image_read_write_image2d_depth);
- i = get_image_num_mip_levels(image_read_write_image2d_array_depth);
-
- i = get_image_channel_data_type(image_read_write_image2d_depth);
- i = get_image_channel_data_type(image_read_write_image2d_array_depth);
-
- i = get_image_channel_order(image_read_write_image2d_depth);
- i = get_image_channel_order(image_read_write_image2d_array_depth);
-
- i2 = get_image_dim(image_read_write_image2d_depth);
- i2 = get_image_dim(image_read_write_image2d_array_depth);
-
- size_t s = get_image_array_size(image_read_write_image2d_array_depth);
-}
-
kernel void extended_subgroup(global uint4 *out, global int *scalar, global
char2 *c2) {
out[0] = get_sub_group_eq_mask();
scalar[0] = sub_group_non_uniform_scan_inclusive_or(3);
scalar[1] = sub_group_clustered_reduce_logical_xor(2, 4);
*c2 = sub_group_broadcast(*c2, 2);
+#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
+ // expected-error@-5{{use of undeclared identifier 'get_sub_group_eq_mask'}}
+ // expected-error@-5{{use of undeclared identifier
'sub_group_non_uniform_scan_inclusive_or'}}
+ // expected-error@-5{{use of undeclared identifier
'sub_group_clustered_reduce_logical_xor'}}
+ // expected-error@-5{{use of undeclared identifier 'sub_group_broadcast'}}
+#endif
}
kernel void basic_vector_data(void) {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits