Skip to content

Commit 56d1102

Browse files
committed
fixup: Add typedgep test back
1 parent 4bff70a commit 56d1102

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
; RUN: opt -S -dxil-cbuffer-access -mtriple=dxil--shadermodel6.3-library %s | FileCheck %s
2+
3+
; cbuffer CB : register(b0) {
4+
; float a1[3];
5+
; }
6+
%__cblayout_CB = type <{
7+
<{ [2 x <{ float, target("dx.Padding", 12) }>], float }>
8+
}>
9+
10+
@CB.cb = local_unnamed_addr global target("dx.CBuffer", %__cblayout_CB) poison
11+
; CHECK: @CB.cb =
12+
; CHECK-NOT: external {{.*}} addrspace(2) global
13+
@a1 = external local_unnamed_addr addrspace(2) global <{ [2 x <{ float, target("dx.Padding", 12) }>], float }>, align 4
14+
15+
; CHECK: define void @f
16+
define void @f(ptr %dst) {
17+
entry:
18+
%CB.cb_h = call target("dx.CBuffer", %__cblayout_CB) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)
19+
store target("dx.CBuffer", %__cblayout_CB) %CB.cb_h, ptr @CB.cb, align 4
20+
21+
; a1[1] (accessed via typed gep)
22+
;
23+
; CHECK: [[PTR:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)
24+
; CHECK: getelementptr inbounds <{ [2 x <{ float, target("dx.Padding", 12) }>], float }>, ptr addrspace(2) [[PTR]], i32 1, i32 0
25+
%a1 = load float, ptr addrspace(2) getelementptr inbounds (<{ [2 x <{ float, target("dx.Padding", 12) }>], float }>, ptr addrspace(2) @a1, i32 1, i32 0), align 4
26+
store float %a1, ptr %dst, align 32
27+
28+
ret void
29+
}
30+
31+
; CHECK-NOT: !hlsl.cbs =
32+
!hlsl.cbs = !{!0}
33+
34+
!0 = !{ptr @CB.cb, ptr addrspace(2) @a1}

0 commit comments

Comments
 (0)