forked from llvm-mirror/libclc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r600: Add image attribute getter builtins.
Added get_image_* OpenCL builtins to the headers along with a dummy implementation to the R600 libs. The builtins need to be replaced by the compiler.
- Loading branch information
Showing
11 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
_CLC_OVERLOAD _CLC_DECL int get_image_width (image2d_t image); | ||
_CLC_OVERLOAD _CLC_DECL int get_image_width (image3d_t image); | ||
|
||
_CLC_OVERLOAD _CLC_DECL int get_image_height (image2d_t image); | ||
_CLC_OVERLOAD _CLC_DECL int get_image_height (image3d_t image); | ||
|
||
_CLC_OVERLOAD _CLC_DECL int get_image_depth (image3d_t image); | ||
|
||
_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image2d_t image); | ||
_CLC_OVERLOAD _CLC_DECL int get_image_channel_data_type (image3d_t image); | ||
|
||
_CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image2d_t image); | ||
_CLC_OVERLOAD _CLC_DECL int get_image_channel_order (image3d_t image); | ||
|
||
_CLC_OVERLOAD _CLC_DECL int2 get_image_dim (image2d_t image); | ||
_CLC_OVERLOAD _CLC_DECL int4 get_image_dim (image3d_t image); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,3 +133,4 @@ shared/vload.cl | |
shared/vstore.cl | ||
workitem/get_global_id.cl | ||
workitem/get_global_size.cl | ||
image/get_image_dim.cl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <clc/clc.h> | ||
|
||
_CLC_OVERLOAD _CLC_DEF int2 get_image_dim (image2d_t image) { | ||
return (int2)(get_image_width(image), get_image_height(image)); | ||
} | ||
_CLC_OVERLOAD _CLC_DEF int4 get_image_dim (image3d_t image) { | ||
return (int4)(get_image_width(image), get_image_height(image), | ||
get_image_depth(image), 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
%opencl.image2d_t = type opaque | ||
%opencl.image3d_t = type opaque | ||
|
||
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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |