1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3 ; GCN-LABEL: {{^}}adjust_writemask_crash_0_nochain:
4 ; GCN: image_get_lod v0, v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x2
7 ; GCN: buffer_store_dword v0
8 define amdgpu_ps void @adjust_writemask_crash_0_nochain() #0 {
10 %tmp = call <2 x float> @llvm.amdgcn.image.getlod.1d.v2f32.f32(i32 3, float undef, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0)
11 %tmp1 = bitcast <2 x float> %tmp to <2 x i32>
12 %tmp2 = shufflevector <2 x i32> %tmp1, <2 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
13 %tmp3 = bitcast <4 x i32> %tmp2 to <4 x float>
14 %tmp4 = extractelement <4 x float> %tmp3, i32 0
15 store volatile float %tmp4, float addrspace(1)* undef
19 ; GCN-LABEL: {{^}}adjust_writemask_crash_1_nochain:
20 ; GCN: image_get_lod v0, v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x1
23 ; GCN: buffer_store_dword v0
24 define amdgpu_ps void @adjust_writemask_crash_1_nochain() #0 {
26 %tmp = call <2 x float> @llvm.amdgcn.image.getlod.1d.v2f32.f32(i32 3, float undef, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0)
27 %tmp1 = bitcast <2 x float> %tmp to <2 x i32>
28 %tmp2 = shufflevector <2 x i32> %tmp1, <2 x i32> undef, <4 x i32> <i32 1, i32 0, i32 undef, i32 undef>
29 %tmp3 = bitcast <4 x i32> %tmp2 to <4 x float>
30 %tmp4 = extractelement <4 x float> %tmp3, i32 1
31 store volatile float %tmp4, float addrspace(1)* undef
35 ; GCN-LABEL: {{^}}adjust_writemask_crash_0_chain:
36 ; GCN: image_sample v0, v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x2
39 ; GCN: buffer_store_dword v0
40 define amdgpu_ps void @adjust_writemask_crash_0_chain() #0 {
42 %tmp = call <2 x float> @llvm.amdgcn.image.sample.1d.v2f32.f32(i32 3, float undef, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0)
43 %tmp1 = bitcast <2 x float> %tmp to <2 x i32>
44 %tmp2 = shufflevector <2 x i32> %tmp1, <2 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
45 %tmp3 = bitcast <4 x i32> %tmp2 to <4 x float>
46 %tmp4 = extractelement <4 x float> %tmp3, i32 0
47 store volatile float %tmp4, float addrspace(1)* undef
51 ; GCN-LABEL: {{^}}adjust_writemask_crash_1_chain:
52 ; GCN: image_sample v0, v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x1
55 ; GCN: buffer_store_dword v0
56 define amdgpu_ps void @adjust_writemask_crash_1_chain() #0 {
58 %tmp = call <2 x float> @llvm.amdgcn.image.sample.1d.v2f32.f32(i32 3, float undef, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0)
59 %tmp1 = bitcast <2 x float> %tmp to <2 x i32>
60 %tmp2 = shufflevector <2 x i32> %tmp1, <2 x i32> undef, <4 x i32> <i32 1, i32 0, i32 undef, i32 undef>
61 %tmp3 = bitcast <4 x i32> %tmp2 to <4 x float>
62 %tmp4 = extractelement <4 x float> %tmp3, i32 1
63 store volatile float %tmp4, float addrspace(1)* undef
67 define amdgpu_ps void @adjust_writemask_crash_0_v4() #0 {
69 %tmp = call <4 x float> @llvm.amdgcn.image.getlod.1d.v4f32.f32(i32 5, float undef, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0)
70 %tmp1 = bitcast <4 x float> %tmp to <4 x i32>
71 %tmp2 = shufflevector <4 x i32> %tmp1, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
72 %tmp3 = bitcast <4 x i32> %tmp2 to <4 x float>
73 %tmp4 = extractelement <4 x float> %tmp3, i32 0
74 store volatile float %tmp4, float addrspace(1)* undef
79 declare <2 x float> @llvm.amdgcn.image.sample.1d.v2f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32) #1
80 declare <2 x float> @llvm.amdgcn.image.getlod.1d.v2f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32) #1
81 declare <4 x float> @llvm.amdgcn.image.getlod.1d.v4f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32) #1
83 attributes #0 = { nounwind }
84 attributes #1 = { nounwind readonly }