blob: c9905c1cb77e007a6e47b127318195eb6cda5b75 [file] [log] [blame]
Matt Arsenault68f05052017-12-04 22:18:27 +00001; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
Matt Arsenault856777d2017-12-08 20:00:57 +00003; GCN-LABEL: {{^}}adjust_writemask_crash_0_nochain:
Nicolai Haehnle10459282018-06-21 13:37:19 +00004; GCN: image_get_lod v0, v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x2
Matt Arsenault68f05052017-12-04 22:18:27 +00005; GCN-NOT: v1
6; GCN-NOT: v0
7; GCN: buffer_store_dword v0
Matt Arsenault856777d2017-12-08 20:00:57 +00008define amdgpu_ps void @adjust_writemask_crash_0_nochain() #0 {
Matt Arsenault68f05052017-12-04 22:18:27 +00009main_body:
Nicolai Haehnle10459282018-06-21 13:37:19 +000010 %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)
Matt Arsenault68f05052017-12-04 22:18:27 +000011 %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
16 ret void
17}
18
Matt Arsenault856777d2017-12-08 20:00:57 +000019; GCN-LABEL: {{^}}adjust_writemask_crash_1_nochain:
Nicolai Haehnle10459282018-06-21 13:37:19 +000020; GCN: image_get_lod v0, v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x1
Matt Arsenault68f05052017-12-04 22:18:27 +000021; GCN-NOT: v1
22; GCN-NOT: v0
23; GCN: buffer_store_dword v0
Matt Arsenault856777d2017-12-08 20:00:57 +000024define amdgpu_ps void @adjust_writemask_crash_1_nochain() #0 {
Matt Arsenault68f05052017-12-04 22:18:27 +000025main_body:
Nicolai Haehnle10459282018-06-21 13:37:19 +000026 %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)
Matt Arsenault68f05052017-12-04 22:18:27 +000027 %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
32 ret void
33}
34
Matt Arsenault856777d2017-12-08 20:00:57 +000035; GCN-LABEL: {{^}}adjust_writemask_crash_0_chain:
Nicolai Haehnle10459282018-06-21 13:37:19 +000036; GCN: image_sample v0, v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x2
Matt Arsenault856777d2017-12-08 20:00:57 +000037; GCN-NOT: v1
38; GCN-NOT: v0
39; GCN: buffer_store_dword v0
40define amdgpu_ps void @adjust_writemask_crash_0_chain() #0 {
41main_body:
Nicolai Haehnle10459282018-06-21 13:37:19 +000042 %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)
Matt Arsenault856777d2017-12-08 20:00:57 +000043 %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
48 ret void
49}
50
51; GCN-LABEL: {{^}}adjust_writemask_crash_1_chain:
Nicolai Haehnle10459282018-06-21 13:37:19 +000052; GCN: image_sample v0, v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x1
Matt Arsenault856777d2017-12-08 20:00:57 +000053; GCN-NOT: v1
54; GCN-NOT: v0
55; GCN: buffer_store_dword v0
56define amdgpu_ps void @adjust_writemask_crash_1_chain() #0 {
57main_body:
Nicolai Haehnle10459282018-06-21 13:37:19 +000058 %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)
Matt Arsenault856777d2017-12-08 20:00:57 +000059 %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
64 ret void
65}
66
Matt Arsenault68f05052017-12-04 22:18:27 +000067define amdgpu_ps void @adjust_writemask_crash_0_v4() #0 {
68main_body:
Nicolai Haehnle10459282018-06-21 13:37:19 +000069 %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)
Matt Arsenault68f05052017-12-04 22:18:27 +000070 %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
75 ret void
76}
77
78
Nicolai Haehnle10459282018-06-21 13:37:19 +000079declare <2 x float> @llvm.amdgcn.image.sample.1d.v2f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32) #1
80declare <2 x float> @llvm.amdgcn.image.getlod.1d.v2f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32) #1
81declare <4 x float> @llvm.amdgcn.image.getlod.1d.v4f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32) #1
Matt Arsenault68f05052017-12-04 22:18:27 +000082
83attributes #0 = { nounwind }
84attributes #1 = { nounwind readonly }