1; RUN: llc -march=amdgcn -mcpu=gfx900 -start-before=amdgpu-isel -stop-after=amdgpu-isel -verify-machineinstrs < %s | FileCheck %s --check-prefix=GCN
2
3; We're really just checking for no crashes
4; The feature we're testing for in AdjustWriteMask leaves the image_load as an instruction just post amdgpu-isel
5; In reality, it's hard to get an image intrinsic into AdjustWriteMask with no uses as it will usually get removed
6; first, but it can happen, hence the fix associated with this test
7
8; GCN-LABEL: name: _amdgpu_cs_main
9; GCN-LABEL: bb.0
10; GCN: IMAGE_LOAD_V4_V2
11define amdgpu_cs void @_amdgpu_cs_main(i32 %dummy) local_unnamed_addr #0 {
12.entry:
13  %unused.result = tail call <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32 15, i32 undef, i32 undef, <8 x i32> undef, i32 0, i32 0) #3
14  call void asm sideeffect ";", "" () #0
15  ret void
16}
17
18; Function Attrs: nounwind readonly
19declare <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32, i32, i32, <8 x i32>, i32, i32) #1
20
21attributes #0 = { nounwind }
22attributes #1 = { nounwind readonly  }
23