1; RUN: opt -S -passes=dxil-translate-metadata %s | FileCheck %s 2 3target triple = "dxil-pc-shadermodel6.6-compute" 4 5%struct.S = type { <4 x float>, <4 x i32> } 6 7define void @test() { 8 ; Buffer<float4> 9 %float4 = call target("dx.TypedBuffer", <4 x float>, 0, 0, 0) 10 @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, i1 false) 11 ; CHECK: %TypedBuffer = type { <4 x float> } 12 13 ; Buffer<int> 14 %int = call target("dx.TypedBuffer", i32, 0, 0, 1) 15 @llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 1, i32 0, i1 false) 16 ; CHECK: %TypedBuffer.0 = type { i32 } 17 18 ; Buffer<uint3> 19 %uint3 = call target("dx.TypedBuffer", <3 x i32>, 0, 0, 0) 20 @llvm.dx.resource.handlefrombinding(i32 0, i32 2, i32 1, i32 0, i1 false) 21 ; CHECK: %TypedBuffer.1 = type { <3 x i32> } 22 23 ; StructuredBuffer<S> 24 %struct0 = call target("dx.RawBuffer", %struct.S, 0, 0) 25 @llvm.dx.resource.handlefrombinding(i32 0, i32 10, i32 1, i32 0, i1 true) 26 ; CHECK: %StructuredBuffer = type { %struct.S } 27 28 ; ByteAddressBuffer 29 %byteaddr = call target("dx.RawBuffer", i8, 0, 0) 30 @llvm.dx.resource.handlefrombinding(i32 0, i32 20, i32 1, i32 0, i1 false) 31 ; CHECK: %ByteAddressBuffer = type { i32 } 32 33 ret void 34} 35 36; CHECK: @[[T0:.*]] = external constant %TypedBuffer 37; CHECK-NEXT: @[[T1:.*]] = external constant %TypedBuffer.0 38; CHECK-NEXT: @[[T2:.*]] = external constant %TypedBuffer.1 39; CHECK-NEXT: @[[S0:.*]] = external constant %StructuredBuffer 40; CHECK-NEXT: @[[B0:.*]] = external constant %ByteAddressBuffer 41 42; CHECK: !{i32 0, ptr @[[T0]], !"" 43; CHECK: !{i32 1, ptr @[[T1]], !"" 44; CHECK: !{i32 2, ptr @[[T2]], !"" 45; CHECK: !{i32 3, ptr @[[S0]], !"" 46; CHECK: !{i32 4, ptr @[[B0]], !"" 47 48attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) } 49