From: Matt Arsenault Date: Tue, 21 Mar 2017 16:32:17 +0000 (+0000) Subject: AMDGPU: Fix asserting on 0 dmask for image intrinsics X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5f0660c6b76bfaebed5c68d51a52b91e2eba47c;p=llvm AMDGPU: Fix asserting on 0 dmask for image intrinsics Fold these to undef during lowering so users get eliminated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298387 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AMDGPU/SIISelLowering.cpp b/lib/Target/AMDGPU/SIISelLowering.cpp index 8a631995737..dfdc233d09d 100644 --- a/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/lib/Target/AMDGPU/SIISelLowering.cpp @@ -2988,6 +2988,64 @@ SDValue SITargetLowering::LowerINTRINSIC_W_CHAIN(SDValue Op, return DAG.getMemIntrinsicNode(Opc, DL, Op->getVTList(), Ops, IntVT, MMO); } + // Basic sample. + case Intrinsic::amdgcn_image_sample: + case Intrinsic::amdgcn_image_sample_cl: + case Intrinsic::amdgcn_image_sample_d: + case Intrinsic::amdgcn_image_sample_d_cl: + case Intrinsic::amdgcn_image_sample_l: + case Intrinsic::amdgcn_image_sample_b: + case Intrinsic::amdgcn_image_sample_b_cl: + case Intrinsic::amdgcn_image_sample_lz: + case Intrinsic::amdgcn_image_sample_cd: + case Intrinsic::amdgcn_image_sample_cd_cl: + + // Sample with comparison. + case Intrinsic::amdgcn_image_sample_c: + case Intrinsic::amdgcn_image_sample_c_cl: + case Intrinsic::amdgcn_image_sample_c_d: + case Intrinsic::amdgcn_image_sample_c_d_cl: + case Intrinsic::amdgcn_image_sample_c_l: + case Intrinsic::amdgcn_image_sample_c_b: + case Intrinsic::amdgcn_image_sample_c_b_cl: + case Intrinsic::amdgcn_image_sample_c_lz: + case Intrinsic::amdgcn_image_sample_c_cd: + case Intrinsic::amdgcn_image_sample_c_cd_cl: + + // Sample with offsets. + case Intrinsic::amdgcn_image_sample_o: + case Intrinsic::amdgcn_image_sample_cl_o: + case Intrinsic::amdgcn_image_sample_d_o: + case Intrinsic::amdgcn_image_sample_d_cl_o: + case Intrinsic::amdgcn_image_sample_l_o: + case Intrinsic::amdgcn_image_sample_b_o: + case Intrinsic::amdgcn_image_sample_b_cl_o: + case Intrinsic::amdgcn_image_sample_lz_o: + case Intrinsic::amdgcn_image_sample_cd_o: + case Intrinsic::amdgcn_image_sample_cd_cl_o: + + // Sample with comparison and offsets. + case Intrinsic::amdgcn_image_sample_c_o: + case Intrinsic::amdgcn_image_sample_c_cl_o: + case Intrinsic::amdgcn_image_sample_c_d_o: + case Intrinsic::amdgcn_image_sample_c_d_cl_o: + case Intrinsic::amdgcn_image_sample_c_l_o: + case Intrinsic::amdgcn_image_sample_c_b_o: + case Intrinsic::amdgcn_image_sample_c_b_cl_o: + case Intrinsic::amdgcn_image_sample_c_lz_o: + case Intrinsic::amdgcn_image_sample_c_cd_o: + case Intrinsic::amdgcn_image_sample_c_cd_cl_o: + + case Intrinsic::amdgcn_image_getlod: { + // Replace dmask with everything disabled with undef. + const ConstantSDNode *DMask = dyn_cast(Op.getOperand(5)); + if (!DMask || DMask->isNullValue()) { + SDValue Undef = DAG.getUNDEF(Op.getValueType()); + return DAG.getMergeValues({ Undef, Op.getOperand(0) }, SDLoc(Op)); + } + + return SDValue(); + } default: return SDValue(); } diff --git a/test/CodeGen/AMDGPU/llvm.amdgcn.image.getlod.ll b/test/CodeGen/AMDGPU/llvm.amdgcn.image.getlod.ll index ef810a33001..c7a04614ade 100644 --- a/test/CodeGen/AMDGPU/llvm.amdgcn.image.getlod.ll +++ b/test/CodeGen/AMDGPU/llvm.amdgcn.image.getlod.ll @@ -28,6 +28,16 @@ main_body: ret void } +; GCN-LABEL: {{^}}adjust_writemask_getlod_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_getlod_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.getlod.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} declare <4 x float> @llvm.amdgcn.image.getlod.v4f32.f32.v8i32(float, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) #0 declare <4 x float> @llvm.amdgcn.image.getlod.v4f32.v2f32.v8i32(<2 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) #0 diff --git a/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.ll b/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.ll index 43dfd1a6d67..e6412b3ec58 100644 --- a/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.ll +++ b/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.ll @@ -285,6 +285,128 @@ main_body: ret void } +; GCN-LABEL: {{^}}adjust_writemask_sample_variable_dmask_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_variable_dmask_enabled(float addrspace(1)* %out, i32 %dmask) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 %dmask, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + + +; GCN-LABEL: {{^}}adjust_writemask_sample_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_cl_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_cl_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.cl.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_d_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_d_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.d.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_d_cl_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_d_cl_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.d.cl.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_l_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_l_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.l.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_b_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_b_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.b.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_b_cl_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_b_cl_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.b.cl.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_lz_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_lz_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.lz.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_cd_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_cd_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.cd.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_cd_cl_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_cd_cl_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.cd.cl.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + declare <4 x float> @llvm.amdgcn.image.sample.v4f32.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) #0 declare <4 x float> @llvm.amdgcn.image.sample.cl.v4f32.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) #0 declare <4 x float> @llvm.amdgcn.image.sample.d.v4f32.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) #0 diff --git a/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.o.ll b/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.o.ll index d10fd082469..fd5e1389176 100644 --- a/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.o.ll +++ b/test/CodeGen/AMDGPU/llvm.amdgcn.image.sample.o.ll @@ -181,6 +181,225 @@ main_body: ret void } +; GCN-LABEL: {{^}}adjust_writemask_sample_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_cl_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_cl_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.cl.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_d_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_d_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.d.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_d_cl_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_d_cl_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.d.cl.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_l_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_l_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.l.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_b_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_b_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.b.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_b_cl_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_b_cl_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.b.cl.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_lz_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_lz_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.lz.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_cd_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_cd_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.cd.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_cd_cl_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_cd_cl_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.cd.cl.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_cl_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_cl_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.cl.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_d_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_d_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.d.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_d_cl_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_d_cl_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.d.cl.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_l_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_l_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.l.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_b_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_b_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.b.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_b_cl_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_b_cl_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.b.cl.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_lz_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_lz_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.lz.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_cd_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_cd_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.cd.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} + +; GCN-LABEL: {{^}}adjust_writemask_sample_c_cd_cl_o_none_enabled: +; GCN-NOT: image +; GCN-NOT: store +define void @adjust_writemask_sample_c_cd_cl_o_none_enabled(float addrspace(1)* %out) { +main_body: + %r = call <4 x float> @llvm.amdgcn.image.sample.c.cd.cl.o.v4f32.v4f32.v8i32(<4 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 0, i1 false, i1 false, i1 false, i1 false, i1 false) + %elt0 = extractelement <4 x float> %r, i32 0 + store float %elt0, float addrspace(1)* %out + ret void +} declare <4 x float> @llvm.amdgcn.image.sample.o.v4f32.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) #0 declare <4 x float> @llvm.amdgcn.image.sample.cl.o.v4f32.v4f32.v8i32(<4 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) #0