1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-mesa3d -mcpu=gfx1010 -run-pass=amdgpu-regbank-combiner -verify-machineinstrs %s -o - | FileCheck %s
4 name: test_fmed3_f32_known_nnan_ieee_true
7 tracksRegLiveness: true
16 ; CHECK-LABEL: name: test_fmed3_f32_known_nnan_ieee_true
17 ; CHECK: liveins: $vgpr0
19 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
20 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 2.000000e+00
21 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
22 ; CHECK-NEXT: [[FMUL:%[0-9]+]]:vgpr(s32) = G_FMUL [[COPY]], [[COPY1]]
23 ; CHECK-NEXT: [[AMDGPU_CLAMP:%[0-9]+]]:vgpr(s32) = nnan G_AMDGPU_CLAMP [[FMUL]]
24 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_CLAMP]](s32)
25 %0:vgpr(s32) = COPY $vgpr0
26 %2:sgpr(s32) = G_FCONSTANT float 2.000000e+00
27 %8:vgpr(s32) = COPY %2(s32)
28 %3:vgpr(s32) = G_FMUL %0, %8
29 %6:sgpr(s32) = G_FCONSTANT float 1.000000e+00
30 %5:sgpr(s32) = G_FCONSTANT float 0.000000e+00
31 %9:vgpr(s32) = COPY %5(s32)
32 %10:vgpr(s32) = COPY %6(s32)
33 %4:vgpr(s32) = nnan G_AMDGPU_FMED3 %3(s32), %9(s32), %10(s32)
38 name: test_fmed3_f16_known_nnan_ieee_false
41 tracksRegLiveness: true
50 ; CHECK-LABEL: name: test_fmed3_f16_known_nnan_ieee_false
51 ; CHECK: liveins: $vgpr0
53 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
54 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
55 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s16) = G_FCONSTANT half 0xH4000
56 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s16) = COPY [[C]](s16)
57 ; CHECK-NEXT: [[FMUL:%[0-9]+]]:vgpr(s16) = G_FMUL [[TRUNC]], [[COPY1]]
58 ; CHECK-NEXT: [[AMDGPU_CLAMP:%[0-9]+]]:vgpr(s16) = nnan G_AMDGPU_CLAMP [[FMUL]]
59 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[AMDGPU_CLAMP]](s16)
60 ; CHECK-NEXT: $vgpr0 = COPY [[ANYEXT]](s32)
61 %2:vgpr(s32) = COPY $vgpr0
62 %0:vgpr(s16) = G_TRUNC %2(s32)
63 %3:sgpr(s16) = G_FCONSTANT half 0xH4000
64 %10:vgpr(s16) = COPY %3(s16)
65 %4:vgpr(s16) = G_FMUL %0, %10
66 %7:sgpr(s16) = G_FCONSTANT half 0xH3C00
67 %6:sgpr(s16) = G_FCONSTANT half 0xH0000
68 %11:vgpr(s16) = COPY %6(s16)
69 %12:vgpr(s16) = COPY %7(s16)
70 %5:vgpr(s16) = nnan G_AMDGPU_FMED3 %4(s16), %11(s16), %12(s16)
71 %9:vgpr(s32) = G_ANYEXT %5(s16)
76 name: test_fmed3_non_SNaN_input_ieee_true_dx10clamp_true
79 tracksRegLiveness: true
88 ; CHECK-LABEL: name: test_fmed3_non_SNaN_input_ieee_true_dx10clamp_true
89 ; CHECK: liveins: $vgpr0
91 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
92 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 1.000000e+01
93 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:vgpr(s32) = G_FCANONICALIZE [[COPY]]
94 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
95 ; CHECK-NEXT: [[FMINNUM_IEEE:%[0-9]+]]:vgpr(s32) = G_FMINNUM_IEEE [[FCANONICALIZE]], [[COPY1]]
96 ; CHECK-NEXT: [[AMDGPU_CLAMP:%[0-9]+]]:vgpr(s32) = G_AMDGPU_CLAMP [[FMINNUM_IEEE]]
97 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_CLAMP]](s32)
98 %0:vgpr(s32) = COPY $vgpr0
99 %2:sgpr(s32) = G_FCONSTANT float 1.000000e+01
100 %8:vgpr(s32) = G_FCANONICALIZE %0
101 %9:vgpr(s32) = COPY %2(s32)
102 %3:vgpr(s32) = G_FMINNUM_IEEE %8, %9
103 %6:sgpr(s32) = G_FCONSTANT float 1.000000e+00
104 %5:sgpr(s32) = G_FCONSTANT float 0.000000e+00
105 %10:vgpr(s32) = COPY %5(s32)
106 %11:vgpr(s32) = COPY %6(s32)
107 %4:vgpr(s32) = G_AMDGPU_FMED3 %3(s32), %10(s32), %11(s32)
108 $vgpr0 = COPY %4(s32)
112 name: test_fmed3_maybe_SNaN_input_zero_third_operand_ieee_true_dx10clamp_true
114 regBankSelected: true
115 tracksRegLiveness: true
124 ; CHECK-LABEL: name: test_fmed3_maybe_SNaN_input_zero_third_operand_ieee_true_dx10clamp_true
125 ; CHECK: liveins: $vgpr0
127 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
128 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 2.000000e+00
129 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
130 ; CHECK-NEXT: [[FMUL:%[0-9]+]]:vgpr(s32) = G_FMUL [[COPY]], [[COPY1]]
131 ; CHECK-NEXT: [[AMDGPU_CLAMP:%[0-9]+]]:vgpr(s32) = G_AMDGPU_CLAMP [[FMUL]]
132 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_CLAMP]](s32)
133 %0:vgpr(s32) = COPY $vgpr0
134 %2:sgpr(s32) = G_FCONSTANT float 2.000000e+00
135 %8:vgpr(s32) = COPY %2(s32)
136 %3:vgpr(s32) = G_FMUL %0, %8
137 %6:sgpr(s32) = G_FCONSTANT float 0.000000e+00
138 %5:sgpr(s32) = G_FCONSTANT float 1.000000e+00
139 %9:vgpr(s32) = COPY %5(s32)
140 %10:vgpr(s32) = COPY %6(s32)
141 %4:vgpr(s32) = G_AMDGPU_FMED3 %3(s32), %9(s32), %10(s32)
142 $vgpr0 = COPY %4(s32)
145 # FixMe: add tests with attributes #3 = {"no-nans-fp-math"="true"}
148 name: test_fmed3_f32_maybe_NaN_ieee_false
150 regBankSelected: true
151 tracksRegLiveness: true
160 ; CHECK-LABEL: name: test_fmed3_f32_maybe_NaN_ieee_false
161 ; CHECK: liveins: $vgpr0
163 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
164 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 2.000000e+00
165 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
166 ; CHECK-NEXT: [[FMUL:%[0-9]+]]:vgpr(s32) = G_FMUL [[COPY]], [[COPY1]]
167 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 0.000000e+00
168 ; CHECK-NEXT: [[C2:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 1.000000e+00
169 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C2]](s32)
170 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
171 ; CHECK-NEXT: [[AMDGPU_FMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_FMED3 [[FMUL]], [[COPY2]], [[COPY3]]
172 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_FMED3_]](s32)
173 %0:vgpr(s32) = COPY $vgpr0
174 %2:sgpr(s32) = G_FCONSTANT float 2.000000e+00
175 %8:vgpr(s32) = COPY %2(s32)
176 %3:vgpr(s32) = G_FMUL %0, %8
177 %6:sgpr(s32) = G_FCONSTANT float 0.000000e+00
178 %5:sgpr(s32) = G_FCONSTANT float 1.000000e+00
179 %9:vgpr(s32) = COPY %5(s32)
180 %10:vgpr(s32) = COPY %6(s32)
181 %4:vgpr(s32) = G_AMDGPU_FMED3 %3(s32), %9(s32), %10(s32)
182 $vgpr0 = COPY %4(s32)
186 name: test_fmed3_non_SNaN_input_ieee_true_dx10clamp_false
188 regBankSelected: true
189 tracksRegLiveness: true
198 ; CHECK-LABEL: name: test_fmed3_non_SNaN_input_ieee_true_dx10clamp_false
199 ; CHECK: liveins: $vgpr0
201 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
202 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 1.000000e+01
203 ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:vgpr(s32) = G_FCANONICALIZE [[COPY]]
204 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
205 ; CHECK-NEXT: [[FMINNUM_IEEE:%[0-9]+]]:vgpr(s32) = G_FMINNUM_IEEE [[FCANONICALIZE]], [[COPY1]]
206 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 1.000000e+00
207 ; CHECK-NEXT: [[C2:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 0.000000e+00
208 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[C2]](s32)
209 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
210 ; CHECK-NEXT: [[AMDGPU_FMED3_:%[0-9]+]]:vgpr(s32) = G_AMDGPU_FMED3 [[FMINNUM_IEEE]], [[COPY2]], [[COPY3]]
211 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_FMED3_]](s32)
212 %0:vgpr(s32) = COPY $vgpr0
213 %2:sgpr(s32) = G_FCONSTANT float 1.000000e+01
214 %8:vgpr(s32) = G_FCANONICALIZE %0
215 %9:vgpr(s32) = COPY %2(s32)
216 %3:vgpr(s32) = G_FMINNUM_IEEE %8, %9
217 %6:sgpr(s32) = G_FCONSTANT float 1.000000e+00
218 %5:sgpr(s32) = G_FCONSTANT float 0.000000e+00
219 %10:vgpr(s32) = COPY %5(s32)
220 %11:vgpr(s32) = COPY %6(s32)
221 %4:vgpr(s32) = G_AMDGPU_FMED3 %3(s32), %10(s32), %11(s32)
222 $vgpr0 = COPY %4(s32)
226 name: test_fmed3_maybe_SNaN_input_ieee_true_dx10clamp_true
228 regBankSelected: true
229 tracksRegLiveness: true
238 ; CHECK-LABEL: name: test_fmed3_maybe_SNaN_input_ieee_true_dx10clamp_true
239 ; CHECK: liveins: $vgpr0
241 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
242 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_FCONSTANT float 2.000000e+00
243 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
244 ; CHECK-NEXT: [[FMUL:%[0-9]+]]:vgpr(s32) = G_FMUL [[COPY]], [[COPY1]]
245 ; CHECK-NEXT: [[AMDGPU_CLAMP:%[0-9]+]]:vgpr(s32) = G_AMDGPU_CLAMP [[FMUL]]
246 ; CHECK-NEXT: $vgpr0 = COPY [[AMDGPU_CLAMP]](s32)
247 %0:vgpr(s32) = COPY $vgpr0
248 %2:sgpr(s32) = G_FCONSTANT float 2.000000e+00
249 %8:vgpr(s32) = COPY %2(s32)
250 %3:vgpr(s32) = G_FMUL %0, %8
251 %6:sgpr(s32) = G_FCONSTANT float 1.000000e+00
252 %5:sgpr(s32) = G_FCONSTANT float 0.000000e+00
253 %9:vgpr(s32) = COPY %5(s32)
254 %10:vgpr(s32) = COPY %6(s32)
255 %4:vgpr(s32) = G_AMDGPU_FMED3 %3(s32), %9(s32), %10(s32)
256 $vgpr0 = COPY %4(s32)