diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-02-13 01:01:59 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-02-13 01:01:59 +0000 |
commit | a48e15c6cbfac45df26f778402e4a972a7199fbe (patch) | |
tree | e1027cdf6bf978147065c8b9c2a0c42f829ebfd8 /libclc/amdgpu/lib/image/write_image_impl.ll | |
parent | 0a5e166a0ba60dff9f004f6721c5476f29386169 (diff) | |
download | bcm5719-llvm-a48e15c6cbfac45df26f778402e4a972a7199fbe.tar.gz bcm5719-llvm-a48e15c6cbfac45df26f778402e4a972a7199fbe.zip |
Split sources for amdgcn and r600
Most files remain in a common amdgpu directory.
Also switches barriers to to use convergent,
and use llvm.amdgcn.s.barrier.
This now requires 3.9/trunk to build amdgcn.
llvm-svn: 260777
Diffstat (limited to 'libclc/amdgpu/lib/image/write_image_impl.ll')
-rw-r--r-- | libclc/amdgpu/lib/image/write_image_impl.ll | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/libclc/amdgpu/lib/image/write_image_impl.ll b/libclc/amdgpu/lib/image/write_image_impl.ll new file mode 100644 index 00000000000..265f5d6045e --- /dev/null +++ b/libclc/amdgpu/lib/image/write_image_impl.ll @@ -0,0 +1,52 @@ +%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 void @llvm.r600.rat.store.typed(<4 x i32> %color, <4 x i32> %coord, i32 %rat_id) + +define void @__clc_write_imageui_2d( + %opencl.image2d_t addrspace(1)* nocapture %img, + <2 x i32> %coord, <4 x i32> %color) #0 { + + ; Coordinate int2 -> int4. + %e0 = extractelement <2 x i32> %coord, i32 0 + %e1 = extractelement <2 x i32> %coord, i32 1 + %coord.0 = insertelement <4 x i32> undef, i32 %e0, i32 0 + %coord.1 = insertelement <4 x i32> %coord.0, i32 %e1, i32 1 + %coord.2 = insertelement <4 x i32> %coord.1, i32 0, i32 2 + %coord.3 = insertelement <4 x i32> %coord.2, i32 0, i32 3 + + ; Get RAT ID. + %img_id = call i32 @llvm.OpenCL.image.get.resource.id.2d( + %opencl.image2d_t addrspace(1)* %img) + %rat_id = add i32 %img_id, 1 + + ; Call store intrinsic. + call void @llvm.r600.rat.store.typed(<4 x i32> %color, <4 x i32> %coord.3, i32 %rat_id) + ret void +} + +define void @__clc_write_imagei_2d( + %opencl.image2d_t addrspace(1)* nocapture %img, + <2 x i32> %coord, <4 x i32> %color) #0 { + call void @__clc_write_imageui_2d( + %opencl.image2d_t addrspace(1)* nocapture %img, + <2 x i32> %coord, <4 x i32> %color) + ret void +} + +define void @__clc_write_imagef_2d( + %opencl.image2d_t addrspace(1)* nocapture %img, + <2 x i32> %coord, <4 x float> %color) #0 { + %color.i32 = bitcast <4 x float> %color to <4 x i32> + call void @__clc_write_imageui_2d( + %opencl.image2d_t addrspace(1)* nocapture %img, + <2 x i32> %coord, <4 x i32> %color.i32) + ret void +} + +attributes #0 = { alwaysinline } |