@@ -32,43 +32,53 @@ target triple = "dxil-pc-shadermodel6.6-compute"
3232; PRINT-NEXT:; SRV byte r/o T4 t5 1
3333; PRINT-NEXT:; SRV struct r/o T5 t6 1
3434; PRINT-NEXT:; SRV u64 buf T6 t10,space2 1
35+ ; PRINT-NEXT:; SRV f32 buf T7 t4,space3 100
3536
3637define void @test () #0 {
37- ; Buffer<half4> Buf : register(u0 )
38+ ; Buffer<half4> Buf : register(t0 )
3839 %Zero_h = call target ("dx.TypedBuffer" , <4 x half >, 0 , 0 , 0 )
3940 @llvm.dx.resource.handlefrombinding (i32 0 , i32 0 , i32 1 , i32 0 , i1 false )
4041 store target ("dx.TypedBuffer" , <4 x half >, 0 , 0 , 0 ) %Zero_h , ptr @Zero , align 4
4142
42- ; Buffer<float4> Buf : register(u1 )
43+ ; Buffer<float4> Buf : register(t1 )
4344 %One_h = call target ("dx.TypedBuffer" , <2 x float >, 0 , 0 , 0 )
4445 @llvm.dx.resource.handlefrombinding (i32 0 , i32 1 , i32 1 , i32 0 , i1 false )
4546 store target ("dx.TypedBuffer" , <2 x float >, 0 , 0 , 0 ) %One_h , ptr @One , align 4
4647
47- ; Buffer<double> Two : register(u2 );
48+ ; Buffer<double> Two : register(t2 );
4849 %Two_h = call target ("dx.TypedBuffer" , double , 0 , 0 , 0 )
4950 @llvm.dx.resource.handlefrombinding (i32 0 , i32 2 , i32 1 , i32 0 , i1 false )
5051 store target ("dx.TypedBuffer" , double , 0 , 0 , 0 ) %Two_h , ptr @Two , align 4
5152
52- ; Buffer<int4> Three : register(u3 );
53+ ; Buffer<int4> Three : register(t3 );
5354 %Three_h = call target ("dx.TypedBuffer" , <4 x i32 >, 0 , 0 , 1 )
5455 @llvm.dx.resource.handlefrombinding (i32 0 , i32 3 , i32 1 , i32 0 , i1 false )
5556 store target ("dx.TypedBuffer" , <4 x i32 >, 0 , 0 , 1 ) %Three_h , ptr @Three , align 4
5657
57- ; ByteAddressBuffer Four : register(u4 )
58+ ; ByteAddressBuffer Four : register(t4 )
5859 %Four_h = call target ("dx.RawBuffer" , i8 , 0 , 0 )
5960 @llvm.dx.resource.handlefrombinding (i32 0 , i32 5 , i32 1 , i32 0 , i1 false )
6061 store target ("dx.RawBuffer" , i8 , 0 , 0 ) %Four_h , ptr @Four , align 4
6162
62- ; StructuredBuffer<int16_t> Five : register(u6 );
63+ ; StructuredBuffer<int16_t> Five : register(t6 );
6364 %Five_h = call target ("dx.RawBuffer" , i16 , 0 , 0 )
6465 @llvm.dx.resource.handlefrombinding (i32 0 , i32 6 , i32 1 , i32 0 , i1 false )
6566 store target ("dx.RawBuffer" , i16 , 0 , 0 ) %Five_h , ptr @Five , align 4
6667
67- ; Buffer<double> Two : register(u2 );
68+ ; Buffer<double> Six : register(t10, space2 );
6869 %Six_h = call target ("dx.TypedBuffer" , i64 , 0 , 0 , 0 )
6970 @llvm.dx.resource.handlefrombinding (i32 2 , i32 10 , i32 1 , i32 0 , i1 false )
7071 store target ("dx.TypedBuffer" , i64 , 0 , 0 , 0 ) %Six_h , ptr @Six , align 4
7172
73+ ; Buffer<float4> Array[100] : register(t4, space3);
74+ ; Buffer<float4> B1 = Array[30];
75+ ; Buffer<float4> B1 = Array[42];
76+ ; resource array accesses should produce one metadata entry
77+ %Array_30_h = call target ("dx.TypedBuffer" , <4 x float >, 0 , 0 , 0 )
78+ @llvm.dx.resource.handlefrombinding (i32 3 , i32 4 , i32 100 , i32 30 , i1 false )
79+ %Array_42_h = call target ("dx.TypedBuffer" , <4 x float >, 0 , 0 , 0 )
80+ @llvm.dx.resource.handlefrombinding (i32 3 , i32 4 , i32 100 , i32 42 , i1 false )
81+
7282 ret void
7383}
7484
@@ -79,7 +89,7 @@ attributes #0 = { noinline nounwind "hlsl.shader"="compute" }
7989; CHECK: [[ResList]] = !{[[SRVList:[!][0-9]+]], null, null, null}
8090; CHECK: [[SRVList]] = !{![[Zero:[0-9]+]], ![[One:[0-9]+]], ![[Two:[0-9]+]],
8191; CHECK-SAME: ![[Three:[0-9]+]], ![[Four:[0-9]+]], ![[Five:[0-9]+]],
82- ; CHECK-SAME: ![[Six:[0-9]+]]}
92+ ; CHECK-SAME: ![[Six:[0-9]+]], ![[Array:[0-9]+]] }
8393
8494; CHECK: ![[Zero]] = !{i32 0, ptr @0, !"", i32 0, i32 0, i32 1, i32 10, i32 0, ![[Half:[0-9]+]]}
8595; CHECK: ![[Half]] = !{i32 0, i32 8}
@@ -94,3 +104,4 @@ attributes #0 = { noinline nounwind "hlsl.shader"="compute" }
94104; CHECK: ![[FiveStride]] = !{i32 1, i32 2}
95105; CHECK: ![[Six]] = !{i32 6, ptr @6, !"", i32 2, i32 10, i32 1, i32 10, i32 0, ![[U64:[0-9]+]]}
96106; CHECK: ![[U64]] = !{i32 0, i32 7}
107+ ; CHECK: ![[Array]] = !{i32 7, ptr @7, !"", i32 3, i32 4, i32 100, i32 10, i32 0, ![[Float]]}
0 commit comments