1 ; RUN: opt -S -dxil-translate-metadata < %s | FileCheck %s
2 ; RUN: opt -S --passes="dxil-pretty-printer" < %s 2>&1 | FileCheck %s --check-prefix=PRINT
3 ; RUN: llc %s --filetype=asm -o - < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,PRINT
5 target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
6 target triple = "dxil-pc-shadermodel6.0-library"
8 %"class.hlsl::RWBuffer" = type { ptr }
11 ; PRINT:; Resource Bindings:
13 ; PRINT-NEXT:; Name Type Format Dim ID HLSL Bind Count
14 ; PRINT-NEXT:; ------------------------------ ---------- ------- ----------- ------- -------------- ------
15 ; PRINT-NEXT:; UAV f16 buf U0 u0 1
16 ; PRINT-NEXT:; UAV f32 buf U1 u1 1
17 ; PRINT-NEXT:; UAV f64 buf U2 u2 1
18 ; PRINT-NEXT:; UAV i1 buf U3 u3 2
19 ; PRINT-NEXT:; UAV byte r/w U4 u5 1
20 ; PRINT-NEXT:; UAV struct r/w U5 u6 1
21 ; PRINT-NEXT:; UAV i32 buf U6 u7 1
22 ; PRINT-NEXT:; UAV struct r/w U7 u8 1
23 ; PRINT-NEXT:; UAV byte r/w U8 u9 1
24 ; PRINT-NEXT:; UAV u64 buf U9 u10,space2 1
26 @Zero = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
27 @One = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
28 @Two = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
29 @Three = local_unnamed_addr global [2 x %"class.hlsl::RWBuffer"] zeroinitializer, align 4
30 @Four = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
31 @Five = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
32 @Six = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
33 @Seven = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
34 @Eight = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
35 @Nine = local_unnamed_addr global %"class.hlsl::RWBuffer" zeroinitializer, align 4
38 !hlsl.uavs = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9}
40 !0 = !{ptr @Zero, i32 10, i32 8, i1 false, i32 0, i32 0}
41 !1 = !{ptr @One, i32 10, i32 9, i1 false, i32 1, i32 0}
42 !2 = !{ptr @Two, i32 10, i32 10, i1 false, i32 2, i32 0}
43 !3 = !{ptr @Three, i32 10, i32 1, i1 false, i32 3, i32 0}
44 !4 = !{ptr @Four, i32 11, i32 2, i1 false, i32 5, i32 0}
45 !5 = !{ptr @Five, i32 12, i32 3, i1 false, i32 6, i32 0}
46 !6 = !{ptr @Six, i32 10, i32 4, i1 true, i32 7, i32 0}
47 !7 = !{ptr @Seven, i32 12, i32 5, i1 true, i32 8, i32 0}
48 !8 = !{ptr @Eight, i32 11, i32 6, i1 true, i32 9, i32 0}
49 !9 = !{ptr @Nine, i32 10, i32 7, i1 false, i32 10, i32 2}
51 ; CHECK: !dx.resources = !{[[ResList:[!][0-9]+]]}
53 ; CHECK: [[ResList]] = !{null, [[UAVList:[!][0-9]+]], null, null}
54 ; CHECK: [[UAVList]] = !{[[Zero:[!][0-9]+]], [[One:[!][0-9]+]],
55 ; CHECK-SAME: [[Two:[!][0-9]+]], [[Three:[!][0-9]+]], [[Four:[!][0-9]+]],
56 ; CHECK-SAME: [[Five:[!][0-9]+]], [[Six:[!][0-9]+]], [[Seven:[!][0-9]+]],
57 ; CHECK-SAME: [[Eight:[!][0-9]+]], [[Nine:[!][0-9]+]]}
58 ; CHECK: [[Zero]] = !{i32 0, ptr @Zero, !"", i32 0, i32 0, i32 1, i32 10, i1 false, i1 false, i1 false, [[Half:[!][0-9]+]]}
59 ; CHECK: [[Half]] = !{i32 0, i32 8}
60 ; CHECK: [[One]] = !{i32 1, ptr @One, !"", i32 0, i32 1, i32 1, i32 10, i1 false, i1 false, i1 false, [[Float:[!][0-9]+]]}
61 ; CHECK: [[Float]] = !{i32 0, i32 9}
62 ; CHECK: [[Two]] = !{i32 2, ptr @Two, !"", i32 0, i32 2, i32 1, i32 10, i1 false, i1 false, i1 false, [[Double:[!][0-9]+]]}
63 ; CHECK: [[Double]] = !{i32 0, i32 10}
64 ; CHECK: [[Three]] = !{i32 3, ptr @Three, !"", i32 0, i32 3, i32 2, i32 10, i1 false, i1 false, i1 false, [[Bool:[!][0-9]+]]}
65 ; CHECK: [[Bool]] = !{i32 0, i32 1}
66 ; CHECK: [[Four]] = !{i32 4, ptr @Four, !"", i32 0, i32 5, i32 1, i32 11, i1 false, i1 false, i1 false, [[I16:[!][0-9]+]]}
67 ; CHECK: [[I16]] = !{i32 0, i32 2}
68 ; CHECK: [[Five]] = !{i32 5, ptr @Five, !"", i32 0, i32 6, i32 1, i32 12, i1 false, i1 false, i1 false, [[U16:[!][0-9]+]]}
69 ; CHECK: [[U16]] = !{i32 0, i32 3}
70 ; CHECK: [[Six]] = !{i32 6, ptr @Six, !"", i32 0, i32 7, i32 1, i32 10, i1 false, i1 false, i1 true, [[I32:[!][0-9]+]]}
71 ; CHECK: [[I32]] = !{i32 0, i32 4}
72 ; CHECK: [[Seven]] = !{i32 7, ptr @Seven, !"", i32 0, i32 8, i32 1, i32 12, i1 false, i1 false, i1 true, [[U32:[!][0-9]+]]}
73 ; CHECK: [[U32]] = !{i32 0, i32 5}
74 ; CHECK: [[Eight]] = !{i32 8, ptr @Eight, !"", i32 0, i32 9, i32 1, i32 11, i1 false, i1 false, i1 true, [[I64:[!][0-9]+]]}
75 ; CHECK: [[I64]] = !{i32 0, i32 6}
76 ; CHECK: [[Nine]] = !{i32 9, ptr @Nine, !"", i32 2, i32 10, i32 1, i32 10, i1 false, i1 false, i1 false, [[U64:[!][0-9]+]]}
77 ; CHECK: [[U64]] = !{i32 0, i32 7}