brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 6b90e17 Raw
90 lines · plain
1; RUN: opt -S -dxil-translate-metadata < %s | FileCheck %s2; RUN: opt -S --passes="dxil-pretty-printer" < %s 2>&1 | FileCheck %s --check-prefix=PRINT3; RUN: llc %s --filetype=asm -o - < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,PRINT4 5target triple = "dxil-pc-shadermodel6.6-compute"6 7%__cblayout_CB1 = type <{ float, i32, double, <2 x i32> }>8@CB1.cb = global target("dx.CBuffer", %__cblayout_CB1) poison9@CB1.str = private unnamed_addr constant [4 x i8] c"CB1\00", align 110 11%__cblayout_CB2 = type <{ float, target("dx.Padding", 4), double, float, half, i16, i64, i32 }>12@CB2.cb = global target("dx.CBuffer", %__cblayout_CB2) poison13@CB2.str = private unnamed_addr constant [4 x i8] c"CB2\00", align 114 15%__cblayout_MyConstants = type <{16  double, target("dx.Padding", 8),17  <3 x float>, float,18  <3 x double>, half, target("dx.Padding", 6),19  <2 x double>,20  float, <3 x half>, <3 x half>21}>22@MyConstants.cb = global target("dx.CBuffer", %__cblayout_MyConstants) poison23@MyConstants.str = private unnamed_addr constant [12 x i8] c"MyConstants\00", align 124 25; PRINT:; Resource Bindings:26; PRINT-NEXT:;27; PRINT-NEXT:; Name            Type  Format  Dim   ID    HLSL Bind  Count28; PRINT-NEXT:; ----29; PRINT-NEXT:; CB1          cbuffer      NA   NA  CB0          cb0     130; PRINT-NEXT:; CB2          cbuffer      NA   NA  CB1          cb1     131; PRINT-NEXT:; MyConstants  cbuffer      NA   NA  CB2  cb5,space15     132 33define void @test() #0 {34 35  ; cbuffer CB1 : register(b0) {36  ;   float a;37  ;   int b;38  ;   double c;39  ;   int2 d;40  ; }41  %CB1.cb_h = call target("dx.CBuffer", %__cblayout_CB1)42            @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr @CB1.str)43 44  ; cbuffer CB2 : register(b0) {45  ;   float a;46  ;   double b;47  ;   float c;48  ;   half d;49  ;   uint16_t e;50  ;   int64_t f;51  ;   int g;52  ;}53  %CB2.cb_h = call target("dx.CBuffer", %__cblayout_CB2)54            @llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 1, i32 0, ptr @CB2.str)55 56  ; cbuffer CB3 : register(b5) {57  ;   double B0;58  ;   float3 B1;59  ;   float B2;60  ;   double3 B3;61  ;   half B4;62  ;   double2 B5;63  ;   float B6;64  ;   half3 B7;65  ;   half3 B8;66  ; }67  %CB3.cb_h = call target("dx.CBuffer", %__cblayout_MyConstants)68            @llvm.dx.resource.handlefrombinding(i32 15, i32 5, i32 1, i32 0, ptr @MyConstants.str)69 70  ret void71}72 73attributes #0 = { noinline nounwind "hlsl.shader"="compute" }74 75; CHECK: %CBuffer.CB1 = type { { float, i32, double, <2 x i32> } }76; CHECK: %CBuffer.CB2 = type { { float, double, float, half, i16, i64, i32 } }77; CHECK: %CBuffer.MyConstants = type { { double, <3 x float>, float, <3 x double>, half, <2 x double>, float, <3 x half>, <3 x half> } }78 79; CHECK: @CB1 = external constant %CBuffer.CB180; CHECK: @CB2 = external constant %CBuffer.CB281; CHECK: @MyConstants = external constant %CBuffer.MyConstants82 83; CHECK: !dx.resources = !{[[ResList:[!][0-9]+]]}84 85; CHECK: [[ResList]] = !{null, null, [[CBList:[!][0-9]+]], null}86; CHECK: [[CBList]] = !{![[CB1:[0-9]+]], ![[CB2:[0-9]+]], ![[MYCONSTANTS:[0-9]+]]}87; CHECK: ![[CB1]] = !{i32 0, ptr @CB1, !"CB1", i32 0, i32 0, i32 1, i32 24, null}88; CHECK: ![[CB2]] = !{i32 1, ptr @CB2, !"CB2", i32 0, i32 1, i32 1, i32 36, null}89; CHECK: ![[MYCONSTANTS]] = !{i32 2, ptr @MyConstants, !"MyConstants", i32 15, i32 5, i32 1, i32 96, null}90