1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -instcombine < %s | FileCheck %s
3
4; This is the canonical form for a type-changing min/max.
5define double @t1(float %a) {
6; CHECK-LABEL: define {{[^@]+}}@t1(
7; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp oge float [[A:%.*]], 5.000000e+00
8; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], float 5.000000e+00, float [[A]]
9; CHECK-NEXT:    [[TMP2:%.*]] = fpext float [[TMP1]] to double
10; CHECK-NEXT:    ret double [[TMP2]]
11;
12  %1 = fcmp ult float %a, 5.0
13  %2 = select i1 %1, float %a, float 5.0
14  %3 = fpext float %2 to double
15  ret double %3
16}
17
18; Check this is converted into canonical form, as above.
19define double @t2(float %a) {
20; CHECK-LABEL: define {{[^@]+}}@t2(
21; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp oge float [[A:%.*]], 5.000000e+00
22; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], float 5.000000e+00, float [[A]]
23; CHECK-NEXT:    [[TMP2:%.*]] = fpext float [[TMP1]] to double
24; CHECK-NEXT:    ret double [[TMP2]]
25;
26  %1 = fcmp ult float %a, 5.0
27  %2 = fpext float %a to double
28  %3 = select i1 %1, double %2, double 5.0
29  ret double %3
30}
31
32; Same again, with trunc.
33define float @t4(double %a) {
34; CHECK-LABEL: define {{[^@]+}}@t4(
35; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp oge double [[A:%.*]], 5.000000e+00
36; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], double 5.000000e+00, double [[A]]
37; CHECK-NEXT:    [[TMP2:%.*]] = fptrunc double [[TMP1]] to float
38; CHECK-NEXT:    ret float [[TMP2]]
39;
40  %1 = fcmp ult double %a, 5.0
41  %2 = fptrunc double %a to float
42  %3 = select i1 %1, float %2, float 5.0
43  ret float %3
44}
45
46; different values, should not be converted.
47define double @t5(float %a) {
48; CHECK-LABEL: define {{[^@]+}}@t5(
49; CHECK-NEXT:    [[TMP1:%.*]] = fcmp ult float [[A:%.*]], 5.000000e+00
50; CHECK-NEXT:    [[TMP2:%.*]] = fpext float [[A]] to double
51; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP1]], double [[TMP2]], double 5.001000e+00
52; CHECK-NEXT:    ret double [[TMP3]]
53;
54  %1 = fcmp ult float %a, 5.0
55  %2 = fpext float %a to double
56  %3 = select i1 %1, double %2, double 5.001
57  ret double %3
58}
59
60; From IEEE754: "Comparisons shall ignore the sign of zero (so +0 = -0)."
61; So the compare constant may be treated as +0.0, and we sink the fpext.
62
63define double @t6(float %a) {
64; CHECK-LABEL: define {{[^@]+}}@t6(
65; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp oge float [[A:%.*]], 0.000000e+00
66; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], float 0.000000e+00, float [[A]]
67; CHECK-NEXT:    [[TMP2:%.*]] = fpext float [[TMP1]] to double
68; CHECK-NEXT:    ret double [[TMP2]]
69;
70  %1 = fcmp ult float %a, -0.0
71  %2 = fpext float %a to double
72  %3 = select i1 %1, double %2, double 0.0
73  ret double %3
74}
75
76; From IEEE754: "Comparisons shall ignore the sign of zero (so +0 = -0)."
77; So the compare constant may be treated as -0.0, and we sink the fpext.
78
79define double @t7(float %a) {
80; CHECK-LABEL: define {{[^@]+}}@t7(
81; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp oge float [[A:%.*]], 0.000000e+00
82; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], float -0.000000e+00, float [[A]]
83; CHECK-NEXT:    [[TMP2:%.*]] = fpext float [[TMP1]] to double
84; CHECK-NEXT:    ret double [[TMP2]]
85;
86  %1 = fcmp ult float %a, 0.0
87  %2 = fpext float %a to double
88  %3 = select i1 %1, double %2, double -0.0
89  ret double %3
90}
91
92; min(min(x, 0.0), 0.0) --> min(x, 0.0)
93
94define float @fmin_fmin_zero_mismatch(float %x) {
95; CHECK-LABEL: define {{[^@]+}}@fmin_fmin_zero_mismatch(
96; CHECK-NEXT:    [[TMP1:%.*]] = fcmp olt float [[X:%.*]], 0.000000e+00
97; CHECK-NEXT:    [[MIN2:%.*]] = select i1 [[TMP1]], float [[X]], float 0.000000e+00
98; CHECK-NEXT:    ret float [[MIN2]]
99;
100  %cmp1 = fcmp olt float %x, -0.0
101  %min1 = select i1 %cmp1, float %x, float 0.0
102  %cmp2 = fcmp olt float %min1, 0.0
103  %min2 = select i1 %cmp2, float %min1, float 0.0
104  ret float %min2
105}
106
107; max(max(x, -0.0), -0.0) --> max(x, -0.0)
108
109define float @fmax_fmax_zero_mismatch(float %x) {
110; CHECK-LABEL: define {{[^@]+}}@fmax_fmax_zero_mismatch(
111; CHECK-NEXT:    [[TMP1:%.*]] = fcmp ogt float [[X:%.*]], -0.000000e+00
112; CHECK-NEXT:    [[MAX11:%.*]] = select i1 [[TMP1]], float [[X]], float -0.000000e+00
113; CHECK-NEXT:    ret float [[MAX11]]
114;
115  %cmp1 = fcmp ogt float %x, 0.0
116  %max1 = select i1 %cmp1, float %x, float -0.0
117  %cmp2 = fcmp ogt float 0.0, %max1
118  %max2 = select i1 %cmp2, float -0.0, float %max1
119  ret float %max2
120}
121
122define i64 @t8(float %a) {
123; CHECK-LABEL: define {{[^@]+}}@t8(
124; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp oge float [[A:%.*]], 5.000000e+00
125; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], float 5.000000e+00, float [[A]]
126; CHECK-NEXT:    [[TMP2:%.*]] = fptoui float [[TMP1]] to i64
127; CHECK-NEXT:    ret i64 [[TMP2]]
128;
129  %1 = fcmp ult float %a, 5.0
130  %2 = fptoui float %a to i64
131  %3 = select i1 %1, i64 %2, i64 5
132  ret i64 %3
133}
134
135define i8 @t9(float %a) {
136; CHECK-LABEL: define {{[^@]+}}@t9(
137; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp oge float [[A:%.*]], 0.000000e+00
138; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], float 0.000000e+00, float [[A]]
139; CHECK-NEXT:    [[TMP2:%.*]] = fptosi float [[TMP1]] to i8
140; CHECK-NEXT:    ret i8 [[TMP2]]
141;
142  %1 = fcmp ult float %a, 0.0
143  %2 = fptosi float %a to i8
144  %3 = select i1 %1, i8 %2, i8 0
145  ret i8 %3
146}
147
148  ; Either operand could be NaN, but fast modifier applied.
149define i8 @t11(float %a, float %b) {
150; CHECK-LABEL: define {{[^@]+}}@t11(
151; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp fast oge float [[B:%.*]], [[A:%.*]]
152; CHECK-NEXT:    [[TMP1:%.*]] = select fast i1 [[DOTINV]], float [[A]], float [[B]]
153; CHECK-NEXT:    [[TMP2:%.*]] = fptosi float [[TMP1]] to i8
154; CHECK-NEXT:    ret i8 [[TMP2]]
155;
156  %1 = fcmp fast ult float %b, %a
157  %2 = fptosi float %a to i8
158  %3 = fptosi float %b to i8
159  %4 = select i1 %1, i8 %3, i8 %2
160  ret i8 %4
161}
162
163; Either operand could be NaN, but nnan modifier applied.
164define i8 @t12(float %a, float %b) {
165; CHECK-LABEL: define {{[^@]+}}@t12(
166; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp nnan oge float [[B:%.*]], [[A:%.*]]
167; CHECK-NEXT:    [[TMP1:%.*]] = select nnan i1 [[DOTINV]], float [[A]], float [[B]]
168; CHECK-NEXT:    [[TMP2:%.*]] = fptosi float [[TMP1]] to i8
169; CHECK-NEXT:    ret i8 [[TMP2]]
170;
171  %1 = fcmp nnan ult float %b, %a
172  %2 = fptosi float %a to i8
173  %3 = fptosi float %b to i8
174  %4 = select i1 %1, i8 %3, i8 %2
175  ret i8 %4
176}
177
178; Float and int values do not match.
179define i8 @t13(float %a) {
180; CHECK-LABEL: define {{[^@]+}}@t13(
181; CHECK-NEXT:    [[TMP1:%.*]] = fcmp ult float [[A:%.*]], 1.500000e+00
182; CHECK-NEXT:    [[TMP2:%.*]] = fptosi float [[A]] to i8
183; CHECK-NEXT:    [[TMP3:%.*]] = select i1 [[TMP1]], i8 [[TMP2]], i8 1
184; CHECK-NEXT:    ret i8 [[TMP3]]
185;
186  %1 = fcmp ult float %a, 1.5
187  %2 = fptosi float %a to i8
188  %3 = select i1 %1, i8 %2, i8 1
189  ret i8 %3
190}
191
192; %a could be -0.0, but it doesn't matter because the conversion to int is the same for 0.0 or -0.0.
193define i8 @t14(float %a) {
194; CHECK-LABEL: define {{[^@]+}}@t14(
195; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp oge float [[A:%.*]], 0.000000e+00
196; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[DOTINV]], float 0.000000e+00, float [[A]]
197; CHECK-NEXT:    [[TMP2:%.*]] = fptosi float [[TMP1]] to i8
198; CHECK-NEXT:    ret i8 [[TMP2]]
199;
200  %1 = fcmp ule float %a, 0.0
201  %2 = fptosi float %a to i8
202  %3 = select i1 %1, i8 %2, i8 0
203  ret i8 %3
204}
205
206define i8 @t14_commute(float %a) {
207; CHECK-LABEL: define {{[^@]+}}@t14_commute(
208; CHECK-NEXT:    [[TMP1:%.*]] = fcmp ogt float [[A:%.*]], 0.000000e+00
209; CHECK-NEXT:    [[TMP2:%.*]] = select i1 [[TMP1]], float [[A]], float 0.000000e+00
210; CHECK-NEXT:    [[TMP3:%.*]] = fptosi float [[TMP2]] to i8
211; CHECK-NEXT:    ret i8 [[TMP3]]
212;
213  %1 = fcmp ule float %a, 0.0
214  %2 = fptosi float %a to i8
215  %3 = select i1 %1, i8 0, i8 %2
216  ret i8 %3
217}
218
219define i8 @t15(float %a) {
220; CHECK-LABEL: define {{[^@]+}}@t15(
221; CHECK-NEXT:    [[DOTINV:%.*]] = fcmp nsz oge float [[A:%.*]], 0.000000e+00
222; CHECK-NEXT:    [[TMP1:%.*]] = select nsz i1 [[DOTINV]], float 0.000000e+00, float [[A]]
223; CHECK-NEXT:    [[TMP2:%.*]] = fptosi float [[TMP1]] to i8
224; CHECK-NEXT:    ret i8 [[TMP2]]
225;
226  %1 = fcmp nsz ule float %a, 0.0
227  %2 = fptosi float %a to i8
228  %3 = select i1 %1, i8 %2, i8 0
229  ret i8 %3
230}
231
232define double @t16(i32 %x) {
233; CHECK-LABEL: define {{[^@]+}}@t16(
234; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[X:%.*]], 0
235; CHECK-NEXT:    [[CST:%.*]] = sitofp i32 [[X]] to double
236; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[CMP]], double [[CST]], double 5.000000e-01
237; CHECK-NEXT:    ret double [[SEL]]
238;
239  %cmp = icmp sgt i32 %x, 0
240  %cst = sitofp i32 %x to double
241  %sel = select i1 %cmp, double %cst, double 5.000000e-01
242  ret double %sel
243}
244
245define double @t17(i32 %x) {
246; CHECK-LABEL: define {{[^@]+}}@t17(
247; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 [[X:%.*]], 2
248; CHECK-NEXT:    [[SEL1:%.*]] = select i1 [[TMP1]], i32 [[X]], i32 2
249; CHECK-NEXT:    [[TMP2:%.*]] = sitofp i32 [[SEL1]] to double
250; CHECK-NEXT:    ret double [[TMP2]]
251;
252  %cmp = icmp sgt i32 %x, 2
253  %cst = sitofp i32 %x to double
254  %sel = select i1 %cmp, double %cst, double 2.0
255  ret double %sel
256}
257
258define float @fneg_fmax(float %x, float %y) {
259; CHECK-LABEL: define {{[^@]+}}@fneg_fmax(
260; CHECK-NEXT:    [[COND:%.*]] = fcmp nnan olt float [[X:%.*]], [[Y:%.*]]
261; CHECK-NEXT:    [[MAX_V:%.*]] = select i1 [[COND]], float [[X]], float [[Y]]
262; CHECK-NEXT:    [[MAX:%.*]] = fneg float [[MAX_V]]
263; CHECK-NEXT:    ret float [[MAX]]
264;
265  %n1 = fneg float %x
266  %n2 = fneg float %y
267  %cond = fcmp nnan ogt float %n1, %n2
268  %max = select i1 %cond, float %n1, float %n2
269  ret float %max
270}
271
272define <2 x float> @fsub_fmax(<2 x float> %x, <2 x float> %y) {
273; CHECK-LABEL: define {{[^@]+}}@fsub_fmax(
274; CHECK-NEXT:    [[COND_INV:%.*]] = fcmp nnan nsz ogt <2 x float> [[X:%.*]], [[Y:%.*]]
275; CHECK-NEXT:    [[TMP1:%.*]] = select nnan nsz <2 x i1> [[COND_INV]], <2 x float> [[Y]], <2 x float> [[X]]
276; CHECK-NEXT:    [[MAX:%.*]] = fneg <2 x float> [[TMP1]]
277; CHECK-NEXT:    ret <2 x float> [[MAX]]
278;
279  %n1 = fsub <2 x float> <float -0.0, float -0.0>, %x
280  %n2 = fsub <2 x float> <float -0.0, float -0.0>, %y
281  %cond = fcmp nsz nnan uge <2 x float> %n1, %n2
282  %max = select <2 x i1> %cond, <2 x float> %n1, <2 x float> %n2
283  ret <2 x float> %max
284}
285
286define <2 x double> @fsub_fmin(<2 x double> %x, <2 x double> %y) {
287; CHECK-LABEL: define {{[^@]+}}@fsub_fmin(
288; CHECK-NEXT:    [[COND:%.*]] = fcmp nnan ogt <2 x double> [[X:%.*]], [[Y:%.*]]
289; CHECK-NEXT:    [[MAX_V:%.*]] = select <2 x i1> [[COND]], <2 x double> [[X]], <2 x double> [[Y]]
290; CHECK-NEXT:    [[MAX:%.*]] = fneg <2 x double> [[MAX_V]]
291; CHECK-NEXT:    ret <2 x double> [[MAX]]
292;
293  %n1 = fsub <2 x double> <double -0.0, double -0.0>, %x
294  %n2 = fsub <2 x double> <double -0.0, double -0.0>, %y
295  %cond = fcmp nnan olt <2 x double> %n1, %n2
296  %max = select <2 x i1> %cond, <2 x double> %n1, <2 x double> %n2
297  ret <2 x double> %max
298}
299
300define double @fneg_fmin(double %x, double %y) {
301; CHECK-LABEL: define {{[^@]+}}@fneg_fmin(
302; CHECK-NEXT:    [[COND_INV:%.*]] = fcmp nnan nsz olt double [[X:%.*]], [[Y:%.*]]
303; CHECK-NEXT:    [[TMP1:%.*]] = select nnan nsz i1 [[COND_INV]], double [[Y]], double [[X]]
304; CHECK-NEXT:    [[MAX:%.*]] = fneg double [[TMP1]]
305; CHECK-NEXT:    ret double [[MAX]]
306;
307  %n1 = fneg double %x
308  %n2 = fneg double %y
309  %cond = fcmp nsz nnan ule double %n1, %n2
310  %max = select i1 %cond, double %n1, double %n2
311  ret double %max
312}
313
314define float @maxnum_ogt_fmf_on_select(float %a, float %b) {
315; CHECK-LABEL: define {{[^@]+}}@maxnum_ogt_fmf_on_select(
316; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz float @llvm.maxnum.f32(float [[A:%.*]], float [[B:%.*]])
317; CHECK-NEXT:    ret float [[TMP1]]
318;
319  %cond = fcmp ogt float %a, %b
320  %f = select nnan nsz i1 %cond, float %a, float %b
321  ret float %f
322}
323
324define <2 x float> @maxnum_oge_fmf_on_select(<2 x float> %a, <2 x float> %b) {
325; CHECK-LABEL: define {{[^@]+}}@maxnum_oge_fmf_on_select(
326; CHECK-NEXT:    [[TMP1:%.*]] = call nnan ninf nsz <2 x float> @llvm.maxnum.v2f32(<2 x float> [[A:%.*]], <2 x float> [[B:%.*]])
327; CHECK-NEXT:    ret <2 x float> [[TMP1]]
328;
329  %cond = fcmp oge <2 x float> %a, %b
330  %f = select ninf nnan nsz <2 x i1> %cond, <2 x float> %a, <2 x float> %b
331  ret <2 x float> %f
332}
333
334define float @maxnum_ogt_fmf_on_fcmp(float %a, float %b) {
335; CHECK-LABEL: define {{[^@]+}}@maxnum_ogt_fmf_on_fcmp(
336; CHECK-NEXT:    [[COND:%.*]] = fcmp nnan nsz ogt float [[A:%.*]], [[B:%.*]]
337; CHECK-NEXT:    [[F:%.*]] = select i1 [[COND]], float [[A]], float [[B]]
338; CHECK-NEXT:    ret float [[F]]
339;
340  %cond = fcmp nnan nsz ogt float %a, %b
341  %f = select i1 %cond, float %a, float %b
342  ret float %f
343}
344
345define <2 x float> @maxnum_oge_fmf_on_fcmp(<2 x float> %a, <2 x float> %b) {
346; CHECK-LABEL: define {{[^@]+}}@maxnum_oge_fmf_on_fcmp(
347; CHECK-NEXT:    [[COND:%.*]] = fcmp nnan ninf nsz oge <2 x float> [[A:%.*]], [[B:%.*]]
348; CHECK-NEXT:    [[F:%.*]] = select <2 x i1> [[COND]], <2 x float> [[A]], <2 x float> [[B]]
349; CHECK-NEXT:    ret <2 x float> [[F]]
350;
351  %cond = fcmp ninf nnan nsz oge <2 x float> %a, %b
352  %f = select <2 x i1> %cond, <2 x float> %a, <2 x float> %b
353  ret <2 x float> %f
354}
355
356define float @maxnum_no_nsz(float %a, float %b) {
357; CHECK-LABEL: define {{[^@]+}}@maxnum_no_nsz(
358; CHECK-NEXT:    [[COND:%.*]] = fcmp ogt float [[A:%.*]], [[B:%.*]]
359; CHECK-NEXT:    [[F:%.*]] = select nnan i1 [[COND]], float [[A]], float [[B]]
360; CHECK-NEXT:    ret float [[F]]
361;
362  %cond = fcmp ogt float %a, %b
363  %f = select nnan i1 %cond, float %a, float %b
364  ret float %f
365}
366
367define float @maxnum_no_nnan(float %a, float %b) {
368; CHECK-LABEL: define {{[^@]+}}@maxnum_no_nnan(
369; CHECK-NEXT:    [[COND:%.*]] = fcmp oge float [[A:%.*]], [[B:%.*]]
370; CHECK-NEXT:    [[F:%.*]] = select nsz i1 [[COND]], float [[A]], float [[B]]
371; CHECK-NEXT:    ret float [[F]]
372;
373  %cond = fcmp oge float %a, %b
374  %f = select nsz i1 %cond, float %a, float %b
375  ret float %f
376}
377
378define float @minnum_olt_fmf_on_select(float %a, float %b) {
379; CHECK-LABEL: define {{[^@]+}}@minnum_olt_fmf_on_select(
380; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz float @llvm.minnum.f32(float [[A:%.*]], float [[B:%.*]])
381; CHECK-NEXT:    ret float [[TMP1]]
382;
383  %cond = fcmp olt float %a, %b
384  %f = select nnan nsz i1 %cond, float %a, float %b
385  ret float %f
386}
387
388define <2 x float> @minnum_ole_fmf_on_select(<2 x float> %a, <2 x float> %b) {
389; CHECK-LABEL: define {{[^@]+}}@minnum_ole_fmf_on_select(
390; CHECK-NEXT:    [[TMP1:%.*]] = call nnan ninf nsz <2 x float> @llvm.minnum.v2f32(<2 x float> [[A:%.*]], <2 x float> [[B:%.*]])
391; CHECK-NEXT:    ret <2 x float> [[TMP1]]
392;
393  %cond = fcmp ole <2 x float> %a, %b
394  %f = select ninf nnan nsz <2 x i1> %cond, <2 x float> %a, <2 x float> %b
395  ret <2 x float> %f
396}
397
398define float @minnum_olt_fmf_on_fcmp(float %a, float %b) {
399; CHECK-LABEL: define {{[^@]+}}@minnum_olt_fmf_on_fcmp(
400; CHECK-NEXT:    [[COND:%.*]] = fcmp nnan nsz olt float [[A:%.*]], [[B:%.*]]
401; CHECK-NEXT:    [[F:%.*]] = select i1 [[COND]], float [[A]], float [[B]]
402; CHECK-NEXT:    ret float [[F]]
403;
404  %cond = fcmp nnan nsz olt float %a, %b
405  %f = select i1 %cond, float %a, float %b
406  ret float %f
407}
408
409define <2 x float> @minnum_ole_fmf_on_fcmp(<2 x float> %a, <2 x float> %b) {
410; CHECK-LABEL: define {{[^@]+}}@minnum_ole_fmf_on_fcmp(
411; CHECK-NEXT:    [[COND:%.*]] = fcmp nnan ninf nsz ole <2 x float> [[A:%.*]], [[B:%.*]]
412; CHECK-NEXT:    [[F:%.*]] = select <2 x i1> [[COND]], <2 x float> [[A]], <2 x float> [[B]]
413; CHECK-NEXT:    ret <2 x float> [[F]]
414;
415  %cond = fcmp ninf nnan nsz ole <2 x float> %a, %b
416  %f = select <2 x i1> %cond, <2 x float> %a, <2 x float> %b
417  ret <2 x float> %f
418}
419
420define float @minnum_no_nsz(float %a, float %b) {
421; CHECK-LABEL: define {{[^@]+}}@minnum_no_nsz(
422; CHECK-NEXT:    [[COND:%.*]] = fcmp olt float [[A:%.*]], [[B:%.*]]
423; CHECK-NEXT:    [[F:%.*]] = select nnan i1 [[COND]], float [[A]], float [[B]]
424; CHECK-NEXT:    ret float [[F]]
425;
426  %cond = fcmp olt float %a, %b
427  %f = select nnan i1 %cond, float %a, float %b
428  ret float %f
429}
430
431define float @minnum_no_nnan(float %a, float %b) {
432; CHECK-LABEL: define {{[^@]+}}@minnum_no_nnan(
433; CHECK-NEXT:    [[COND:%.*]] = fcmp ole float [[A:%.*]], [[B:%.*]]
434; CHECK-NEXT:    [[F:%.*]] = select nsz i1 [[COND]], float [[A]], float [[B]]
435; CHECK-NEXT:    ret float [[F]]
436;
437  %cond = fcmp ole float %a, %b
438  %f = select nsz i1 %cond, float %a, float %b
439  ret float %f
440}
441