1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
3; RUN: opt -mtriple=amdgcn-- -S -structurizecfg -si-annotate-control-flow %s | FileCheck -check-prefix=IR %s
4; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
5
6; After structurizing, there are 3 levels of loops. The i1 phi
7; conditions mutually depend on each other, so it isn't safe to delete
8; the condition that appears to have no uses until the loop is
9; completely processed.
10
11define amdgpu_kernel void @reduced_nested_loop_conditions(i64 addrspace(3)* nocapture %arg) #0 {
12; GCN-LABEL: reduced_nested_loop_conditions:
13; GCN:       ; %bb.0: ; %bb
14; GCN-NEXT:    s_load_dword s0, s[0:1], 0x9
15; GCN-NEXT:    v_lshlrev_b32_e32 v0, 3, v0
16; GCN-NEXT:    s_mov_b32 m0, -1
17; GCN-NEXT:    s_mov_b64 s[2:3], -1
18; GCN-NEXT:    s_waitcnt lgkmcnt(0)
19; GCN-NEXT:    v_add_i32_e32 v0, vcc, s0, v0
20; GCN-NEXT:    ds_read_b64 v[0:1], v0
21; GCN-NEXT:    s_and_b64 s[0:1], exec, -1
22; GCN-NEXT:    s_branch BB0_2
23; GCN-NEXT:  BB0_1: ; %bb10
24; GCN-NEXT:    ; in Loop: Header=BB0_2 Depth=1
25; GCN-NEXT:    s_mov_b64 s[4:5], 0
26; GCN-NEXT:    s_andn2_b64 vcc, exec, s[2:3]
27; GCN-NEXT:    s_cbranch_vccz BB0_4
28; GCN-NEXT:  BB0_2: ; %bb5
29; GCN-NEXT:    ; =>This Inner Loop Header: Depth=1
30; GCN-NEXT:    s_mov_b64 vcc, s[0:1]
31; GCN-NEXT:    s_cbranch_vccnz BB0_1
32; GCN-NEXT:  ; %bb.3: ; in Loop: Header=BB0_2 Depth=1
33; GCN-NEXT:    s_mov_b64 s[4:5], -1
34; GCN-NEXT:    s_andn2_b64 vcc, exec, s[2:3]
35; GCN-NEXT:    s_cbranch_vccnz BB0_2
36; GCN-NEXT:  BB0_4: ; %loop.exit.guard
37; GCN-NEXT:    s_and_b64 vcc, exec, s[4:5]
38; GCN-NEXT:    s_cbranch_vccz BB0_7
39; GCN-NEXT:  ; %bb.5: ; %bb8
40; GCN-NEXT:    s_waitcnt lgkmcnt(0)
41; GCN-NEXT:    ds_read_b32 v0, v0
42; GCN-NEXT:    s_and_b64 vcc, exec, 0
43; GCN-NEXT:  BB0_6: ; %bb9
44; GCN-NEXT:    ; =>This Inner Loop Header: Depth=1
45; GCN-NEXT:    s_cbranch_vccz BB0_6
46; GCN-NEXT:  BB0_7: ; %DummyReturnBlock
47; GCN-NEXT:    s_endpgm
48; IR-LABEL: @reduced_nested_loop_conditions(
49; IR-NEXT:  bb:
50; IR-NEXT:    [[MY_TMP:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x() #4
51; IR-NEXT:    [[MY_TMP1:%.*]] = getelementptr inbounds i64, i64 addrspace(3)* [[ARG:%.*]], i32 [[MY_TMP]]
52; IR-NEXT:    [[MY_TMP2:%.*]] = load volatile i64, i64 addrspace(3)* [[MY_TMP1]]
53; IR-NEXT:    br label [[BB5:%.*]]
54; IR:       bb3:
55; IR-NEXT:    br i1 true, label [[BB4:%.*]], label [[BB13:%.*]]
56; IR:       bb4:
57; IR-NEXT:    br label [[FLOW:%.*]]
58; IR:       bb5:
59; IR-NEXT:    [[PHI_BROKEN:%.*]] = phi i64 [ [[TMP6:%.*]], [[BB10:%.*]] ], [ 0, [[BB:%.*]] ]
60; IR-NEXT:    [[MY_TMP6:%.*]] = phi i32 [ 0, [[BB]] ], [ [[TMP5:%.*]], [[BB10]] ]
61; IR-NEXT:    [[MY_TMP7:%.*]] = icmp eq i32 [[MY_TMP6]], 1
62; IR-NEXT:    [[TMP0:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[MY_TMP7]])
63; IR-NEXT:    [[TMP1:%.*]] = extractvalue { i1, i64 } [[TMP0]], 0
64; IR-NEXT:    [[TMP2:%.*]] = extractvalue { i1, i64 } [[TMP0]], 1
65; IR-NEXT:    br i1 [[TMP1]], label [[BB8:%.*]], label [[FLOW]]
66; IR:       bb8:
67; IR-NEXT:    br label [[BB13]]
68; IR:       bb9:
69; IR-NEXT:    br i1 false, label [[BB3:%.*]], label [[BB9:%.*]]
70; IR:       bb10:
71; IR-NEXT:    [[TMP3:%.*]] = call i1 @llvm.amdgcn.loop.i64(i64 [[TMP6]])
72; IR-NEXT:    br i1 [[TMP3]], label [[BB23:%.*]], label [[BB5]]
73; IR:       Flow:
74; IR-NEXT:    [[TMP4:%.*]] = phi i1 [ [[MY_TMP22:%.*]], [[BB4]] ], [ true, [[BB5]] ]
75; IR-NEXT:    [[TMP5]] = phi i32 [ [[MY_TMP21:%.*]], [[BB4]] ], [ undef, [[BB5]] ]
76; IR-NEXT:    call void @llvm.amdgcn.end.cf.i64(i64 [[TMP2]])
77; IR-NEXT:    [[TMP6]] = call i64 @llvm.amdgcn.if.break.i64(i1 [[TMP4]], i64 [[PHI_BROKEN]])
78; IR-NEXT:    br label [[BB10]]
79; IR:       bb13:
80; IR-NEXT:    [[MY_TMP14:%.*]] = phi i1 [ [[MY_TMP22]], [[BB3]] ], [ true, [[BB8]] ]
81; IR-NEXT:    [[MY_TMP15:%.*]] = bitcast i64 [[MY_TMP2]] to <2 x i32>
82; IR-NEXT:    br i1 [[MY_TMP14]], label [[BB16:%.*]], label [[BB20:%.*]]
83; IR:       bb16:
84; IR-NEXT:    [[MY_TMP17:%.*]] = extractelement <2 x i32> [[MY_TMP15]], i64 1
85; IR-NEXT:    [[MY_TMP18:%.*]] = getelementptr inbounds i32, i32 addrspace(3)* undef, i32 [[MY_TMP17]]
86; IR-NEXT:    [[MY_TMP19:%.*]] = load volatile i32, i32 addrspace(3)* [[MY_TMP18]]
87; IR-NEXT:    br label [[BB20]]
88; IR:       bb20:
89; IR-NEXT:    [[MY_TMP21]] = phi i32 [ [[MY_TMP19]], [[BB16]] ], [ 0, [[BB13]] ]
90; IR-NEXT:    [[MY_TMP22]] = phi i1 [ false, [[BB16]] ], [ [[MY_TMP14]], [[BB13]] ]
91; IR-NEXT:    br label [[BB9]]
92; IR:       bb23:
93; IR-NEXT:    call void @llvm.amdgcn.end.cf.i64(i64 [[TMP6]])
94; IR-NEXT:    ret void
95bb:
96  %my.tmp = tail call i32 @llvm.amdgcn.workitem.id.x() #1
97  %my.tmp1 = getelementptr inbounds i64, i64 addrspace(3)* %arg, i32 %my.tmp
98  %my.tmp2 = load volatile i64, i64 addrspace(3)* %my.tmp1
99  br label %bb5
100
101bb3:                                              ; preds = %bb9
102  br i1 true, label %bb4, label %bb13
103
104bb4:                                              ; preds = %bb3
105  br label %bb10
106
107bb5:                                              ; preds = %bb10, %bb
108  %my.tmp6 = phi i32 [ 0, %bb ], [ %my.tmp11, %bb10 ]
109  %my.tmp7 = icmp eq i32 %my.tmp6, 1
110  br i1 %my.tmp7, label %bb8, label %bb10
111
112bb8:                                              ; preds = %bb5
113  br label %bb13
114
115bb9:                                              ; preds = %bb20, %bb9
116  br i1 false, label %bb3, label %bb9
117
118bb10:                                             ; preds = %bb5, %bb4
119  %my.tmp11 = phi i32 [ %my.tmp21, %bb4 ], [ undef, %bb5 ]
120  %my.tmp12 = phi i1 [ %my.tmp22, %bb4 ], [ true, %bb5 ]
121  br i1 %my.tmp12, label %bb23, label %bb5
122
123bb13:                                             ; preds = %bb8, %bb3
124  %my.tmp14 = phi i1 [ %my.tmp22, %bb3 ], [ true, %bb8 ]
125  %my.tmp15 = bitcast i64 %my.tmp2 to <2 x i32>
126  br i1 %my.tmp14, label %bb16, label %bb20
127
128bb16:                                             ; preds = %bb13
129  %my.tmp17 = extractelement <2 x i32> %my.tmp15, i64 1
130  %my.tmp18 = getelementptr inbounds i32, i32 addrspace(3)* undef, i32 %my.tmp17
131  %my.tmp19 = load volatile i32, i32 addrspace(3)* %my.tmp18
132  br label %bb20
133
134bb20:                                             ; preds = %bb16, %bb13
135  %my.tmp21 = phi i32 [ %my.tmp19, %bb16 ], [ 0, %bb13 ]
136  %my.tmp22 = phi i1 [ false, %bb16 ], [ %my.tmp14, %bb13 ]
137  br label %bb9
138
139bb23:                                             ; preds = %bb10
140  ret void
141}
142
143; Earlier version of above, before a run of the structurizer.
144
145define amdgpu_kernel void @nested_loop_conditions(i64 addrspace(1)* nocapture %arg) #0 {
146; GCN-LABEL: nested_loop_conditions:
147; GCN:       ; %bb.0: ; %bb
148; GCN-NEXT:    s_mov_b32 s3, 0xf000
149; GCN-NEXT:    s_mov_b32 s2, -1
150; GCN-NEXT:    buffer_load_dword v0, off, s[0:3], 0
151; GCN-NEXT:    s_waitcnt vmcnt(0)
152; GCN-NEXT:    v_cmp_lt_i32_e32 vcc, 8, v0
153; GCN-NEXT:    s_and_b64 vcc, exec, vcc
154; GCN-NEXT:    s_cbranch_vccnz BB1_6
155; GCN-NEXT:  ; %bb.1: ; %bb14.lr.ph
156; GCN-NEXT:    buffer_load_dword v0, off, s[0:3], 0
157; GCN-NEXT:    s_branch BB1_3
158; GCN-NEXT:  BB1_2: ; in Loop: Header=BB1_3 Depth=1
159; GCN-NEXT:    s_mov_b64 s[0:1], -1
160; GCN-NEXT:    ; implicit-def: $vgpr0
161; GCN-NEXT:    s_cbranch_execnz BB1_6
162; GCN-NEXT:  BB1_3: ; %bb14
163; GCN-NEXT:    ; =>This Loop Header: Depth=1
164; GCN-NEXT:    ; Child Loop BB1_4 Depth 2
165; GCN-NEXT:    s_waitcnt vmcnt(0)
166; GCN-NEXT:    v_cmp_ne_u32_e32 vcc, 1, v0
167; GCN-NEXT:    s_and_b64 vcc, exec, vcc
168; GCN-NEXT:    s_cbranch_vccnz BB1_2
169; GCN-NEXT:  BB1_4: ; %bb18
170; GCN-NEXT:    ; Parent Loop BB1_3 Depth=1
171; GCN-NEXT:    ; => This Inner Loop Header: Depth=2
172; GCN-NEXT:    buffer_load_dword v0, off, s[0:3], 0
173; GCN-NEXT:    s_waitcnt vmcnt(0)
174; GCN-NEXT:    v_cmp_lt_i32_e32 vcc, 8, v0
175; GCN-NEXT:    s_and_b64 vcc, exec, vcc
176; GCN-NEXT:    s_cbranch_vccnz BB1_4
177; GCN-NEXT:  ; %bb.5: ; %bb21
178; GCN-NEXT:    ; in Loop: Header=BB1_3 Depth=1
179; GCN-NEXT:    buffer_load_dword v0, off, s[0:3], 0
180; GCN-NEXT:    buffer_load_dword v1, off, s[0:3], 0
181; GCN-NEXT:    s_waitcnt vmcnt(0)
182; GCN-NEXT:    v_cmp_lt_i32_e64 s[0:1], 8, v1
183; GCN-NEXT:    s_and_b64 vcc, exec, s[0:1]
184; GCN-NEXT:    s_cbranch_vccz BB1_3
185; GCN-NEXT:  BB1_6: ; %bb31
186; GCN-NEXT:    v_mov_b32_e32 v0, 0
187; GCN-NEXT:    buffer_store_dword v0, off, s[0:3], 0
188; GCN-NEXT:    s_endpgm
189; IR-LABEL: @nested_loop_conditions(
190; IR-NEXT:  bb:
191; IR-NEXT:    [[MY_TMP:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x() #4
192; IR-NEXT:    [[MY_TMP1:%.*]] = zext i32 [[MY_TMP]] to i64
193; IR-NEXT:    [[MY_TMP2:%.*]] = getelementptr inbounds i64, i64 addrspace(1)* [[ARG:%.*]], i64 [[MY_TMP1]]
194; IR-NEXT:    [[MY_TMP3:%.*]] = load i64, i64 addrspace(1)* [[MY_TMP2]], align 16
195; IR-NEXT:    [[MY_TMP932:%.*]] = load <4 x i32>, <4 x i32> addrspace(1)* undef, align 16
196; IR-NEXT:    [[MY_TMP1033:%.*]] = extractelement <4 x i32> [[MY_TMP932]], i64 0
197; IR-NEXT:    [[MY_TMP1134:%.*]] = load volatile i32, i32 addrspace(1)* undef
198; IR-NEXT:    [[MY_TMP1235:%.*]] = icmp slt i32 [[MY_TMP1134]], 9
199; IR-NEXT:    br i1 [[MY_TMP1235]], label [[BB14_LR_PH:%.*]], label [[FLOW:%.*]]
200; IR:       bb14.lr.ph:
201; IR-NEXT:    br label [[BB14:%.*]]
202; IR:       Flow3:
203; IR-NEXT:    call void @llvm.amdgcn.end.cf.i64(i64 [[TMP21:%.*]])
204; IR-NEXT:    [[TMP0:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[TMP14:%.*]])
205; IR-NEXT:    [[TMP1:%.*]] = extractvalue { i1, i64 } [[TMP0]], 0
206; IR-NEXT:    [[TMP2:%.*]] = extractvalue { i1, i64 } [[TMP0]], 1
207; IR-NEXT:    br i1 [[TMP1]], label [[BB4_BB13_CRIT_EDGE:%.*]], label [[FLOW4:%.*]]
208; IR:       bb4.bb13_crit_edge:
209; IR-NEXT:    br label [[FLOW4]]
210; IR:       Flow4:
211; IR-NEXT:    [[TMP3:%.*]] = phi i1 [ true, [[BB4_BB13_CRIT_EDGE]] ], [ false, [[FLOW3:%.*]] ]
212; IR-NEXT:    call void @llvm.amdgcn.end.cf.i64(i64 [[TMP2]])
213; IR-NEXT:    br label [[FLOW]]
214; IR:       bb13:
215; IR-NEXT:    br label [[BB31:%.*]]
216; IR:       Flow:
217; IR-NEXT:    [[TMP4:%.*]] = phi i1 [ [[TMP3]], [[FLOW4]] ], [ true, [[BB:%.*]] ]
218; IR-NEXT:    [[TMP5:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[TMP4]])
219; IR-NEXT:    [[TMP6:%.*]] = extractvalue { i1, i64 } [[TMP5]], 0
220; IR-NEXT:    [[TMP7:%.*]] = extractvalue { i1, i64 } [[TMP5]], 1
221; IR-NEXT:    br i1 [[TMP6]], label [[BB13:%.*]], label [[BB31]]
222; IR:       bb14:
223; IR-NEXT:    [[PHI_BROKEN:%.*]] = phi i64 [ [[TMP16:%.*]], [[FLOW1:%.*]] ], [ 0, [[BB14_LR_PH]] ]
224; IR-NEXT:    [[MY_TMP1037:%.*]] = phi i32 [ [[MY_TMP1033]], [[BB14_LR_PH]] ], [ [[TMP12:%.*]], [[FLOW1]] ]
225; IR-NEXT:    [[MY_TMP936:%.*]] = phi <4 x i32> [ [[MY_TMP932]], [[BB14_LR_PH]] ], [ [[TMP11:%.*]], [[FLOW1]] ]
226; IR-NEXT:    [[MY_TMP15:%.*]] = icmp eq i32 [[MY_TMP1037]], 1
227; IR-NEXT:    [[TMP8:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[MY_TMP15]])
228; IR-NEXT:    [[TMP9:%.*]] = extractvalue { i1, i64 } [[TMP8]], 0
229; IR-NEXT:    [[TMP10:%.*]] = extractvalue { i1, i64 } [[TMP8]], 1
230; IR-NEXT:    br i1 [[TMP9]], label [[BB16:%.*]], label [[FLOW1]]
231; IR:       bb16:
232; IR-NEXT:    [[MY_TMP17:%.*]] = bitcast i64 [[MY_TMP3]] to <2 x i32>
233; IR-NEXT:    br label [[BB18:%.*]]
234; IR:       Flow1:
235; IR-NEXT:    [[TMP11]] = phi <4 x i32> [ [[MY_TMP9:%.*]], [[BB21:%.*]] ], [ undef, [[BB14]] ]
236; IR-NEXT:    [[TMP12]] = phi i32 [ [[MY_TMP10:%.*]], [[BB21]] ], [ undef, [[BB14]] ]
237; IR-NEXT:    [[TMP13:%.*]] = phi i1 [ [[TMP18:%.*]], [[BB21]] ], [ true, [[BB14]] ]
238; IR-NEXT:    [[TMP14]] = phi i1 [ [[TMP18]], [[BB21]] ], [ false, [[BB14]] ]
239; IR-NEXT:    [[TMP15:%.*]] = phi i1 [ false, [[BB21]] ], [ true, [[BB14]] ]
240; IR-NEXT:    call void @llvm.amdgcn.end.cf.i64(i64 [[TMP10]])
241; IR-NEXT:    [[TMP16]] = call i64 @llvm.amdgcn.if.break.i64(i1 [[TMP13]], i64 [[PHI_BROKEN]])
242; IR-NEXT:    [[TMP17:%.*]] = call i1 @llvm.amdgcn.loop.i64(i64 [[TMP16]])
243; IR-NEXT:    br i1 [[TMP17]], label [[FLOW2:%.*]], label [[BB14]]
244; IR:       bb18:
245; IR-NEXT:    [[MY_TMP19:%.*]] = load volatile i32, i32 addrspace(1)* undef
246; IR-NEXT:    [[MY_TMP20:%.*]] = icmp slt i32 [[MY_TMP19]], 9
247; IR-NEXT:    br i1 [[MY_TMP20]], label [[BB21]], label [[BB18]]
248; IR:       bb21:
249; IR-NEXT:    [[MY_TMP22:%.*]] = extractelement <2 x i32> [[MY_TMP17]], i64 1
250; IR-NEXT:    [[MY_TMP23:%.*]] = lshr i32 [[MY_TMP22]], 16
251; IR-NEXT:    [[MY_TMP24:%.*]] = select i1 undef, i32 undef, i32 [[MY_TMP23]]
252; IR-NEXT:    [[MY_TMP25:%.*]] = uitofp i32 [[MY_TMP24]] to float
253; IR-NEXT:    [[MY_TMP26:%.*]] = fmul float [[MY_TMP25]], 0x3EF0001000000000
254; IR-NEXT:    [[MY_TMP27:%.*]] = fsub float [[MY_TMP26]], undef
255; IR-NEXT:    [[MY_TMP28:%.*]] = fcmp olt float [[MY_TMP27]], 5.000000e-01
256; IR-NEXT:    [[MY_TMP29:%.*]] = select i1 [[MY_TMP28]], i64 1, i64 2
257; IR-NEXT:    [[MY_TMP30:%.*]] = extractelement <4 x i32> [[MY_TMP936]], i64 [[MY_TMP29]]
258; IR-NEXT:    [[MY_TMP7:%.*]] = zext i32 [[MY_TMP30]] to i64
259; IR-NEXT:    [[MY_TMP8:%.*]] = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* undef, i64 [[MY_TMP7]]
260; IR-NEXT:    [[MY_TMP9]] = load <4 x i32>, <4 x i32> addrspace(1)* [[MY_TMP8]], align 16
261; IR-NEXT:    [[MY_TMP10]] = extractelement <4 x i32> [[MY_TMP9]], i64 0
262; IR-NEXT:    [[MY_TMP11:%.*]] = load volatile i32, i32 addrspace(1)* undef
263; IR-NEXT:    [[MY_TMP12:%.*]] = icmp slt i32 [[MY_TMP11]], 9
264; IR-NEXT:    [[TMP18]] = xor i1 [[MY_TMP12]], true
265; IR-NEXT:    br label [[FLOW1]]
266; IR:       Flow2:
267; IR-NEXT:    call void @llvm.amdgcn.end.cf.i64(i64 [[TMP16]])
268; IR-NEXT:    [[TMP19:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[TMP15]])
269; IR-NEXT:    [[TMP20:%.*]] = extractvalue { i1, i64 } [[TMP19]], 0
270; IR-NEXT:    [[TMP21]] = extractvalue { i1, i64 } [[TMP19]], 1
271; IR-NEXT:    br i1 [[TMP20]], label [[BB31_LOOPEXIT:%.*]], label [[FLOW3]]
272; IR:       bb31.loopexit:
273; IR-NEXT:    br label [[FLOW3]]
274; IR:       bb31:
275; IR-NEXT:    call void @llvm.amdgcn.end.cf.i64(i64 [[TMP7]])
276; IR-NEXT:    store volatile i32 0, i32 addrspace(1)* undef
277; IR-NEXT:    ret void
278bb:
279  %my.tmp = tail call i32 @llvm.amdgcn.workitem.id.x() #1
280  %my.tmp1 = zext i32 %my.tmp to i64
281  %my.tmp2 = getelementptr inbounds i64, i64 addrspace(1)* %arg, i64 %my.tmp1
282  %my.tmp3 = load i64, i64 addrspace(1)* %my.tmp2, align 16
283  %my.tmp932 = load <4 x i32>, <4 x i32> addrspace(1)* undef, align 16
284  %my.tmp1033 = extractelement <4 x i32> %my.tmp932, i64 0
285  %my.tmp1134 = load volatile i32, i32 addrspace(1)* undef
286  %my.tmp1235 = icmp slt i32 %my.tmp1134, 9
287  br i1 %my.tmp1235, label %bb14.lr.ph, label %bb13
288
289bb14.lr.ph:                                       ; preds = %bb
290  br label %bb14
291
292bb4.bb13_crit_edge:                               ; preds = %bb21
293  br label %bb13
294
295bb13:                                             ; preds = %bb4.bb13_crit_edge, %bb
296  br label %bb31
297
298bb14:                                             ; preds = %bb21, %bb14.lr.ph
299  %my.tmp1037 = phi i32 [ %my.tmp1033, %bb14.lr.ph ], [ %my.tmp10, %bb21 ]
300  %my.tmp936 = phi <4 x i32> [ %my.tmp932, %bb14.lr.ph ], [ %my.tmp9, %bb21 ]
301  %my.tmp15 = icmp eq i32 %my.tmp1037, 1
302  br i1 %my.tmp15, label %bb16, label %bb31.loopexit
303
304bb16:                                             ; preds = %bb14
305  %my.tmp17 = bitcast i64 %my.tmp3 to <2 x i32>
306  br label %bb18
307
308bb18:                                             ; preds = %bb18, %bb16
309  %my.tmp19 = load volatile i32, i32 addrspace(1)* undef
310  %my.tmp20 = icmp slt i32 %my.tmp19, 9
311  br i1 %my.tmp20, label %bb21, label %bb18
312
313bb21:                                             ; preds = %bb18
314  %my.tmp22 = extractelement <2 x i32> %my.tmp17, i64 1
315  %my.tmp23 = lshr i32 %my.tmp22, 16
316  %my.tmp24 = select i1 undef, i32 undef, i32 %my.tmp23
317  %my.tmp25 = uitofp i32 %my.tmp24 to float
318  %my.tmp26 = fmul float %my.tmp25, 0x3EF0001000000000
319  %my.tmp27 = fsub float %my.tmp26, undef
320  %my.tmp28 = fcmp olt float %my.tmp27, 5.000000e-01
321  %my.tmp29 = select i1 %my.tmp28, i64 1, i64 2
322  %my.tmp30 = extractelement <4 x i32> %my.tmp936, i64 %my.tmp29
323  %my.tmp7 = zext i32 %my.tmp30 to i64
324  %my.tmp8 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* undef, i64 %my.tmp7
325  %my.tmp9 = load <4 x i32>, <4 x i32> addrspace(1)* %my.tmp8, align 16
326  %my.tmp10 = extractelement <4 x i32> %my.tmp9, i64 0
327  %my.tmp11 = load volatile i32, i32 addrspace(1)* undef
328  %my.tmp12 = icmp slt i32 %my.tmp11, 9
329  br i1 %my.tmp12, label %bb14, label %bb4.bb13_crit_edge
330
331bb31.loopexit:                                    ; preds = %bb14
332  br label %bb31
333
334bb31:                                             ; preds = %bb31.loopexit, %bb13
335  store volatile i32 0, i32 addrspace(1)* undef
336  ret void
337}
338
339declare i32 @llvm.amdgcn.workitem.id.x() #1
340
341attributes #0 = { nounwind }
342attributes #1 = { nounwind readnone }
343