138 lines · plain
1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-vulkan1.3-library %s -o - -filetype=obj | spirv-val --target-env vulkan1.3 %}3 4@.str.b0 = private unnamed_addr constant [3 x i8] c"B0\00", align 15 6; CHECK-DAG: [[uint:%[0-9]+]] = OpTypeInt 32 07; CHECK-DAG: [[v2int:%[0-9]+]] = OpTypeVector [[uint]] 28; CHECK-DAG: [[v4int:%[0-9]+]] = OpTypeVector [[uint]] 49; CHECK-DAG: [[zero:%[0-9]+]] = OpConstant [[uint]] 010; CHECK-DAG: [[one:%[0-9]+]] = OpConstant [[uint]] 111; CHECK-DAG: [[twenty:%[0-9]+]] = OpConstant [[uint]] 2012; CHECK-DAG: [[twenty_three:%[0-9]+]] = OpConstant [[uint]] 2313; CHECK-DAG: [[ImageType:%[0-9]+]] = OpTypeImage [[uint]] Buffer 2 0 0 2 Unknown 14; CHECK-DAG: [[ImagePtr:%[0-9]+]] = OpTypePointer UniformConstant [[ImageType]]15; CHECK-DAG: [[Var:%[0-9]+]] = OpVariable [[ImagePtr]] UniformConstant16 17; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none)18; CHECK: OpFunction19define void @main_scalar() local_unnamed_addr #0 {20entry:21; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]22 %s_h.i = tail call target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefrombinding.tspirv.Image_i32_5_2_0_0_2_0t(i32 3, i32 5, i32 1, i32 0, ptr nonnull @.str.b0)23 24; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4int]] [[H]] [[one]]25; CHECK: [[V:%[0-9]+]] = OpCompositeExtract [[uint]] [[R]] 026 %0 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 1)27 %1 = load i32, ptr %0, align 428; CHECK: OpBranch [[bb_store:%[0-9]+]]29 br label %bb_store30 31; CHECK: [[bb_store]] = OpLabel32bb_store:33 34; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]35; CHECK: OpImageWrite [[H]] [[zero]] [[V]]36 %2 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 0)37 store i32 %1, ptr %2, align 438; CHECK: OpBranch [[bb_both:%[0-9]+]]39 br label %bb_both40 41; CHECK: [[bb_both]] = OpLabel42bb_both: 43; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]44; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4int]] [[H]] [[twenty_three]]45; CHECK: [[V:%[0-9]+]] = OpCompositeExtract [[uint]] [[R]] 046 %3 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 23)47 %4 = load i32, ptr %3, align 448 49; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]50; CHECK: OpImageWrite [[H]] [[twenty]] [[V]]51 %5 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 20)52 store i32 %4, ptr %5, align 453 ret void54}55 56; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none)57; CHECK: OpFunction58define void @main_vector2() local_unnamed_addr #0 {59entry:60; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]61 %s_h.i = tail call target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefrombinding.tspirv.Image_i32_5_2_0_0_2_0t(i32 3, i32 5, i32 1, i32 0, ptr nonnull @.str.b0)62 63; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4int]] [[H]] [[one]]64; CHECK: [[E0:%[0-9]+]] = OpCompositeExtract [[uint]] [[R]] 065; CHECK: [[E1:%[0-9]+]] = OpCompositeExtract [[uint]] [[R]] 166; CHECK: [[V:%[0-9]+]] = OpCompositeConstruct [[v2int]] [[E0]] [[E1]]67 %0 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 1)68 %1 = load <2 x i32>, ptr %0, align 469; CHECK: OpBranch [[bb_store:%[0-9]+]]70 br label %bb_store71 72; CHECK: [[bb_store]] = OpLabel73bb_store:74 75; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]76; CHECK: OpImageWrite [[H]] [[zero]] [[V]]77 %2 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 0)78 store <2 x i32> %1, ptr %2, align 479; CHECK: OpBranch [[bb_both:%[0-9]+]]80 br label %bb_both81 82; CHECK: [[bb_both]] = OpLabel83bb_both:84; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]85; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4int]] [[H]] [[twenty_three]]86; CHECK: [[E0:%[0-9]+]] = OpCompositeExtract [[uint]] [[R]] 087; CHECK: [[E1:%[0-9]+]] = OpCompositeExtract [[uint]] [[R]] 188; CHECK: [[V:%[0-9]+]] = OpCompositeConstruct [[v2int]] [[E0]] [[E1]]89 %3 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 23)90 %4 = load <2 x i32>, ptr %3, align 491 92; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]93; CHECK: OpImageWrite [[H]] [[twenty]] [[V]]94 %5 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 20)95 store <2 x i32> %4, ptr %5, align 496 ret void97}98 99; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none)100; CHECK: OpFunction101define void @main_vector4() local_unnamed_addr #0 {102entry:103; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]104 %s_h.i = tail call target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefrombinding.tspirv.Image_i32_5_2_0_0_2_0t(i32 3, i32 5, i32 1, i32 0, ptr nonnull @.str.b0)105 106; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4int]] [[H]] [[one]]107 %0 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 1)108 %1 = load <4 x i32>, ptr %0, align 4109; CHECK: OpBranch [[bb_store:%[0-9]+]]110 br label %bb_store111 112; CHECK: [[bb_store]] = OpLabel113bb_store:114 115; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]116; CHECK: OpImageWrite [[H]] [[zero]] [[R]]117 %2 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 0)118 store <4 x i32> %1, ptr %2, align 4119; CHECK: OpBranch [[bb_both:%[0-9]+]]120 br label %bb_both121 122; CHECK: [[bb_both]] = OpLabel123bb_both:124; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]125; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4int]] [[H]] [[twenty_three]]126 %3 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 23)127 %4 = load <4 x i32>, ptr %3, align 4128 129; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]130; CHECK: OpImageWrite [[H]] [[twenty]] [[R]]131 %5 = tail call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %s_h.i, i32 20)132 store <4 x i32> %4, ptr %5, align 4133 ret void134}135 136attributes #0 = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }137attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(none) }138