1 # RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass si-mode-register %s -o - | FileCheck %s
4 # check that the mode is changed to rtz from default rtn for interp f16
5 # CHECK-LABEL: name: interp_f16_default
7 # CHECK: S_SETREG_IMM32_B32 3, 2177
8 # CHECK-NEXT: V_INTERP_P1LL_F16
9 # CHECK: S_SETREG_IMM32_B32 0, 2177
10 # CHECK-NEXT: V_ADD_F16_e32
11 # CHECK-NOT: S_SETREG_IMM32_B32
13 name: interp_f16_default
17 liveins: $sgpr0, $sgpr1, $sgpr2
18 $m0 = S_MOV_B32 killed $sgpr2
19 $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec
20 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
21 $vgpr2 = V_MOV_B32_e32 killed $sgpr1, implicit $exec, implicit $exec
22 $vgpr0 = V_INTERP_P1LL_F16 0, killed $vgpr0, 2, 1, -1, 0, 0, implicit $m0, implicit $exec
23 $vgpr1 = V_INTERP_P2_F16 0, $vgpr2, 2, 1, 0, killed $vgpr1, 0, 0, implicit $m0, implicit $exec
24 $vgpr0 = V_INTERP_P2_F16 0, killed $vgpr2, 2, 1, 0, killed $vgpr0, -1, 0, implicit $m0, implicit $exec
25 $vgpr0 = V_ADD_F16_e32 killed $vgpr1, killed $vgpr0, implicit $exec
29 # check that the mode is not changed for interp f16 when the mode is already RTZ
30 # CHECK-LABEL: name: interp_f16_explicit_rtz
32 # CHECK: S_SETREG_IMM32_B32 3, 2177
33 # CHECK-NEXT: V_MOV_B32_e32
34 # CHECK: S_SETREG_IMM32_B32 0, 2177
35 # CHECK-NEXT: V_ADD_F16_e32
36 # CHECK-NOT: S_SETREG_IMM32_B32
38 name: interp_f16_explicit_rtz
42 liveins: $sgpr0, $sgpr1, $sgpr2
43 $m0 = S_MOV_B32 killed $sgpr2
44 S_SETREG_IMM32_B32 3, 2177
45 $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec
46 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
47 $vgpr2 = V_MOV_B32_e32 killed $sgpr1, implicit $exec, implicit $exec
48 $vgpr0 = V_INTERP_P1LL_F16 0, killed $vgpr0, 2, 1, -1, 0, 0, implicit $m0, implicit $exec
49 $vgpr1 = V_INTERP_P2_F16 0, $vgpr2, 2, 1, 0, killed $vgpr1, 0, 0, implicit $m0, implicit $exec
50 $vgpr0 = V_INTERP_P2_F16 0, killed $vgpr2, 2, 1, 0, killed $vgpr0, -1, 0, implicit $m0, implicit $exec
51 $vgpr0 = V_ADD_F16_e32 killed $vgpr1, killed $vgpr0, implicit $exec
55 # check that explicit RTN mode change is registered
56 # CHECK-LABEL: name: explicit_rtn
58 # CHECK: S_SETREG_IMM32_B32 3, 2177
59 # CHECK-NEXT: V_INTERP_P1LL_F16
60 # CHECK: S_SETREG_IMM32_B32 0, 2177
61 # CHECK-NEXT: V_ADD_F16_e32
62 # CHECK-NOT: S_SETREG_IMM32_B32
68 liveins: $sgpr0, $sgpr1, $sgpr2
69 $m0 = S_MOV_B32 killed $sgpr2
70 $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec
71 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
72 $vgpr2 = V_MOV_B32_e32 killed $sgpr1, implicit $exec, implicit $exec
73 $vgpr0 = V_INTERP_P1LL_F16 0, killed $vgpr0, 2, 1, -1, 0, 0, implicit $m0, implicit $exec
74 $vgpr1 = V_INTERP_P2_F16 0, $vgpr2, 2, 1, 0, killed $vgpr1, 0, 0, implicit $m0, implicit $exec
75 $vgpr0 = V_INTERP_P2_F16 0, killed $vgpr2, 2, 1, 0, killed $vgpr0, -1, 0, implicit $m0, implicit $exec
76 S_SETREG_IMM32_B32 0, 2177
77 $vgpr0 = V_ADD_F16_e32 killed $vgpr1, killed $vgpr0, implicit $exec
81 # check that the mode is unchanged from RTN for F64 instruction
82 # CHECK-LABEL: name: rtn_default
84 # CHECK-NOT: S_SETREG_IMM32_B32
92 $vgpr1_vgpr2 = V_FRACT_F64_e32 killed $vgpr1_vgpr2, implicit $exec
96 # check that the mode is changed from RTZ to RTN for F64 instruction
97 # CHECK-LABEL: name: rtn_from_rtz
99 # CHECK: S_SETREG_IMM32_B32 3, 2177
100 # CHECK-NEXT: S_SETREG_IMM32_B32 0, 2177
101 # CHECK-NEXT: V_FRACT_F64
102 # CHECK-NOT: S_SETREG_IMM32_B32
108 liveins: $vgpr1_vgpr2
109 S_SETREG_IMM32_B32 3, 2177
110 $vgpr1_vgpr2 = V_FRACT_F64_e32 killed $vgpr1_vgpr2, implicit $exec
114 # CHECK-LABEL: name: rtz_from_rtn
116 # CHECK: S_SETREG_IMM32_B32 3, 2177
117 # CHECK-NOT: S_SETREG_IMM32_B32
124 liveins: $vgpr1_vgpr2
125 $vgpr1_vgpr2 = V_FRACT_F64_e32 killed $vgpr1_vgpr2, implicit $exec
129 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
133 # check that the mode is changed from RTZ to RTN for F64 instruction
134 # and back again for remaining interp instruction
135 # CHECK-LABEL: name: interp_f16_plus_sqrt_f64
137 # CHECK: S_SETREG_IMM32_B32 3, 2177
138 # CHECK: V_INTERP_P1LL_F16
139 # CHECK: V_INTERP_P1LL_F16
140 # CHECK: V_INTERP_P2_F16
141 # CHECK: S_SETREG_IMM32_B32 0, 2177
143 # CHECK: S_SETREG_IMM32_B32 3, 2177
144 # CHECK: V_INTERP_P2_F16
146 name: interp_f16_plus_sqrt_f64
150 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr3, $vgpr4
151 $m0 = S_MOV_B32 killed $sgpr2
152 $vgpr0 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit $exec
153 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
154 $vgpr2 = V_MOV_B32_e32 $sgpr1, implicit $exec, implicit $exec
155 $vgpr0 = V_INTERP_P1LL_F16 0, killed $vgpr0, 2, 1, -1, 0, 0, implicit $m0, implicit $exec
156 $vgpr1 = V_INTERP_P2_F16 0, $vgpr2, 2, 1, 0, killed $vgpr1, 0, 0, implicit $m0, implicit $exec
157 $vgpr3_vgpr4 = V_FRACT_F64_e32 killed $vgpr3_vgpr4, implicit $exec
158 $vgpr0 = V_INTERP_P2_F16 0, killed $vgpr2, 2, 1, 0, killed $vgpr0, -1, 0, implicit $m0, implicit $exec
159 $vgpr0 = V_ADD_F16_e32 killed $sgpr0, killed $vgpr0, implicit $exec
163 # check that an explicit change to the single precision mode has no effect
164 # CHECK-LABEL: name: single_precision_mode_change
166 # CHECK: S_SETREG_IMM32_B32 3, 2177
167 # CHECK: V_INTERP_P1LL_F16
168 # CHECK: V_INTERP_P1LL_F16
169 # CHECK: V_INTERP_P2_F16
170 # CHECK: S_SETREG_IMM32_B32 0, 2177
172 # CHECK: S_SETREG_IMM32_B32 3, 2177
173 # CHECK: V_INTERP_P2_F16
175 name: single_precision_mode_change
179 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr3, $vgpr4
180 $m0 = S_MOV_B32 killed $sgpr2
181 $vgpr0 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit $exec
182 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
183 S_SETREG_IMM32_B32 2, 2049
184 $vgpr2 = V_MOV_B32_e32 $sgpr1, implicit $exec, implicit $exec
185 $vgpr0 = V_INTERP_P1LL_F16 0, killed $vgpr0, 2, 1, -1, 0, 0, implicit $m0, implicit $exec
186 $vgpr1 = V_INTERP_P2_F16 0, $vgpr2, 2, 1, 0, killed $vgpr1, 0, 0, implicit $m0, implicit $exec
187 $vgpr3_vgpr4 = V_FRACT_F64_e32 killed $vgpr3_vgpr4, implicit $exec
188 $vgpr0 = V_INTERP_P2_F16 0, killed $vgpr2, 2, 1, 0, killed $vgpr0, -1, 0, implicit $m0, implicit $exec
189 $vgpr0 = V_ADD_F16_e32 killed $sgpr0, killed $vgpr0, implicit $exec
193 # check that mode is propagated back to start of loop - first instruction is RTN but needs
194 # setreg as RTZ is set in loop
195 # CHECK-LABEL: name: loop
197 # CHECK: S_SETREG_IMM32_B32 0, 2177
200 # CHECK: S_SETREG_IMM32_B32 3, 2177
201 # CHECK: V_INTERP_P1LL_F16
202 # CHECK-NOT: S_SETREG_IMM32_B32
208 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr3, $vgpr4
210 $m0 = S_MOV_B32 killed $sgpr2
215 $vgpr3_vgpr4 = V_FRACT_F64_e32 killed $vgpr3_vgpr4, implicit $exec
219 successors: %bb.1, %bb.3
220 $vgpr0 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit $exec
221 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
222 S_CBRANCH_VCCZ %bb.1, implicit $vcc
229 # two back-edges to same node with different modes
230 # CHECK-LABEL: name: double_loop
231 # CHECK-NOT: S_SETREG_IMM32_B32
233 # CHECK: S_SETREG_IMM32_B32 0, 2177
234 # CHECK: V_FRACT_F64_e32
236 # CHECK: S_SETREG_IMM32_B32 3, 2177
242 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr3, $vgpr4
244 $m0 = S_MOV_B32 killed $sgpr2
253 successors: %bb.1, %bb.3
254 $vgpr3_vgpr4 = V_FRACT_F64_e32 killed $vgpr3_vgpr4, implicit $exec
255 S_CBRANCH_VCCZ %bb.1, implicit $vcc
269 successors: %bb.1, %bb.6
270 S_SETREG_IMM32_B32 3, 2177
271 S_CBRANCH_VCCZ %bb.1, implicit $vcc
278 # check that mode is propagated back to start of loop and through a block that
279 # neither sets or uses the mode.
280 # CHECK-LABEL: name: loop_indirect
281 # CHECK_NOT: S_SETREG_IMM32_B32
283 # CHECK: S_SETREG_IMM32_B32 3, 2177
284 # CHECK: V_INTERP_P1LL_F16
285 # CHECK-NOT: S_SETREG_IMM32_B32
291 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr3, $vgpr4
293 $m0 = S_MOV_B32 killed $sgpr2
307 successors: %bb.1, %bb.4
308 $vgpr0 = V_MOV_B32_e32 $sgpr0, implicit $exec, implicit $exec
309 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
310 S_CBRANCH_VCCZ %bb.1, implicit $vcc
317 # check that multiple mode values are propagated to a block that uses the mode
318 # CHECK-LABEL: name: multiple_mode_direct
320 # CHECK: S_SETREG_IMM32_B32 0, 2177
321 # CHECK: V_FRACT_F64_e32
322 # CHECK-NOT: S_SETREG_IMM32_B32
324 name: multiple_mode_direct
328 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr3, $vgpr4
330 $m0 = S_MOV_B32 killed $sgpr2
334 successors: %bb.2, %bb.3
335 S_CBRANCH_VCCZ %bb.2, implicit $vcc
340 S_SETREG_IMM32_B32 3, 2177
345 $vgpr3_vgpr4 = V_FRACT_F64_e32 killed $vgpr3_vgpr4, implicit $exec
352 # check that multiple mode values are propagated through a block that neither
353 # sets or uses the mode.
354 # CHECK-LABEL: name: multiple_mode_indirect
356 # CHECK: S_SETREG_IMM32_B32 0, 2177
357 # CHECK: V_FRACT_F64_e32
358 # CHECK-NOT: S_SETREG_IMM32_B32
360 name: multiple_mode_indirect
364 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr3, $vgpr4
366 $m0 = S_MOV_B32 killed $sgpr2
370 successors: %bb.2, %bb.3
371 S_CBRANCH_VCCZ %bb.2, implicit $vcc
376 S_SETREG_IMM32_B32 3, 2177
386 $vgpr3_vgpr4 = V_FRACT_F64_e32 killed $vgpr3_vgpr4, implicit $exec
393 # CHECK-LABEL: name: pass_through_blocks
395 # CHECK: V_FRACT_F64_e32
396 # CHECK-NEXT: S_SETREG_IMM32_B32 3, 2177
397 # CHECK-NOT: S_SETREG_IMM32_B32
399 name: pass_through_blocks
404 liveins: $vgpr1_vgpr2
405 $vgpr1_vgpr2 = V_FRACT_F64_e32 killed $vgpr1_vgpr2, implicit $exec
406 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
422 $vgpr1 = V_INTERP_P1LL_F16 0, $vgpr0, 2, 1, 0, 0, 0, implicit $m0, implicit $exec
426 # check that multiple mode values are propagated
427 # CHECK-LABEL: name: if_then_else
429 # CHECK: S_SETREG_IMM32_B32 0, 2177
430 # CHECK: V_FRACT_F64_e32
431 # CHECK-NOT: S_SETREG_IMM32_B32
437 liveins: $sgpr0, $sgpr1, $sgpr2, $vgpr3, $vgpr4
439 $m0 = S_MOV_B32 killed $sgpr2
443 successors: %bb.2, %bb.3
444 S_CBRANCH_VCCZ %bb.3, implicit $vcc
449 S_SETREG_IMM32_B32 3, 2177
454 $vgpr3_vgpr4 = V_FRACT_F64_e32 killed $vgpr3_vgpr4, implicit $exec