forked from GPUOpen-Drivers/llpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CallLibFromCsPayload.lgc
66 lines (58 loc) · 3.35 KB
/
CallLibFromCsPayload.lgc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
; Call an extern compute library function from a compute shader.
; Ensure that the first argument uses the same registers as the return value of the called function.
; RUN: lgc -mcpu=gfx1010 -o - - <%s | FileCheck %s
; ModuleID = 'lgcPipeline'
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-ni:7"
target triple = "amdgcn--amdpal"
declare spir_func <10 x i32> @compute_library_func(<10 x i32>) #0
; Function Attrs: nounwind
define dllexport spir_func void @lgc.shader.CS.main() local_unnamed_addr #0 !lgc.shaderstage !7 {
; CHECK: v_mov_b32_e32 v0, 42
; CHECK: s_swappc_b64 s[{{[0-9]+:[0-9]+}}], s[{{[0-9]+:[0-9]+}}]
; CHECK-NEXT: v_mov_b32_e32 v40, v0
; CHECK-NEXT: buffer_store_dwordx4 v[{{[0-9]+:[0-9]+}}], off, s[{{[0-9]+:[0-9]+}}], 0
.entry:
%0 = call i8 addrspace(7)* (...) @lgc.create.load.buffer.desc.p7i8(i32 0, i32 2, i32 0, i32 2)
%1 = call i8 addrspace(7)* (...) @lgc.create.load.buffer.desc.p7i8(i32 0, i32 0, i32 0, i32 2)
%2 = call i8 addrspace(7)* (...) @lgc.create.load.buffer.desc.p7i8(i32 0, i32 1, i32 0, i32 2)
%3 = bitcast i8 addrspace(7)* %2 to <4 x i32> addrspace(7)*
%4 = load <4 x i32>, <4 x i32> addrspace(7)* %3, align 16
%5 = call i8 addrspace(7)* (...) @lgc.create.load.buffer.desc.p7i8(i32 0, i32 1, i32 1, i32 2)
%6 = bitcast i8 addrspace(7)* %5 to <4 x i32> addrspace(7)*
%7 = load <4 x i32>, <4 x i32> addrspace(7)* %6, align 16
%8 = add <4 x i32> %4, %7
%9 = call i8 addrspace(7)* (...) @lgc.create.load.buffer.desc.p7i8(i32 0, i32 1, i32 2, i32 2)
%10 = bitcast i8 addrspace(7)* %9 to <4 x i32> addrspace(7)*
%11 = load <4 x i32>, <4 x i32> addrspace(7)* %10, align 16
%12 = add <4 x i32> %8, %11
%13 = call i8 addrspace(7)* (...) @lgc.create.load.buffer.desc.p7i8(i32 0, i32 1, i32 3, i32 2)
%14 = bitcast i8 addrspace(7)* %13 to <4 x i32> addrspace(7)*
%15 = load <4 x i32>, <4 x i32> addrspace(7)* %14, align 16
%16 = add <4 x i32> %12, %15
%17 = bitcast i8 addrspace(7)* %0 to <4 x i32> addrspace(7)*
%18 = load <4 x i32>, <4 x i32> addrspace(7)* %17, align 16
%19 = add <4 x i32> %16, %18
%20 = bitcast i8 addrspace(7)* %1 to <4 x i32> addrspace(7)*
%arg = insertelement <10 x i32> undef, i32 42, i32 0
%r = call spir_func <10 x i32> @compute_library_func(<10 x i32> %arg)
%ri = extractelement <10 x i32> %r, i32 0
%v = insertelement <4 x i32> %19, i32 %ri, i32 0
store <4 x i32> %v, <4 x i32> addrspace(7)* %20, align 16
ret void
}
; Function Attrs: nounwind readonly
declare i8 addrspace(7)* @lgc.create.load.buffer.desc.p7i8(...) local_unnamed_addr #1
attributes #0 = { nounwind }
attributes #1 = { nounwind readonly }
!llpc.compute.mode = !{!0}
!lgc.options = !{!1}
!lgc.options.CS = !{!2}
!lgc.user.data.nodes = !{!3, !4, !5, !6}
!0 = !{i32 2, i32 3, i32 1}
!1 = !{i32 2113342239, i32 1385488414, i32 -1007072744, i32 -815526592, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2}
!2 = !{i32 1792639877, i32 1348715323, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 64, i32 0, i32 0, i32 3}
!3 = !{!"DescriptorBuffer", i32 0, i32 4, i32 0, i32 0, i32 4}
!4 = !{!"DescriptorBuffer", i32 4, i32 16, i32 0, i32 1, i32 4}
!5 = !{!"DescriptorTableVaPtr", i32 20, i32 1, i32 1}
!6 = !{!"DescriptorBuffer", i32 0, i32 4, i32 0, i32 2, i32 4}
!7 = !{i32 7}