brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 8fba0a4 Raw
55 lines · plain
1; RUN: opt -S -dxil-cbuffer-access -mtriple=dxil--shadermodel6.3-library %s | FileCheck %s2;3; Check that two uses of an identical GEP constant expression generates two4; separate getpointer/gep pairs in the output.5 6; cbuffer CB : register(b0) {7;   float a1[3];8; }9%__cblayout_CB = type <{ [2 x <{ float, [12 x i8] }>], float }>10 11@CB.cb = local_unnamed_addr global target("dx.CBuffer", %__cblayout_CB) poison12; CHECK: @CB.cb =13; CHECK-NOT: external {{.*}} addrspace(2) global14@a1 = external addrspace(2) global <{ [2 x <{ float, [12 x i8] }>], float }>, align 415 16; CHECK: define void @f17define void @f(ptr %dst) {18entry:19  ; CHECK: [[PTR:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)20  ; CHECK: [[GEP:%.*]] = getelementptr inbounds nuw i8, ptr addrspace(2) [[PTR]], i32 1621  ; CHECK-COUNT-2: load float, ptr addrspace(2) [[GEP]]22  %a1 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 423  store float %a1, ptr %dst, align 3224 25  %a2 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 426  store float %a2, ptr %dst, align 3227 28  ret void29}30 31; CHECK: define void @g32define void @g(ptr %dst) {33entry:34  ; CHECK: [[PTR1:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)35  ; CHECK: [[GEP1:%.*]] = getelementptr inbounds nuw i8, ptr addrspace(2) [[PTR1]], i32 1636  ; CHECK: load float, ptr addrspace(2) [[GEP1]]37  %a1 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 438  store float %a1, ptr %dst, align 3239  br label %next40 41next:42  ; CHECK: [[PTR2:%.*]] = call ptr addrspace(2) @llvm.dx.resource.getpointer.{{.*}}(target("dx.CBuffer", %__cblayout_CB) {{%.*}}, i32 0)43  ; CHECK: [[GEP2:%.*]] = getelementptr inbounds nuw i8, ptr addrspace(2) [[PTR2]], i32 1644  ; CHECK: load float, ptr addrspace(2) [[GEP2]]45  %a2 = load float, ptr addrspace(2) getelementptr inbounds nuw (i8, ptr addrspace(2) @a1, i32 16), align 446  store float %a2, ptr %dst, align 3247 48  ret void49}50 51; CHECK-NOT: !hlsl.cbs =52!hlsl.cbs = !{!0}53 54!0 = !{ptr @CB.cb, ptr addrspace(2) @a1}55