59 lines · plain
1; RUN: opt -S -passes=dxil-translate-metadata %s | FileCheck %s2 3target triple = "dxil-pc-shadermodel6.6-compute"4 5@A.str = private unnamed_addr constant [2 x i8] c"A\00", align 16@SB.str = private unnamed_addr constant [3 x i8] c"SB\00", align 17 8%struct.S = type { <4 x float>, <4 x i32> }9 10define void @test() {11 ; Buffer<float4>12 %float4 = call target("dx.TypedBuffer", <4 x float>, 0, 0, 0)13 @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr @A.str)14 ; CHECK: %"Buffer<float4>" = type { <4 x float> }15 16 ; Buffer<int>17 %int = call target("dx.TypedBuffer", i32, 0, 0, 1)18 @llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 1, i32 0, ptr null)19 ; CHECK: %"Buffer<int32_t>" = type { i32 }20 21 ; Buffer<uint3>22 %uint3 = call target("dx.TypedBuffer", <3 x i32>, 0, 0, 0)23 @llvm.dx.resource.handlefrombinding(i32 0, i32 2, i32 1, i32 0, ptr null)24 ; CHECK: %"Buffer<uint32_t3>" = type { <3 x i32> }25 26 ; StructuredBuffer<S>27 %struct0 = call target("dx.RawBuffer", %struct.S, 0, 0)28 @llvm.dx.resource.handlefrombinding(i32 0, i32 10, i32 1, i32 0, ptr @SB.str)29 ; CHECK: %"StructuredBuffer<struct.S>" = type { %struct.S }30 31 ; StructuredBuffer<float[3][2]>32 %struct1 = call target("dx.RawBuffer", [3 x [2 x float]], 0, 0)33 @llvm.dx.resource.handlefrombinding(i32 0, i32 12, i32 1, i32 0, ptr null)34 ; CHECK: %"StructuredBuffer<float[3][2]>" = type { [3 x [2 x float]] }35 36 ; ByteAddressBuffer37 %byteaddr = call target("dx.RawBuffer", i8, 0, 0)38 @llvm.dx.resource.handlefrombinding(i32 0, i32 20, i32 1, i32 0, ptr null)39 ; CHECK: %ByteAddressBuffer = type { i32 }40 41 ret void42}43 44; CHECK: @[[T0:.*]] = external constant %"Buffer<float4>"45; CHECK-NEXT: @[[T1:.*]] = external constant %"Buffer<int32_t>"46; CHECK-NEXT: @[[T2:.*]] = external constant %"Buffer<uint32_t3>"47; CHECK-NEXT: @[[S0:.*]] = external constant %"StructuredBuffer<struct.S>"48; CHECK-NEXT: @[[S1:.*]] = external constant %"StructuredBuffer<float[3][2]>"49; CHECK-NEXT: @[[B0:.*]] = external constant %ByteAddressBuffer50 51; CHECK: !{i32 0, ptr @[[T0]], !"A"52; CHECK: !{i32 1, ptr @[[T1]], !""53; CHECK: !{i32 2, ptr @[[T2]], !""54; CHECK: !{i32 3, ptr @[[S0]], !"SB"55; CHECK: !{i32 4, ptr @[[S1]], !""56; CHECK: !{i32 5, ptr @[[B0]], !""57 58attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }59