139 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-DAG: [[float:%[0-9]+]] = OpTypeFloat 327; CHECK-DAG: [[v2float:%[0-9]+]] = OpTypeVector [[float]] 28; CHECK-DAG: [[v4float:%[0-9]+]] = OpTypeVector [[float]] 49; CHECK-DAG: [[int:%[0-9]+]] = OpTypeInt 32 010; CHECK-DAG: [[zero:%[0-9]+]] = OpConstant [[int]] 011; CHECK-DAG: [[one:%[0-9]+]] = OpConstant [[int]] 112; CHECK-DAG: [[twenty:%[0-9]+]] = OpConstant [[int]] 2013; CHECK-DAG: [[twenty_three:%[0-9]+]] = OpConstant [[int]] 2314; CHECK-DAG: [[ImageType:%[0-9]+]] = OpTypeImage [[float]] Buffer 2 0 0 2 Rgba32f 15; CHECK-DAG: [[ImagePtr:%[0-9]+]] = OpTypePointer UniformConstant [[ImageType]]16; CHECK-DAG: [[Var:%[0-9]+]] = OpVariable [[ImagePtr]] UniformConstant17 18; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none)19; CHECK: OpFunction20define void @main_scalar() local_unnamed_addr #0 {21entry:22; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]23 %s_h.i = tail call target("spirv.Image", float, 5, 2, 0, 0, 2, 1) @llvm.spv.resource.handlefrombinding.tspirv.Image_f32_5_2_0_0_2_0t(i32 3, i32 5, i32 1, i32 0, ptr nonnull @.str.b0)24 25; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4float]] [[H]] [[one]]26; CHECK: [[V:%[0-9]+]] = OpCompositeExtract [[float]] [[R]] 027 %0 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 1)28 %1 = load float, ptr %0, align 429; CHECK: OpBranch [[bb_store:%[0-9]+]]30 br label %bb_store31 32; CHECK: [[bb_store]] = OpLabel33bb_store:34 35; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]36; CHECK: OpImageWrite [[H]] [[zero]] [[V]]37 %2 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 0)38 store float %1, ptr %2, align 439; CHECK: OpBranch [[bb_both:%[0-9]+]]40 br label %bb_both41 42; CHECK: [[bb_both]] = OpLabel43bb_both: 44; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]45; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4float]] [[H]] [[twenty_three]]46; CHECK: [[V:%[0-9]+]] = OpCompositeExtract [[float]] [[R]] 047 %3 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 23)48 %4 = load float, ptr %3, align 449 50; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]51; CHECK: OpImageWrite [[H]] [[twenty]] [[V]]52 %5 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 20)53 store float %4, ptr %5, align 454 ret void55}56 57; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none)58; CHECK: OpFunction59define void @main_vector2() local_unnamed_addr #0 {60entry:61; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]62 %s_h.i = tail call target("spirv.Image", float, 5, 2, 0, 0, 2, 1) @llvm.spv.resource.handlefrombinding.tspirv.Image_f32_5_2_0_0_2_0t(i32 3, i32 5, i32 1, i32 0, ptr nonnull @.str.b0)63 64; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4float]] [[H]] [[one]]65; CHECK: [[E0:%[0-9]+]] = OpCompositeExtract [[float]] [[R]] 066; CHECK: [[E1:%[0-9]+]] = OpCompositeExtract [[float]] [[R]] 167; CHECK: [[V:%[0-9]+]] = OpCompositeConstruct [[v2float]] [[E0]] [[E1]]68 %0 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 1)69 %1 = load <2 x float>, ptr %0, align 470; CHECK: OpBranch [[bb_store:%[0-9]+]]71 br label %bb_store72 73; CHECK: [[bb_store]] = OpLabel74bb_store:75 76; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]77; CHECK: OpImageWrite [[H]] [[zero]] [[V]]78 %2 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 0)79 store <2 x float> %1, ptr %2, align 480; CHECK: OpBranch [[bb_both:%[0-9]+]]81 br label %bb_both82 83; CHECK: [[bb_both]] = OpLabel84bb_both:85; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]86; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4float]] [[H]] [[twenty_three]]87; CHECK: [[E0:%[0-9]+]] = OpCompositeExtract [[float]] [[R]] 088; CHECK: [[E1:%[0-9]+]] = OpCompositeExtract [[float]] [[R]] 189; CHECK: [[V:%[0-9]+]] = OpCompositeConstruct [[v2float]] [[E0]] [[E1]]90 %3 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 23)91 %4 = load <2 x float>, ptr %3, align 492 93; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]94; CHECK: OpImageWrite [[H]] [[twenty]] [[V]]95 %5 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 20)96 store <2 x float> %4, ptr %5, align 497 ret void98}99 100; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none)101; CHECK: OpFunction102define void @main_vector4() local_unnamed_addr #0 {103entry:104; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]105 %s_h.i = tail call target("spirv.Image", float, 5, 2, 0, 0, 2, 1) @llvm.spv.resource.handlefrombinding.tspirv.Image_f32_5_2_0_0_2_0t(i32 3, i32 5, i32 1, i32 0, ptr nonnull @.str.b0)106 107; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4float]] [[H]] [[one]]108 %0 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 1)109 %1 = load <4 x float>, ptr %0, align 4110; CHECK: OpBranch [[bb_store:%[0-9]+]]111 br label %bb_store112 113; CHECK: [[bb_store]] = OpLabel114bb_store:115 116; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]117; CHECK: OpImageWrite [[H]] [[zero]] [[R]]118 %2 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 0)119 store <4 x float> %1, ptr %2, align 4120; CHECK: OpBranch [[bb_both:%[0-9]+]]121 br label %bb_both122 123; CHECK: [[bb_both]] = OpLabel124bb_both:125; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]126; CHECK: [[R:%[0-9]+]] = OpImageRead [[v4float]] [[H]] [[twenty_three]]127 %3 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 23)128 %4 = load <4 x float>, ptr %3, align 4129 130; CHECK: [[H:%[0-9]+]] = OpLoad [[ImageType]] [[Var]]131; CHECK: OpImageWrite [[H]] [[twenty]] [[R]]132 %5 = 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", float, 5, 2, 0, 0, 2, 1) %s_h.i, i32 20)133 store <4 x float> %4, ptr %5, align 4134 ret void135}136 137attributes #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" }138attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(none) }139