69 lines · plain
1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-vulkan-library %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-library %s -o - -filetype=obj | spirv-val %}3 4@.str.b0 = private unnamed_addr constant [3 x i8] c"B0\00", align 15 6; CHECK-NOT: OpCapability StorageImageReadWithoutFormat7 8; CHECK-DAG: OpDecorate [[IntBufferVar:%[0-9]+]] DescriptorSet 169; CHECK-DAG: OpDecorate [[IntBufferVar]] Binding 710 11; CHECK-DAG: [[int:%[0-9]+]] = OpTypeInt 32 012; CHECK-DAG: [[zero:%[0-9]+]] = OpConstant [[int]] 013; CHECK-DAG: [[v4_int:%[0-9]+]] = OpTypeVector [[int]] 414; CHECK-DAG: [[v2_int:%[0-9]+]] = OpTypeVector [[int]] 215; CHECK-DAG: [[RWBufferTypeInt:%[0-9]+]] = OpTypeImage [[int]] Buffer 2 0 0 2 R32i {{$}}16; CHECK-DAG: [[IntBufferPtrType:%[0-9]+]] = OpTypePointer UniformConstant [[RWBufferTypeInt]]17; CHECK-DAG: [[IntBufferVar]] = OpVariable [[IntBufferPtrType]] UniformConstant18 19; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}}20; CHECK-NEXT: OpLabel21define void @RWBufferLoad_Vec4_I32() #0 {22; CHECK: [[buffer:%[0-9]+]] = OpLoad [[RWBufferTypeInt]] [[IntBufferVar]]23 %buffer0 = call target("spirv.Image", i32, 5, 2, 0, 0, 2, 24)24 @llvm.spv.resource.handlefrombinding.tspirv.Image_i32_5_2_0_0_2_24(25 i32 16, i32 7, i32 1, i32 0, ptr nonnull @.str.b0)26 27; CHECK: OpImageRead [[v4_int]] [[buffer]] [[zero]]28 %data0 = call <4 x i32> @llvm.spv.resource.load.typedbuffer(29 target("spirv.Image", i32, 5, 2, 0, 0, 2, 24) %buffer0, i32 0)30 31 ret void32}33 34; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}}35; CHECK-NEXT: OpLabel36define void @RWBufferLoad_I32() #0 {37; CHECK: [[buffer:%[0-9]+]] = OpLoad [[RWBufferTypeInt]] [[IntBufferVar]]38 %buffer1 = call target("spirv.Image", i32, 5, 2, 0, 0, 2, 24)39 @llvm.spv.resource.handlefrombinding.tspirv.Image_i32_5_2_0_0_2_24(40 i32 16, i32 7, i32 1, i32 0, ptr nonnull @.str.b0)41 42; CHECK: [[V:%[0-9]+]] = OpImageRead [[v4_int]] [[buffer]] [[zero]]43; CHECK: OpCompositeExtract [[int]] [[V]] 044 %data1 = call i32 @llvm.spv.resource.load.typedbuffer(45 target("spirv.Image", i32, 5, 2, 0, 0, 2, 24) %buffer1, i32 0)46 47 ret void48}49 50; CHECK: {{%[0-9]+}} = OpFunction {{%[0-9]+}} DontInline {{%[0-9]+}}51; CHECK-NEXT: OpLabel52define void @RWBufferLoad_Vec2_I32() #0 {53; CHECK: [[buffer:%[0-9]+]] = OpLoad [[RWBufferTypeInt]] [[IntBufferVar]]54 %buffer0 = call target("spirv.Image", i32, 5, 2, 0, 0, 2, 24)55 @llvm.spv.resource.handlefrombinding.tspirv.Image_i32_5_2_0_0_2_24(56 i32 16, i32 7, i32 1, i32 0, ptr nonnull @.str.b0)57 58; CHECK: [[V:%[0-9]+]] = OpImageRead [[v4_int]] [[buffer]] [[zero]]59; CHECK: [[e0:%[0-9]+]] = OpCompositeExtract [[int]] [[V]] 060; CHECK: [[e1:%[0-9]+]] = OpCompositeExtract [[int]] [[V]] 161; CHECK: OpCompositeConstruct [[v2_int]] [[e0]] [[e1]]62 %data0 = call <2 x i32> @llvm.spv.resource.load.typedbuffer(63 target("spirv.Image", i32, 5, 2, 0, 0, 2, 24) %buffer0, i32 0)64 65 ret void66}67 68attributes #0 = { convergent noinline norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }69