1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck %s
4 ; We may have subregister live ranges that are undefined on some paths. The
5 ; verifier should not complain about this.
7 define amdgpu_kernel void @func() #0 {
9 ; CHECK: ; %bb.0: ; %B0
10 ; CHECK-NEXT: s_mov_b32 s0, 0
11 ; CHECK-NEXT: s_cbranch_scc1 BB0_2
12 ; CHECK-NEXT: ; %bb.1: ; %B30.1
13 ; CHECK-NEXT: s_mov_b32 s0, 0x7fc00000
14 ; CHECK-NEXT: BB0_2: ; %B30.2
15 ; CHECK-NEXT: v_mov_b32_e32 v0, s0
16 ; CHECK-NEXT: s_mov_b32 m0, -1
17 ; CHECK-NEXT: ds_write_b32 v0, v0
18 ; CHECK-NEXT: s_endpgm
20 br i1 undef, label %B1, label %B2
26 %v0 = phi <4 x float> [ zeroinitializer, %B1 ], [ <float 0.0, float 0.0, float 0.0, float undef>, %B0 ]
27 br i1 undef, label %B30.1, label %B30.2
30 %sub = fsub <4 x float> %v0, undef
34 %v3 = phi <4 x float> [ %sub, %B30.1 ], [ %v0, %B2 ]
35 %ve0 = extractelement <4 x float> %v3, i32 0
36 store float %ve0, float addrspace(3)* undef, align 4
40 ; FIXME: Extra undef subregister copy should be removed before
41 ; overwritten with defined copy
42 define amdgpu_ps float @valley_partially_undef_copy() #0 {
43 ; CHECK-LABEL: valley_partially_undef_copy:
44 ; CHECK: ; %bb.0: ; %bb
45 ; CHECK-NEXT: s_mov_b32 s3, 0xf000
46 ; CHECK-NEXT: s_mov_b32 s2, -1
47 ; CHECK-NEXT: buffer_load_dword v1, off, s[0:3], 0 glc
48 ; CHECK-NEXT: s_waitcnt vmcnt(0)
49 ; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], 0 glc
50 ; CHECK-NEXT: s_waitcnt vmcnt(0)
51 ; CHECK-NEXT: v_mov_b32_e32 v2, 0x7fc00000
52 ; CHECK-NEXT: buffer_store_dword v2, off, s[0:3], 0
53 ; CHECK-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0
54 ; CHECK-NEXT: v_cmp_ne_u32_e64 s[0:1], 0, v1
55 ; CHECK-NEXT: BB1_1: ; %bb9
56 ; CHECK-NEXT: ; =>This Inner Loop Header: Depth=1
57 ; CHECK-NEXT: s_andn2_b64 vcc, exec, s[0:1]
58 ; CHECK-NEXT: s_cbranch_vccnz BB1_1
59 ; CHECK-NEXT: ; %bb.2: ; %bb11
60 ; CHECK-NEXT: s_mov_b32 s3, 0xf000
61 ; CHECK-NEXT: s_mov_b32 s2, -1
62 ; CHECK-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0
63 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0)
64 ; CHECK-NEXT: ; return to shader part epilog
66 %tmp = load volatile i32, i32 addrspace(1)* undef, align 4
67 %tmp1 = load volatile i32, i32 addrspace(1)* undef, align 4
68 %tmp2 = insertelement <4 x i32> undef, i32 %tmp1, i32 0
69 %tmp3 = bitcast i32 %tmp1 to float
70 %tmp4 = call <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32 15, float %tmp3, float %tmp3, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0)
71 %tmp5 = extractelement <4 x float> %tmp4, i32 0
72 %tmp6 = fmul float %tmp5, undef
73 %tmp7 = fadd float %tmp6, %tmp6
74 %tmp8 = insertelement <4 x i32> %tmp2, i32 %tmp, i32 1
75 store <4 x i32> %tmp8, <4 x i32> addrspace(1)* undef, align 16
76 store float %tmp7, float addrspace(1)* undef, align 4
79 bb9: ; preds = %bb9, %bb
80 %tmp10 = icmp eq i32 %tmp, 0
81 br i1 %tmp10, label %bb9, label %bb11
84 store <4 x i32> %tmp2, <4 x i32> addrspace(1)* undef, align 16
88 ; FIXME: Should be able to remove the undef copies
89 define amdgpu_kernel void @partially_undef_copy() #0 {
90 ; CHECK-LABEL: partially_undef_copy:
92 ; CHECK-NEXT: ;;#ASMSTART
93 ; CHECK-NEXT: v_mov_b32_e32 v5, 5
94 ; CHECK-NEXT: ;;#ASMEND
95 ; CHECK-NEXT: ;;#ASMSTART
96 ; CHECK-NEXT: v_mov_b32_e32 v6, 6
97 ; CHECK-NEXT: ;;#ASMEND
98 ; CHECK-NEXT: v_mov_b32_e32 v0, v5
99 ; CHECK-NEXT: v_mov_b32_e32 v1, v6
100 ; CHECK-NEXT: v_mov_b32_e32 v2, v7
101 ; CHECK-NEXT: v_mov_b32_e32 v3, v8
102 ; CHECK-NEXT: s_mov_b32 s3, 0xf000
103 ; CHECK-NEXT: s_mov_b32 s2, -1
104 ; CHECK-NEXT: v_mov_b32_e32 v0, v6
105 ; CHECK-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0
106 ; CHECK-NEXT: s_waitcnt vmcnt(0)
107 ; CHECK-NEXT: ;;#ASMSTART
109 ; CHECK-NEXT: ;;#ASMEND
110 ; CHECK-NEXT: s_endpgm
111 %tmp0 = call i32 asm sideeffect "v_mov_b32_e32 v5, 5", "={v5}"()
112 %tmp1 = call i32 asm sideeffect "v_mov_b32_e32 v6, 6", "={v6}"()
114 %partially.undef.0 = insertelement <4 x i32> undef, i32 %tmp0, i32 0
115 %partially.undef.1 = insertelement <4 x i32> %partially.undef.0, i32 %tmp1, i32 0
117 store volatile <4 x i32> %partially.undef.1, <4 x i32> addrspace(1)* undef, align 16
118 tail call void asm sideeffect "v_nop", "v={v[5:8]}"(<4 x i32> %partially.undef.0)
122 declare <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32, float, float, <8 x i32>, <4 x i32>, i1, i32, i32) #1
124 attributes #0 = { nounwind }
125 attributes #1 = { nounwind readonly }