summaryrefslogtreecommitdiff
path: root/libclc/r600
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-09-21 14:47:53 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-09-21 14:47:53 +0000
commitccc0ec1ddbf073f36819b68b69cc72ea96d05f62 (patch)
tree72a8705cf7c783f3d259212452e99f7bb5aeb81c /libclc/r600
parent8e261be911060e834c5e37b965e85415c8fb8b54 (diff)
downloadllvm-ccc0ec1ddbf073f36819b68b69cc72ea96d05f62.tar.gz
Add image attribute getter builtins
Added get_image_* OpenCL builtins to the headers. Added implementation to the r600 target. Patch by: Zoltan Gilian llvm-svn: 248159
Diffstat (limited to 'libclc/r600')
-rw-r--r--libclc/r600/lib/SOURCES6
-rw-r--r--libclc/r600/lib/image/get_image_attributes_impl.ll87
-rw-r--r--libclc/r600/lib/image/get_image_channel_data_type.cl13
-rw-r--r--libclc/r600/lib/image/get_image_channel_order.cl13
-rw-r--r--libclc/r600/lib/image/get_image_depth.cl8
-rw-r--r--libclc/r600/lib/image/get_image_height.cl13
-rw-r--r--libclc/r600/lib/image/get_image_width.cl13
7 files changed, 153 insertions, 0 deletions
diff --git a/libclc/r600/lib/SOURCES b/libclc/r600/lib/SOURCES
index 5cdb14a4df20..349df7ef4264 100644
--- a/libclc/r600/lib/SOURCES
+++ b/libclc/r600/lib/SOURCES
@@ -10,3 +10,9 @@ workitem/get_global_size.ll
workitem/get_work_dim.ll
synchronization/barrier.cl
synchronization/barrier_impl.ll
+image/get_image_width.cl
+image/get_image_height.cl
+image/get_image_depth.cl
+image/get_image_channel_data_type.cl
+image/get_image_channel_order.cl
+image/get_image_attributes_impl.ll
diff --git a/libclc/r600/lib/image/get_image_attributes_impl.ll b/libclc/r600/lib/image/get_image_attributes_impl.ll
new file mode 100644
index 000000000000..7f1965de7602
--- /dev/null
+++ b/libclc/r600/lib/image/get_image_attributes_impl.ll
@@ -0,0 +1,87 @@
+%opencl.image2d_t = type opaque
+%opencl.image3d_t = type opaque
+
+declare i32 @llvm.OpenCL.image.get.resource.id.2d(
+ %opencl.image2d_t addrspace(1)*) nounwind readnone
+declare i32 @llvm.OpenCL.image.get.resource.id.3d(
+ %opencl.image3d_t addrspace(1)*) nounwind readnone
+
+declare [3 x i32] @llvm.OpenCL.image.get.size.2d(
+ %opencl.image2d_t addrspace(1)*) nounwind readnone
+declare [3 x i32] @llvm.OpenCL.image.get.size.3d(
+ %opencl.image3d_t addrspace(1)*) nounwind readnone
+
+declare [2 x i32] @llvm.OpenCL.image.get.format.2d(
+ %opencl.image2d_t addrspace(1)*) nounwind readnone
+declare [2 x i32] @llvm.OpenCL.image.get.format.3d(
+ %opencl.image3d_t addrspace(1)*) nounwind readnone
+
+define i32 @__clc_get_image_width_2d(
+ %opencl.image2d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.2d(
+ %opencl.image2d_t addrspace(1)* %img)
+ %2 = extractvalue [3 x i32] %1, 0
+ ret i32 %2
+}
+define i32 @__clc_get_image_width_3d(
+ %opencl.image3d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d(
+ %opencl.image3d_t addrspace(1)* %img)
+ %2 = extractvalue [3 x i32] %1, 0
+ ret i32 %2
+}
+
+define i32 @__clc_get_image_height_2d(
+ %opencl.image2d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.2d(
+ %opencl.image2d_t addrspace(1)* %img)
+ %2 = extractvalue [3 x i32] %1, 1
+ ret i32 %2
+}
+define i32 @__clc_get_image_height_3d(
+ %opencl.image3d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d(
+ %opencl.image3d_t addrspace(1)* %img)
+ %2 = extractvalue [3 x i32] %1, 1
+ ret i32 %2
+}
+
+define i32 @__clc_get_image_depth_3d(
+ %opencl.image3d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [3 x i32] @llvm.OpenCL.image.get.size.3d(
+ %opencl.image3d_t addrspace(1)* %img)
+ %2 = extractvalue [3 x i32] %1, 2
+ ret i32 %2
+}
+
+define i32 @__clc_get_image_channel_data_type_2d(
+ %opencl.image2d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.2d(
+ %opencl.image2d_t addrspace(1)* %img)
+ %2 = extractvalue [2 x i32] %1, 0
+ ret i32 %2
+}
+define i32 @__clc_get_image_channel_data_type_3d(
+ %opencl.image3d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.3d(
+ %opencl.image3d_t addrspace(1)* %img)
+ %2 = extractvalue [2 x i32] %1, 0
+ ret i32 %2
+}
+
+define i32 @__clc_get_image_channel_order_2d(
+ %opencl.image2d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.2d(
+ %opencl.image2d_t addrspace(1)* %img)
+ %2 = extractvalue [2 x i32] %1, 1
+ ret i32 %2
+}
+define i32 @__clc_get_image_channel_order_3d(
+ %opencl.image3d_t addrspace(1)* nocapture %img) #0 {
+ %1 = tail call [2 x i32] @llvm.OpenCL.image.get.format.3d(
+ %opencl.image3d_t addrspace(1)* %img)
+ %2 = extractvalue [2 x i32] %1, 1
+ ret i32 %2
+}
+
+attributes #0 = { nounwind readnone alwaysinline }
diff --git a/libclc/r600/lib/image/get_image_channel_data_type.cl b/libclc/r600/lib/image/get_image_channel_data_type.cl
new file mode 100644
index 000000000000..2a2478f73a73
--- /dev/null
+++ b/libclc/r600/lib/image/get_image_channel_data_type.cl
@@ -0,0 +1,13 @@
+#include <clc/clc.h>
+
+_CLC_DECL int __clc_get_image_channel_data_type_2d(image2d_t);
+_CLC_DECL int __clc_get_image_channel_data_type_3d(image3d_t);
+
+_CLC_OVERLOAD _CLC_DEF int
+get_image_channel_data_type(image2d_t image) {
+ return __clc_get_image_channel_data_type_2d(image);
+}
+_CLC_OVERLOAD _CLC_DEF int
+get_image_channel_data_type(image3d_t image) {
+ return __clc_get_image_channel_data_type_3d(image);
+}
diff --git a/libclc/r600/lib/image/get_image_channel_order.cl b/libclc/r600/lib/image/get_image_channel_order.cl
new file mode 100644
index 000000000000..91e9b89e17e6
--- /dev/null
+++ b/libclc/r600/lib/image/get_image_channel_order.cl
@@ -0,0 +1,13 @@
+#include <clc/clc.h>
+
+_CLC_DECL int __clc_get_image_channel_order_2d(image2d_t);
+_CLC_DECL int __clc_get_image_channel_order_3d(image3d_t);
+
+_CLC_OVERLOAD _CLC_DEF int
+get_image_channel_order(image2d_t image) {
+ return __clc_get_image_channel_order_2d(image);
+}
+_CLC_OVERLOAD _CLC_DEF int
+get_image_channel_order(image3d_t image) {
+ return __clc_get_image_channel_order_3d(image);
+}
diff --git a/libclc/r600/lib/image/get_image_depth.cl b/libclc/r600/lib/image/get_image_depth.cl
new file mode 100644
index 000000000000..18646458e9ad
--- /dev/null
+++ b/libclc/r600/lib/image/get_image_depth.cl
@@ -0,0 +1,8 @@
+#include <clc/clc.h>
+
+_CLC_DECL int __clc_get_image_depth_3d(image3d_t);
+
+_CLC_OVERLOAD _CLC_DEF int
+get_image_depth(image3d_t image) {
+ return __clc_get_image_depth_3d(image);
+}
diff --git a/libclc/r600/lib/image/get_image_height.cl b/libclc/r600/lib/image/get_image_height.cl
new file mode 100644
index 000000000000..80b364090c31
--- /dev/null
+++ b/libclc/r600/lib/image/get_image_height.cl
@@ -0,0 +1,13 @@
+#include <clc/clc.h>
+
+_CLC_DECL int __clc_get_image_height_2d(image2d_t);
+_CLC_DECL int __clc_get_image_height_3d(image3d_t);
+
+_CLC_OVERLOAD _CLC_DEF int
+get_image_height(image2d_t image) {
+ return __clc_get_image_height_2d(image);
+}
+_CLC_OVERLOAD _CLC_DEF int
+get_image_height(image3d_t image) {
+ return __clc_get_image_height_3d(image);
+}
diff --git a/libclc/r600/lib/image/get_image_width.cl b/libclc/r600/lib/image/get_image_width.cl
new file mode 100644
index 000000000000..29e4e9468ba8
--- /dev/null
+++ b/libclc/r600/lib/image/get_image_width.cl
@@ -0,0 +1,13 @@
+#include <clc/clc.h>
+
+_CLC_DECL int __clc_get_image_width_2d(image2d_t);
+_CLC_DECL int __clc_get_image_width_3d(image3d_t);
+
+_CLC_OVERLOAD _CLC_DEF int
+get_image_width(image2d_t image) {
+ return __clc_get_image_width_2d(image);
+}
+_CLC_OVERLOAD _CLC_DEF int
+get_image_width(image3d_t image) {
+ return __clc_get_image_width_3d(image);
+}