Debian Codegraph @

llvm/test/CodeGen/SPIRV/hlsl-resources/StorageImageConstIdx.ll

raw
1 ; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv1.5-vulkan-library %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.5-vulkan-library %s -o - -filetype=obj | spirv-val %}
3
4 @.str.b0 = private unnamed_addr constant [3 x i8] c"B0\00", align 1
5
6 ; CHECK-DAG: OpCapability Shader
7 ; CHECK-DAG: OpCapability Image1D
8 ; CHECK-DAG: OpCapability Int8
9 ; CHECK-NOT: OpCapability
10
11 ; CHECK-DAG: OpDecorate [[Var:%[0-9]+]] DescriptorSet 3
12 ; CHECK-DAG: OpDecorate [[Var]] Binding 4
13
14 ; CHECK-DAG: [[int:%[0-9]+]] = OpTypeInt 32 0
15 ; CHECK-DAG: [[BufferType:%[0-9]+]] = OpTypeImage [[int]] 1D 2 0 0 2 R32i {{$}}
16 ; CHECK-DAG: [[BufferPtrType:%[0-9]+]] = OpTypePointer UniformConstant [[BufferType]]
17 ; CHECK-DAG: [[ArraySize:%[0-9]+]] = OpConstant [[int]] 3
18 ; CHECK-DAG: [[One:%[0-9]+]] = OpConstant [[int]] 1
19 ; CHECK-DAG: [[Zero:%[0-9]+]] = OpConstant [[int]] 0{{$}}
20 ; CHECK-DAG: [[BufferArrayType:%[0-9]+]] = OpTypeArray [[BufferType]] [[ArraySize]]
21 ; CHECK-DAG: [[ArrayPtrType:%[0-9]+]] = OpTypePointer UniformConstant [[BufferArrayType]]
22 ; CHECK-DAG: [[Var]] = OpVariable [[ArrayPtrType]] UniformConstant
23
24 ; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}}
25 ; CHECK-NEXT: OpLabel
26 define void @main() #0 {
27 ; CHECK: [[ac:%[0-9]+]] = OpAccessChain [[BufferPtrType]] [[Var]] [[Zero]]
28 ; CHECK: [[buffer:%[0-9]+]] = OpLoad [[BufferType]] [[ac]]
29 %buffer0 = call target("spirv.Image", i32, 0, 2, 0, 0, 2, 24)
30 @llvm.spv.resource.handlefrombinding.tspirv.Image_f32_0_2_0_0_2_24(
31 i32 3, i32 4, i32 3, i32 0, ptr nonnull @.str.b0)
32 %ptr0 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_f32_5_2_0_0_2_0t(target("spirv.Image", i32, 0, 2, 0, 0, 2, 24) %buffer0, i32 0)
33 store i32 0, ptr %ptr0, align 4
34
35 ; CHECK: [[ac:%[0-9]+]] = OpAccessChain [[BufferPtrType]] [[Var]] [[One]]
36 ; CHECK: [[buffer:%[0-9]+]] = OpLoad [[BufferType]] [[ac]]
37 %buffer1 = call target("spirv.Image", i32, 0, 2, 0, 0, 2, 24)
38 @llvm.spv.resource.handlefrombinding.tspirv.Image_f32_0_2_0_0_2_24(
39 i32 3, i32 4, i32 3, i32 1, ptr nonnull @.str.b0)
40 %ptr1 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_f32_5_2_0_0_2_0t(target("spirv.Image", i32, 0, 2, 0, 0, 2, 24) %buffer1, i32 0)
41 store i32 0, ptr %ptr1, align 4
42 ret void
43 }
44
45 attributes #0 = { convergent noinline norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }