| 1 |
;;===----------------------------------------------------------------------===;; |
| 2 |
; |
| 3 |
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
; See https://llvm.org/LICENSE.txt for license information. |
| 5 |
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
; |
| 7 |
;;===----------------------------------------------------------------------===;; |
| 8 |
|
| 9 |
%opencl.image2d_t = type opaque |
| 10 |
%opencl.image3d_t = type opaque |
| 11 |
|
| 12 |
declare i32 @llvm.OpenCL.image.get.resource.id.2d( |
| 13 |
%opencl.image2d_t addrspace(1)*) nounwind readnone |
| 14 |
declare i32 @llvm.OpenCL.image.get.resource.id.3d( |
| 15 |
%opencl.image3d_t addrspace(1)*) nounwind readnone |
| 16 |
|
| 17 |
declare void @llvm.r600.rat.store.typed(<4 x i32> %color, <4 x i32> %coord, i32 %rat_id) |
| 18 |
|
| 19 |
define void @__clc_write_imageui_2d( |
| 20 |
%opencl.image2d_t addrspace(1)* nocapture %img, |
| 21 |
<2 x i32> %coord, <4 x i32> %color) #0 { |
| 22 |
|
| 23 |
; Coordinate int2 -> int4. |
| 24 |
%e0 = extractelement <2 x i32> %coord, i32 0 |
| 25 |
%e1 = extractelement <2 x i32> %coord, i32 1 |
| 26 |
%coord.0 = insertelement <4 x i32> poison, i32 %e0, i32 0 |
| 27 |
%coord.1 = insertelement <4 x i32> %coord.0, i32 %e1, i32 1 |
| 28 |
%coord.2 = insertelement <4 x i32> %coord.1, i32 0, i32 2 |
| 29 |
%coord.3 = insertelement <4 x i32> %coord.2, i32 0, i32 3 |
| 30 |
|
| 31 |
; Get RAT ID. |
| 32 |
%img_id = call i32 @llvm.OpenCL.image.get.resource.id.2d( |
| 33 |
%opencl.image2d_t addrspace(1)* %img) |
| 34 |
%rat_id = add i32 %img_id, 1 |
| 35 |
|
| 36 |
; Call store intrinsic. |
| 37 |
call void @llvm.r600.rat.store.typed(<4 x i32> %color, <4 x i32> %coord.3, i32 %rat_id) |
| 38 |
ret void |
| 39 |
} |
| 40 |
|
| 41 |
define void @__clc_write_imagei_2d( |
| 42 |
%opencl.image2d_t addrspace(1)* nocapture %img, |
| 43 |
<2 x i32> %coord, <4 x i32> %color) #0 { |
| 44 |
call void @__clc_write_imageui_2d( |
| 45 |
%opencl.image2d_t addrspace(1)* nocapture %img, |
| 46 |
<2 x i32> %coord, <4 x i32> %color) |
| 47 |
ret void |
| 48 |
} |
| 49 |
|
| 50 |
define void @__clc_write_imagef_2d( |
| 51 |
%opencl.image2d_t addrspace(1)* nocapture %img, |
| 52 |
<2 x i32> %coord, <4 x float> %color) #0 { |
| 53 |
%color.i32 = bitcast <4 x float> %color to <4 x i32> |
| 54 |
call void @__clc_write_imageui_2d( |
| 55 |
%opencl.image2d_t addrspace(1)* nocapture %img, |
| 56 |
<2 x i32> %coord, <4 x i32> %color.i32) |
| 57 |
ret void |
| 58 |
} |
| 59 |
|
| 60 |
attributes #0 = { alwaysinline } |