blob: d8cf67af7b071bdfb2ee896ad6e5ee555fbcdddb [file] [log] [blame]
Matt Arsenault68f05052017-12-04 22:18:27 +00001; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
3; GCN-LABEL: {{^}}adjust_writemask_crash_0:
4; GCN: image_get_lod v0, v{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x2
5; GCN-NOT: v1
6; GCN-NOT: v0
7; GCN: buffer_store_dword v0
8define amdgpu_ps void @adjust_writemask_crash_0() #0 {
9main_body:
10 %tmp = call <2 x float> @llvm.amdgcn.image.getlod.v2f32.v2f32.v8i32(<2 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 3, i1 false, i1 false, i1 false, i1 false, i1 false)
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
16 ret void
17}
18
19; GCN-LABEL: {{^}}adjust_writemask_crash_1:
20; GCN: image_get_lod v0, v{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}}, s{{\[[0-9]+:[0-9]+\]}} dmask:0x1
21; GCN-NOT: v1
22; GCN-NOT: v0
23; GCN: buffer_store_dword v0
24define amdgpu_ps void @adjust_writemask_crash_1() #0 {
25main_body:
26 %tmp = call <2 x float> @llvm.amdgcn.image.getlod.v2f32.v2f32.v8i32(<2 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 3, i1 false, i1 false, i1 false, i1 false, i1 false)
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
32 ret void
33}
34
35define amdgpu_ps void @adjust_writemask_crash_0_v4() #0 {
36main_body:
37 %tmp = call <4 x float> @llvm.amdgcn.image.getlod.v4f32.v2f32.v8i32(<2 x float> undef, <8 x i32> undef, <4 x i32> undef, i32 5, i1 false, i1 false, i1 false, i1 false, i1 false)
38 %tmp1 = bitcast <4 x float> %tmp to <4 x i32>
39 %tmp2 = shufflevector <4 x i32> %tmp1, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
40 %tmp3 = bitcast <4 x i32> %tmp2 to <4 x float>
41 %tmp4 = extractelement <4 x float> %tmp3, i32 0
42 store volatile float %tmp4, float addrspace(1)* undef
43 ret void
44}
45
46
47declare <2 x float> @llvm.amdgcn.image.getlod.v2f32.v2f32.v8i32(<2 x float>, <8 x i32>, <4 x i32>, i32, i1, i1, i1, i1, i1) #1
48declare <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) #1
49
50attributes #0 = { nounwind }
51attributes #1 = { nounwind readonly }