[PATCH] D67713: [OpenCL] Add image query builtin functions
Sven van Haastregt via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 02:11:38 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372833: [OpenCL] Add image query builtin functions (authored by svenvh, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D67713?vs=220683&id=221691#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67713/new/
https://reviews.llvm.org/D67713
Files:
cfe/trunk/lib/Sema/OpenCLBuiltins.td
cfe/trunk/test/SemaOpenCL/fdeclare-opencl-builtins.cl
Index: cfe/trunk/lib/Sema/OpenCLBuiltins.td
===================================================================
--- cfe/trunk/lib/Sema/OpenCLBuiltins.td
+++ cfe/trunk/lib/Sema/OpenCLBuiltins.td
@@ -593,6 +593,31 @@
def : Builtin<"write_imagef", [Void, ImageType<Image2dArrayDepth, aQual>, VectorType<Int, 4>, Float]>;
}
+// --- Table 25: Image Query Functions ---
+foreach aQual = ["RO", "WO", "RW"] in {
+ foreach imgTy = [Image1d, Image1dBuffer, Image2d, Image3d,
+ Image1dArray, Image2dArray, Image2dDepth,
+ Image2dArrayDepth] in {
+ foreach name = ["get_image_width", "get_image_channel_data_type",
+ "get_image_channel_order"] in {
+ def : Builtin<name, [Int, ImageType<imgTy, aQual>]>;
+ }
+ }
+ foreach imgTy = [Image2d, Image3d, Image2dArray, Image2dDepth,
+ Image2dArrayDepth] in {
+ def : Builtin<"get_image_height", [Int, ImageType<imgTy, aQual>]>;
+ }
+ def : Builtin<"get_image_depth", [Int, ImageType<Image3d, aQual>]>;
+ foreach imgTy = [Image2d, Image2dArray, Image2dDepth,
+ Image2dArrayDepth] in {
+ def : Builtin<"get_image_dim", [VectorType<Int, 2>, ImageType<imgTy, aQual>]>;
+ }
+ def : Builtin<"get_image_dim", [VectorType<Int, 4>, ImageType<Image3d, aQual>]>;
+ foreach imgTy = [Image1dArray, Image2dArray, Image2dArrayDepth] in {
+ def : Builtin<"get_image_array_size", [Size, ImageType<imgTy, aQual>]>;
+ }
+}
+
// OpenCL extension v2.0 s5.1.9: Built-in Image Read Functions
// --- Table 8 ---
foreach aQual = ["RO"] in {
Index: cfe/trunk/test/SemaOpenCL/fdeclare-opencl-builtins.cl
===================================================================
--- cfe/trunk/test/SemaOpenCL/fdeclare-opencl-builtins.cl
+++ cfe/trunk/test/SemaOpenCL/fdeclare-opencl-builtins.cl
@@ -71,6 +71,8 @@
resf = read_imagef(image_read_only_image2d, i2);
res = read_imageh(image_read_only_image2d, i2);
res = read_imageh(image_read_only_image2d, sampler, i2);
+
+ int imgWidth = get_image_width(image_read_only_image2d);
}
#if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
@@ -79,6 +81,8 @@
int4 i4;
write_imageh(image_read_write_image3d, i4, h4);
+
+ int imgDepth = get_image_depth(image_read_write_image3d);
}
#endif // __OPENCL_C_VERSION__ >= CL_VERSION_2_0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67713.221691.patch
Type: text/x-patch
Size: 2317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190925/2ae185ac/attachment.bin>
More information about the llvm-commits
mailing list