xref: /llvm-project/llvm/test/CodeGen/DirectX/Metadata/resource-symbols.ll (revision aa07f922103ebe8e78c8da4c754b43af3c129f3e)
10e2466f6SJustin Bogner; RUN: opt -S -passes=dxil-translate-metadata %s | FileCheck %s
20e2466f6SJustin Bogner
30e2466f6SJustin Bognertarget triple = "dxil-pc-shadermodel6.6-compute"
40e2466f6SJustin Bogner
50e2466f6SJustin Bogner%struct.S = type { <4 x float>, <4 x i32> }
60e2466f6SJustin Bogner
70e2466f6SJustin Bognerdefine void @test() {
80e2466f6SJustin Bogner  ; Buffer<float4>
90e2466f6SJustin Bogner  %float4 = call target("dx.TypedBuffer", <4 x float>, 0, 0, 0)
10*aa07f922SJustin Bogner      @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, i1 false)
110e2466f6SJustin Bogner  ; CHECK: %TypedBuffer = type { <4 x float> }
120e2466f6SJustin Bogner
130e2466f6SJustin Bogner  ; Buffer<int>
140e2466f6SJustin Bogner  %int = call target("dx.TypedBuffer", i32, 0, 0, 1)
15*aa07f922SJustin Bogner      @llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 1, i32 0, i1 false)
160e2466f6SJustin Bogner  ; CHECK: %TypedBuffer.0 = type { i32 }
170e2466f6SJustin Bogner
180e2466f6SJustin Bogner  ; Buffer<uint3>
190e2466f6SJustin Bogner  %uint3 = call target("dx.TypedBuffer", <3 x i32>, 0, 0, 0)
20*aa07f922SJustin Bogner      @llvm.dx.resource.handlefrombinding(i32 0, i32 2, i32 1, i32 0, i1 false)
210e2466f6SJustin Bogner  ; CHECK: %TypedBuffer.1 = type { <3 x i32> }
220e2466f6SJustin Bogner
230e2466f6SJustin Bogner  ; StructuredBuffer<S>
240e2466f6SJustin Bogner  %struct0 = call target("dx.RawBuffer", %struct.S, 0, 0)
25*aa07f922SJustin Bogner      @llvm.dx.resource.handlefrombinding(i32 0, i32 10, i32 1, i32 0, i1 true)
260e2466f6SJustin Bogner  ; CHECK: %StructuredBuffer = type { %struct.S }
270e2466f6SJustin Bogner
280e2466f6SJustin Bogner  ; ByteAddressBuffer
290e2466f6SJustin Bogner  %byteaddr = call target("dx.RawBuffer", i8, 0, 0)
30*aa07f922SJustin Bogner      @llvm.dx.resource.handlefrombinding(i32 0, i32 20, i32 1, i32 0, i1 false)
310e2466f6SJustin Bogner  ; CHECK: %ByteAddressBuffer = type { i32 }
320e2466f6SJustin Bogner
330e2466f6SJustin Bogner  ret void
340e2466f6SJustin Bogner}
350e2466f6SJustin Bogner
360e2466f6SJustin Bogner; CHECK:      @[[T0:.*]] = external constant %TypedBuffer
370e2466f6SJustin Bogner; CHECK-NEXT: @[[T1:.*]] = external constant %TypedBuffer.0
380e2466f6SJustin Bogner; CHECK-NEXT: @[[T2:.*]] = external constant %TypedBuffer.1
390e2466f6SJustin Bogner; CHECK-NEXT: @[[S0:.*]] = external constant %StructuredBuffer
400e2466f6SJustin Bogner; CHECK-NEXT: @[[B0:.*]] = external constant %ByteAddressBuffer
410e2466f6SJustin Bogner
420e2466f6SJustin Bogner; CHECK: !{i32 0, ptr @[[T0]], !""
430e2466f6SJustin Bogner; CHECK: !{i32 1, ptr @[[T1]], !""
440e2466f6SJustin Bogner; CHECK: !{i32 2, ptr @[[T2]], !""
450e2466f6SJustin Bogner; CHECK: !{i32 3, ptr @[[S0]], !""
460e2466f6SJustin Bogner; CHECK: !{i32 4, ptr @[[B0]], !""
470e2466f6SJustin Bogner
480e2466f6SJustin Bognerattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
49