[clang] [Clang][OpenCL] Wrap image functions with the macro (PR #129177)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 27 19:21:34 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Victor Mustya (vmustya)
<details>
<summary>Changes</summary>
According to the OpenCL C spec, the image functions are optional.
For OpenCL C 1.2, the image functions are guarded by the
`__IMAGE_SUPPORT__` macro. For the OpenCL C 3.0 and later, the
`__opencl_c_images` macro is used.
---
Full diff: https://github.com/llvm/llvm-project/pull/129177.diff
1 Files Affected:
- (modified) clang/lib/Headers/opencl-c.h (+3)
``````````diff
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 20719b74b6b8d..8d8ef497cec49 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -15082,6 +15082,7 @@ half16 __ovld __cnfn shuffle2(half16, half16, ushort16);
#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
#endif //cl_khr_gl_msaa_sharing
+#if (defined(__opencl_c_images) || defined(__IMAGE_SUPPORT__))
/**
* Use the coordinate (coord.xy) to do an element lookup in
* the 2D image object specified by image.
@@ -16143,6 +16144,8 @@ int __ovld __cnfn get_image_num_samples(read_write image2d_array_msaa_depth_t);
#endif //defined(__opencl_c_read_write_images)
#endif
+#endif // (defined(__opencl_c_images) || defined(__IMAGE_SUPPORT__))
+
// OpenCL v2.0 s6.13.15 - Work-group Functions
#if defined(__opencl_c_work_group_collective_functions)
``````````
</details>
https://github.com/llvm/llvm-project/pull/129177
More information about the cfe-commits
mailing list