1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
5 name: test_fcanonicalize
6 tracksRegLiveness: true
12 ; CHECK-LABEL: name: test_fcanonicalize
13 ; CHECK: liveins: $vgpr0
15 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
16 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY]]
17 ; CHECK-NEXT: $vgpr0 = COPY [[FCANONICALIZE]](s32)
18 %0:_(s32) = COPY $vgpr0
19 %1:_(s32) = G_FCANONICALIZE %0
20 %2:_(s32) = G_FCANONICALIZE %1
26 tracksRegLiveness: true
31 ; CHECK-LABEL: name: test_fconstant
32 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+10
33 ; CHECK-NEXT: $vgpr0 = COPY [[C]](s32)
34 %0:_(s32) = G_FCONSTANT float 1.0e10
35 %1:_(s32) = G_FCANONICALIZE %0
40 name: test_denormal_fconstant
41 tracksRegLiveness: true
45 fp64-fp16-output-denormals: false
46 fp64-fp16-input-denormals: false
50 ; CHECK-LABEL: name: test_denormal_fconstant
51 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.618950e-319
52 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s64) = G_FCANONICALIZE [[C]]
53 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[FCANONICALIZE]](s64)
54 %0:_(s64) = G_FCONSTANT double 0x0000000000008000
55 %1:_(s64) = G_FCANONICALIZE %0
56 $vgpr0_vgpr1 = COPY %1(s64)
60 name: test_fminnum_with_fminnum_argument_s32_ieee_mode_on
61 tracksRegLiveness: true
68 liveins: $vgpr0, $vgpr1, $vgpr2
70 ; CHECK-LABEL: name: test_fminnum_with_fminnum_argument_s32_ieee_mode_on
71 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2
73 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
74 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
75 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY]]
76 ; CHECK-NEXT: [[FCANONICALIZE1:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY1]]
77 ; CHECK-NEXT: [[FMINNUM_IEEE:%[0-9]+]]:_(s32) = G_FMINNUM_IEEE [[FCANONICALIZE]], [[FCANONICALIZE1]]
78 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
79 ; CHECK-NEXT: [[FCANONICALIZE2:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY2]]
80 ; CHECK-NEXT: [[FMINNUM_IEEE1:%[0-9]+]]:_(s32) = G_FMINNUM_IEEE [[FMINNUM_IEEE]], [[FCANONICALIZE2]]
81 ; CHECK-NEXT: $vgpr0 = COPY [[FMINNUM_IEEE1]](s32)
82 %0:_(s32) = COPY $vgpr0
83 %1:_(s32) = COPY $vgpr1
84 %7:_(s32) = G_FCANONICALIZE %0
85 %8:_(s32) = G_FCANONICALIZE %1
86 %2:_(s32) = G_FMINNUM_IEEE %7, %8
87 %3:_(s32) = COPY $vgpr2
88 %5:_(s32) = G_FCANONICALIZE %2
89 %6:_(s32) = G_FCANONICALIZE %3
90 %4:_(s32) = G_FMINNUM_IEEE %5, %6
95 name: test_fminnum_with_fmaxnum_argument_s32_ieee_mode_on
96 tracksRegLiveness: true
103 liveins: $vgpr0, $vgpr1, $vgpr2
105 ; CHECK-LABEL: name: test_fminnum_with_fmaxnum_argument_s32_ieee_mode_on
106 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2
108 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
109 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
110 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY]]
111 ; CHECK-NEXT: [[FCANONICALIZE1:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY1]]
112 ; CHECK-NEXT: [[FMAXNUM_IEEE:%[0-9]+]]:_(s32) = G_FMAXNUM_IEEE [[FCANONICALIZE]], [[FCANONICALIZE1]]
113 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
114 ; CHECK-NEXT: [[FCANONICALIZE2:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY2]]
115 ; CHECK-NEXT: [[FMINNUM_IEEE:%[0-9]+]]:_(s32) = G_FMINNUM_IEEE [[FMAXNUM_IEEE]], [[FCANONICALIZE2]]
116 ; CHECK-NEXT: $vgpr0 = COPY [[FMINNUM_IEEE]](s32)
117 %0:_(s32) = COPY $vgpr0
118 %1:_(s32) = COPY $vgpr1
119 %7:_(s32) = G_FCANONICALIZE %0
120 %8:_(s32) = G_FCANONICALIZE %1
121 %2:_(s32) = G_FMAXNUM_IEEE %7, %8
122 %3:_(s32) = COPY $vgpr2
123 %5:_(s32) = G_FCANONICALIZE %2
124 %6:_(s32) = G_FCANONICALIZE %3
125 %4:_(s32) = G_FMINNUM_IEEE %5, %6
126 $vgpr0 = COPY %4(s32)
130 name: test_fmaxnum_with_fmaxnum_argument_s32_ieee_mode_on
131 tracksRegLiveness: true
138 liveins: $vgpr0, $vgpr1, $vgpr2
140 ; CHECK-LABEL: name: test_fmaxnum_with_fmaxnum_argument_s32_ieee_mode_on
141 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2
143 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
144 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
145 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY]]
146 ; CHECK-NEXT: [[FCANONICALIZE1:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY1]]
147 ; CHECK-NEXT: [[FMAXNUM_IEEE:%[0-9]+]]:_(s32) = G_FMAXNUM_IEEE [[FCANONICALIZE]], [[FCANONICALIZE1]]
148 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
149 ; CHECK-NEXT: [[FCANONICALIZE2:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY2]]
150 ; CHECK-NEXT: [[FMAXNUM_IEEE1:%[0-9]+]]:_(s32) = G_FMAXNUM_IEEE [[FMAXNUM_IEEE]], [[FCANONICALIZE2]]
151 ; CHECK-NEXT: $vgpr0 = COPY [[FMAXNUM_IEEE1]](s32)
152 %0:_(s32) = COPY $vgpr0
153 %1:_(s32) = COPY $vgpr1
154 %7:_(s32) = G_FCANONICALIZE %0
155 %8:_(s32) = G_FCANONICALIZE %1
156 %2:_(s32) = G_FMAXNUM_IEEE %7, %8
157 %3:_(s32) = COPY $vgpr2
158 %5:_(s32) = G_FCANONICALIZE %2
159 %6:_(s32) = G_FCANONICALIZE %3
160 %4:_(s32) = G_FMAXNUM_IEEE %5, %6
161 $vgpr0 = COPY %4(s32)
165 name: test_fmaxnum_with_fminnum_argument_s32_ieee_mode_on
166 tracksRegLiveness: true
173 liveins: $vgpr0, $vgpr1, $vgpr2
175 ; CHECK-LABEL: name: test_fmaxnum_with_fminnum_argument_s32_ieee_mode_on
176 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2
178 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
179 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
180 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY]]
181 ; CHECK-NEXT: [[FCANONICALIZE1:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY1]]
182 ; CHECK-NEXT: [[FMINNUM_IEEE:%[0-9]+]]:_(s32) = G_FMINNUM_IEEE [[FCANONICALIZE]], [[FCANONICALIZE1]]
183 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
184 ; CHECK-NEXT: [[FCANONICALIZE2:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY2]]
185 ; CHECK-NEXT: [[FMAXNUM_IEEE:%[0-9]+]]:_(s32) = G_FMAXNUM_IEEE [[FMINNUM_IEEE]], [[FCANONICALIZE2]]
186 ; CHECK-NEXT: $vgpr0 = COPY [[FMAXNUM_IEEE]](s32)
187 %0:_(s32) = COPY $vgpr0
188 %1:_(s32) = COPY $vgpr1
189 %7:_(s32) = G_FCANONICALIZE %0
190 %8:_(s32) = G_FCANONICALIZE %1
191 %2:_(s32) = G_FMINNUM_IEEE %7, %8
192 %3:_(s32) = COPY $vgpr2
193 %5:_(s32) = G_FCANONICALIZE %2
194 %6:_(s32) = G_FCANONICALIZE %3
195 %4:_(s32) = G_FMAXNUM_IEEE %5, %6
196 $vgpr0 = COPY %4(s32)
200 name: test_multiple_uses
201 tracksRegLiveness: true
208 liveins: $vgpr0, $vgpr1
210 ; CHECK-LABEL: name: test_multiple_uses
211 ; CHECK: liveins: $vgpr0, $vgpr1
213 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
214 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
215 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY]]
216 ; CHECK-NEXT: [[FCANONICALIZE1:%[0-9]+]]:_(s32) = G_FCANONICALIZE [[COPY1]]
217 ; CHECK-NEXT: [[FMINNUM_IEEE:%[0-9]+]]:_(s32) = G_FMINNUM_IEEE [[FCANONICALIZE]], [[FCANONICALIZE1]]
218 ; CHECK-NEXT: [[FMAXNUM_IEEE:%[0-9]+]]:_(s32) = G_FMAXNUM_IEEE [[FMINNUM_IEEE]], [[FMINNUM_IEEE]]
219 ; CHECK-NEXT: $vgpr0 = COPY [[FMAXNUM_IEEE]](s32)
220 %0:_(s32) = COPY $vgpr0
221 %1:_(s32) = COPY $vgpr1
222 %6:_(s32) = G_FCANONICALIZE %0
223 %7:_(s32) = G_FCANONICALIZE %1
224 %2:_(s32) = G_FMINNUM_IEEE %6, %7
225 %4:_(s32) = G_FCANONICALIZE %2
226 %5:_(s32) = G_FCANONICALIZE %2
227 %3:_(s32) = G_FMAXNUM_IEEE %4, %5
228 $vgpr0 = COPY %3(s32)
232 name: test_splat_padded_with_undef
233 tracksRegLiveness: true
242 ; CHECK-LABEL: name: test_splat_padded_with_undef
243 ; CHECK: liveins: $vgpr0
245 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
246 ; CHECK-NEXT: %two:_(s16) = G_FCONSTANT half 0xH4000
247 ; CHECK-NEXT: %two_s32:_(s32) = G_ANYEXT %two(s16)
248 ; CHECK-NEXT: %two_splat:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %two_s32(s32), %two_s32(s32)
249 ; CHECK-NEXT: %zero:_(s16) = G_FCONSTANT half 0xH0000
250 ; CHECK-NEXT: %zero_s32:_(s32) = G_ANYEXT %zero(s16)
251 ; CHECK-NEXT: %undef:_(s32) = G_IMPLICIT_DEF
252 ; CHECK-NEXT: %zero_undef:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %zero_s32(s32), %undef(s32)
253 ; CHECK-NEXT: %one:_(s16) = G_FCONSTANT half 0xH3C00
254 ; CHECK-NEXT: %one_s32:_(s32) = G_ANYEXT %one(s16)
255 ; CHECK-NEXT: %one_undef:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %one_s32(s32), %undef(s32)
256 ; CHECK-NEXT: [[FMUL:%[0-9]+]]:_(<2 x s16>) = G_FMUL [[COPY]], %two_splat
257 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<2 x s16>) = G_FCANONICALIZE [[FMUL]]
258 ; CHECK-NEXT: [[FMAXNUM_IEEE:%[0-9]+]]:_(<2 x s16>) = G_FMAXNUM_IEEE %zero_undef, [[FCANONICALIZE]]
259 ; CHECK-NEXT: [[FMINNUM_IEEE:%[0-9]+]]:_(<2 x s16>) = G_FMINNUM_IEEE %one_undef, [[FMAXNUM_IEEE]]
260 ; CHECK-NEXT: $vgpr0 = COPY [[FMINNUM_IEEE]](<2 x s16>)
261 %0:_(<2 x s16>) = COPY $vgpr0
262 %two:_(s16) = G_FCONSTANT half 0xH4000
263 %two_s32:_(s32) = G_ANYEXT %two(s16)
264 %two_splat:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %two_s32(s32), %two_s32(s32)
265 %zero:_(s16) = G_FCONSTANT half 0xH0000
266 %zero_s32:_(s32) = G_ANYEXT %zero(s16)
267 %undef:_(s32) = G_IMPLICIT_DEF
268 %zero_undef:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %zero_s32(s32), %undef(s32)
269 %one:_(s16) = G_FCONSTANT half 0xH3C00
270 %one_s32:_(s32) = G_ANYEXT %one(s16)
271 %one_undef:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %one_s32(s32), %undef(s32)
272 %4:_(<2 x s16>) = G_FMUL %0, %two_splat
273 %zero_undef_fcan:_(<2 x s16>) = G_FCANONICALIZE %zero_undef
274 %16:_(<2 x s16>) = G_FCANONICALIZE %4
275 %8:_(<2 x s16>) = G_FMAXNUM_IEEE %zero_undef_fcan, %16
276 %one_undef_fcan:_(<2 x s16>) = G_FCANONICALIZE %one_undef
277 %14:_(<2 x s16>) = G_FCANONICALIZE %8
278 %11:_(<2 x s16>) = G_FMINNUM_IEEE %one_undef_fcan, %14
279 $vgpr0 = COPY %11(<2 x s16>)
283 name: test_splat_SNaN_and_QNaN_padded_with_undef
284 tracksRegLiveness: true
293 ; CHECK-LABEL: name: test_splat_SNaN_and_QNaN_padded_with_undef
294 ; CHECK: liveins: $vgpr0
296 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
297 ; CHECK-NEXT: %two:_(s16) = G_FCONSTANT half 0xH4000
298 ; CHECK-NEXT: %two_s32:_(s32) = G_ANYEXT %two(s16)
299 ; CHECK-NEXT: %two_splat:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %two_s32(s32), %two_s32(s32)
300 ; CHECK-NEXT: %snan:_(s16) = G_FCONSTANT half 0xH7C01
301 ; CHECK-NEXT: %snan_s32:_(s32) = G_ANYEXT %snan(s16)
302 ; CHECK-NEXT: %undef:_(s32) = G_IMPLICIT_DEF
303 ; CHECK-NEXT: %snan_undef:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %snan_s32(s32), %undef(s32)
304 ; CHECK-NEXT: %qnan:_(s16) = G_FCONSTANT half 0xH7E01
305 ; CHECK-NEXT: %qnan_s32:_(s32) = G_ANYEXT %qnan(s16)
306 ; CHECK-NEXT: %qnan_undef:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %qnan_s32(s32), %undef(s32)
307 ; CHECK-NEXT: [[FMUL:%[0-9]+]]:_(<2 x s16>) = G_FMUL [[COPY]], %two_splat
308 ; CHECK-NEXT: %snan_undef_fcan:_(<2 x s16>) = G_FCANONICALIZE %snan_undef
309 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<2 x s16>) = G_FCANONICALIZE [[FMUL]]
310 ; CHECK-NEXT: [[FMAXNUM_IEEE:%[0-9]+]]:_(<2 x s16>) = G_FMAXNUM_IEEE %snan_undef_fcan, [[FCANONICALIZE]]
311 ; CHECK-NEXT: [[FMINNUM_IEEE:%[0-9]+]]:_(<2 x s16>) = G_FMINNUM_IEEE %qnan_undef, [[FMAXNUM_IEEE]]
312 ; CHECK-NEXT: $vgpr0 = COPY [[FMINNUM_IEEE]](<2 x s16>)
313 %0:_(<2 x s16>) = COPY $vgpr0
314 %two:_(s16) = G_FCONSTANT half 0xH4000
315 %two_s32:_(s32) = G_ANYEXT %two(s16)
316 %two_splat:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %two_s32(s32), %two_s32(s32)
317 %snan:_(s16) = G_FCONSTANT half 0xH7C01
318 %snan_s32:_(s32) = G_ANYEXT %snan(s16)
319 %undef:_(s32) = G_IMPLICIT_DEF
320 %snan_undef:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %snan_s32(s32), %undef(s32)
321 %qnan:_(s16) = G_FCONSTANT half 0xH7E01
322 %qnan_s32:_(s32) = G_ANYEXT %qnan(s16)
323 %qnan_undef:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %qnan_s32(s32), %undef(s32)
324 %4:_(<2 x s16>) = G_FMUL %0, %two_splat
325 %snan_undef_fcan:_(<2 x s16>) = G_FCANONICALIZE %snan_undef
326 %16:_(<2 x s16>) = G_FCANONICALIZE %4
327 %8:_(<2 x s16>) = G_FMAXNUM_IEEE %snan_undef_fcan, %16
328 %qnan_undef_fcan:_(<2 x s16>) = G_FCANONICALIZE %qnan_undef
329 %14:_(<2 x s16>) = G_FCANONICALIZE %8
330 %11:_(<2 x s16>) = G_FMINNUM_IEEE %qnan_undef_fcan, %14
331 $vgpr0 = COPY %11(<2 x s16>)