1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
5 name: test_f16_poszero_nsz
6 tracksRegLiveness: true
11 ; CHECK-LABEL: name: test_f16_poszero_nsz
12 ; CHECK: liveins: $vgpr0
14 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
15 ; CHECK-NEXT: %input:_(s16) = G_TRUNC [[COPY]](s32)
16 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(s16) = G_FNEG %input
17 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s16) = G_FCANONICALIZE [[FNEG]]
18 ; CHECK-NEXT: %res:_(s32) = G_ANYEXT [[FCANONICALIZE]](s16)
19 ; CHECK-NEXT: $vgpr0 = COPY %res(s32)
20 %0:_(s32) = COPY $vgpr0
21 %input:_(s16) = G_TRUNC %0
22 %cst:_(s16) = G_FCONSTANT half 0.0
23 %sub:_(s16) = nsz G_FSUB %cst, %input
24 %res:_(s32) = G_ANYEXT %sub
29 name: test_f16_poszero_nonsz_nofold
30 tracksRegLiveness: true
35 ; CHECK-LABEL: name: test_f16_poszero_nonsz_nofold
36 ; CHECK: liveins: $vgpr0
38 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
39 ; CHECK-NEXT: %input:_(s16) = G_TRUNC [[COPY]](s32)
40 ; CHECK-NEXT: %cst:_(s16) = G_FCONSTANT half 0xH0000
41 ; CHECK-NEXT: %sub:_(s16) = G_FSUB %cst, %input
42 ; CHECK-NEXT: %res:_(s32) = G_ANYEXT %sub(s16)
43 ; CHECK-NEXT: $vgpr0 = COPY %res(s32)
44 %0:_(s32) = COPY $vgpr0
45 %input:_(s16) = G_TRUNC %0
46 %cst:_(s16) = G_FCONSTANT half 0.0
47 %sub:_(s16) = G_FSUB %cst, %input
48 %res:_(s32) = G_ANYEXT %sub
53 name: test_f16_negzero
54 tracksRegLiveness: true
59 ; CHECK-LABEL: name: test_f16_negzero
60 ; CHECK: liveins: $vgpr0
62 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
63 ; CHECK-NEXT: %input:_(s16) = G_TRUNC [[COPY]](s32)
64 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(s16) = G_FNEG %input
65 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s16) = G_FCANONICALIZE [[FNEG]]
66 ; CHECK-NEXT: %res:_(s32) = G_ANYEXT [[FCANONICALIZE]](s16)
67 ; CHECK-NEXT: $vgpr0 = COPY %res(s32)
68 %0:_(s32) = COPY $vgpr0
69 %input:_(s16) = G_TRUNC %0
70 %cst:_(s16) = G_FCONSTANT half -0.0
71 %sub:_(s16) = G_FSUB %cst, %input
72 %res:_(s32) = G_ANYEXT %sub
77 name: test_f32_poszero_nsz
78 tracksRegLiveness: true
83 ; CHECK-LABEL: name: test_f32_poszero_nsz
84 ; CHECK: liveins: $vgpr0
86 ; CHECK-NEXT: %input:_(s32) = COPY $vgpr0
87 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(s32) = G_FNEG %input
88 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[FNEG]]
89 ; CHECK-NEXT: $vgpr0 = COPY [[FCANONICALIZE]](s32)
90 %input:_(s32) = COPY $vgpr0
91 %cst:_(s32) = G_FCONSTANT float 0.0
92 %sub:_(s32) = nsz G_FSUB %cst, %input
97 name: test_f32_poszero_nonsz_nofold
98 tracksRegLiveness: true
103 ; CHECK-LABEL: name: test_f32_poszero_nonsz_nofold
104 ; CHECK: liveins: $vgpr0
106 ; CHECK-NEXT: %input:_(s32) = COPY $vgpr0
107 ; CHECK-NEXT: %cst:_(s32) = G_FCONSTANT float 0.000000e+00
108 ; CHECK-NEXT: %sub:_(s32) = G_FSUB %cst, %input
109 ; CHECK-NEXT: $vgpr0 = COPY %sub(s32)
110 %input:_(s32) = COPY $vgpr0
111 %cst:_(s32) = G_FCONSTANT float 0.0
112 %sub:_(s32) = G_FSUB %cst, %input
117 name: test_f32_negzero
118 tracksRegLiveness: true
123 ; CHECK-LABEL: name: test_f32_negzero
124 ; CHECK: liveins: $vgpr0
126 ; CHECK-NEXT: %input:_(s32) = COPY $vgpr0
127 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(s32) = G_FNEG %input
128 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[FNEG]]
129 ; CHECK-NEXT: $vgpr0 = COPY [[FCANONICALIZE]](s32)
130 %input:_(s32) = COPY $vgpr0
131 %cst:_(s32) = G_FCONSTANT float -0.0
132 %sub:_(s32) = G_FSUB %cst, %input
137 name: test_f64_poszero_nsz
138 tracksRegLiveness: true
141 liveins: $vgpr0_vgpr1
143 ; CHECK-LABEL: name: test_f64_poszero_nsz
144 ; CHECK: liveins: $vgpr0_vgpr1
146 ; CHECK-NEXT: %input:_(s64) = COPY $vgpr0_vgpr1
147 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(s64) = G_FNEG %input
148 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s64) = G_FCANONICALIZE [[FNEG]]
149 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[FCANONICALIZE]](s64)
150 %input:_(s64) = COPY $vgpr0_vgpr1
151 %cst:_(s64) = G_FCONSTANT double 0.0
152 %sub:_(s64) = nsz G_FSUB %cst, %input
153 $vgpr0_vgpr1 = COPY %sub
157 name: test_f64_poszero_nonsz_nofold
158 tracksRegLiveness: true
161 liveins: $vgpr0_vgpr1
163 ; CHECK-LABEL: name: test_f64_poszero_nonsz_nofold
164 ; CHECK: liveins: $vgpr0_vgpr1
166 ; CHECK-NEXT: %input:_(s64) = COPY $vgpr0_vgpr1
167 ; CHECK-NEXT: %cst:_(s64) = G_FCONSTANT double 0.000000e+00
168 ; CHECK-NEXT: %sub:_(s64) = G_FSUB %cst, %input
169 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY %sub(s64)
170 %input:_(s64) = COPY $vgpr0_vgpr1
171 %cst:_(s64) = G_FCONSTANT double 0.0
172 %sub:_(s64) = G_FSUB %cst, %input
173 $vgpr0_vgpr1 = COPY %sub
177 name: test_f64_negzero
178 tracksRegLiveness: true
181 liveins: $vgpr0_vgpr1
183 ; CHECK-LABEL: name: test_f64_negzero
184 ; CHECK: liveins: $vgpr0_vgpr1
186 ; CHECK-NEXT: %input:_(s64) = COPY $vgpr0_vgpr1
187 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(s64) = G_FNEG %input
188 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s64) = G_FCANONICALIZE [[FNEG]]
189 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[FCANONICALIZE]](s64)
190 %input:_(s64) = COPY $vgpr0_vgpr1
191 %cst:_(s64) = G_FCONSTANT double -0.0
192 %sub:_(s64) = G_FSUB %cst, %input
193 $vgpr0_vgpr1 = COPY %sub
197 name: test_v4f16_poszero_nsz
198 tracksRegLiveness: true
201 liveins: $vgpr0_vgpr1
203 ; CHECK-LABEL: name: test_v4f16_poszero_nsz
204 ; CHECK: liveins: $vgpr0_vgpr1
206 ; CHECK-NEXT: %input:_(<4 x s16>) = COPY $vgpr0_vgpr1
207 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(<4 x s16>) = G_FNEG %input
208 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<4 x s16>) = G_FCANONICALIZE [[FNEG]]
209 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[FCANONICALIZE]](<4 x s16>)
210 %input:_(<4 x s16>) = COPY $vgpr0_vgpr1
211 %cst:_(s16) = G_FCONSTANT half 0.0
212 %veccst:_(<4 x s16>) = G_BUILD_VECTOR %cst, %cst, %cst, %cst
213 %sub:_(<4 x s16>) = nsz G_FSUB %veccst, %input
214 $vgpr0_vgpr1 = COPY %sub
218 name: test_v4f16_poszero_nonsz_nofold
219 tracksRegLiveness: true
222 liveins: $vgpr0_vgpr1
224 ; CHECK-LABEL: name: test_v4f16_poszero_nonsz_nofold
225 ; CHECK: liveins: $vgpr0_vgpr1
227 ; CHECK-NEXT: %input:_(<4 x s16>) = COPY $vgpr0_vgpr1
228 ; CHECK-NEXT: %cst:_(s16) = G_FCONSTANT half 0xH0000
229 ; CHECK-NEXT: %veccst:_(<4 x s16>) = G_BUILD_VECTOR %cst(s16), %cst(s16), %cst(s16), %cst(s16)
230 ; CHECK-NEXT: %sub:_(<4 x s16>) = G_FSUB %veccst, %input
231 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY %sub(<4 x s16>)
232 %input:_(<4 x s16>) = COPY $vgpr0_vgpr1
233 %cst:_(s16) = G_FCONSTANT half 0.0
234 %veccst:_(<4 x s16>) = G_BUILD_VECTOR %cst, %cst, %cst, %cst
235 %sub:_(<4 x s16>) = G_FSUB %veccst, %input
236 $vgpr0_vgpr1 = COPY %sub
240 name: test_v4f16_negzero
241 tracksRegLiveness: true
244 liveins: $vgpr0_vgpr1
246 ; CHECK-LABEL: name: test_v4f16_negzero
247 ; CHECK: liveins: $vgpr0_vgpr1
249 ; CHECK-NEXT: %input:_(<4 x s16>) = COPY $vgpr0_vgpr1
250 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(<4 x s16>) = G_FNEG %input
251 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<4 x s16>) = G_FCANONICALIZE [[FNEG]]
252 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[FCANONICALIZE]](<4 x s16>)
253 %input:_(<4 x s16>) = COPY $vgpr0_vgpr1
254 %cst:_(s16) = G_FCONSTANT half -0.0
255 %veccst:_(<4 x s16>) = G_BUILD_VECTOR %cst, %cst, %cst, %cst
256 %sub:_(<4 x s16>) = G_FSUB %veccst, %input
257 $vgpr0_vgpr1 = COPY %sub
262 tracksRegLiveness: true
265 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
267 ; CHECK-LABEL: name: test_v4f32
268 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
270 ; CHECK-NEXT: %input:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
271 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(<4 x s32>) = G_FNEG %input
272 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<4 x s32>) = G_FCANONICALIZE [[FNEG]]
273 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[FCANONICALIZE]](<4 x s32>)
274 %input:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
275 %cst:_(s32) = G_FCONSTANT float 0.0
276 %veccst:_(<4 x s32>) = G_BUILD_VECTOR %cst, %cst, %cst, %cst
277 %sub:_(<4 x s32>) = nsz G_FSUB %veccst, %input
278 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %sub
282 name: test_v4f32_negzero
283 tracksRegLiveness: true
286 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
288 ; CHECK-LABEL: name: test_v4f32_negzero
289 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
291 ; CHECK-NEXT: %input:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
292 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(<4 x s32>) = G_FNEG %input
293 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<4 x s32>) = G_FCANONICALIZE [[FNEG]]
294 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[FCANONICALIZE]](<4 x s32>)
295 %input:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
296 %cst:_(s32) = G_FCONSTANT float -0.0
297 %veccst:_(<4 x s32>) = G_BUILD_VECTOR %cst, %cst, %cst, %cst
298 %sub:_(<4 x s32>) = G_FSUB %veccst, %input
299 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %sub
303 name: test_v4f32_negzero_undef_elt
304 tracksRegLiveness: true
307 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
309 ; CHECK-LABEL: name: test_v4f32_negzero_undef_elt
310 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
312 ; CHECK-NEXT: %input:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
313 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(<4 x s32>) = G_FNEG %input
314 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<4 x s32>) = G_FCANONICALIZE [[FNEG]]
315 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[FCANONICALIZE]](<4 x s32>)
316 %input:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
317 %cst:_(s32) = G_FCONSTANT float -0.0
318 %undef:_(s32) = G_IMPLICIT_DEF
319 %veccst:_(<4 x s32>) = G_BUILD_VECTOR %cst, %undef, %cst, %cst
320 %sub:_(<4 x s32>) = G_FSUB %veccst, %input
321 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %sub
325 name: test_v4f32_poszero_undef_elt
326 tracksRegLiveness: true
329 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
331 ; CHECK-LABEL: name: test_v4f32_poszero_undef_elt
332 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
334 ; CHECK-NEXT: %input:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
335 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(<4 x s32>) = G_FNEG %input
336 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<4 x s32>) = G_FCANONICALIZE [[FNEG]]
337 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[FCANONICALIZE]](<4 x s32>)
338 %input:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
339 %cst:_(s32) = G_FCONSTANT float 0.0
340 %undef:_(s32) = G_IMPLICIT_DEF
341 %veccst:_(<4 x s32>) = G_BUILD_VECTOR %cst, %undef, %cst, %cst
342 %sub:_(<4 x s32>) = nsz G_FSUB %veccst, %input
343 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %sub
348 tracksRegLiveness: true
351 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
353 ; CHECK-LABEL: name: test_v2f64
354 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
356 ; CHECK-NEXT: %input:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
357 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(<2 x s64>) = G_FNEG %input
358 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<2 x s64>) = G_FCANONICALIZE [[FNEG]]
359 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[FCANONICALIZE]](<2 x s64>)
360 %input:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
361 %cst:_(s64) = G_FCONSTANT double 0.0
362 %veccst:_(<2 x s64>) = G_BUILD_VECTOR %cst, %cst
363 %sub:_(<2 x s64>) = nsz G_FSUB %veccst, %input
364 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %sub
368 name: test_v2f64_negzero
369 tracksRegLiveness: true
372 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
374 ; CHECK-LABEL: name: test_v2f64_negzero
375 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
377 ; CHECK-NEXT: %input:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
378 ; CHECK-NEXT: [[FNEG:%[0-9]+]]:_(<2 x s64>) = G_FNEG %input
379 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<2 x s64>) = G_FCANONICALIZE [[FNEG]]
380 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[FCANONICALIZE]](<2 x s64>)
381 %input:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
382 %cst:_(s64) = G_FCONSTANT double -0.0
383 %veccst:_(<2 x s64>) = G_BUILD_VECTOR %cst, %cst
384 %sub:_(<2 x s64>) = G_FSUB %veccst, %input
385 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %sub