1; RUN: opt < %s -instcombine -S | FileCheck %s
2
3; x != y ? x : y -> x if it's the right kind of != and at least
4; one of x and y is not negative zero.
5
6; CHECK: f0
7; CHECK: ret double %x
8define double @f0(double %x) nounwind readnone {
9entry:
10  %cmp = fcmp une double %x, -1.0
11  %cond = select i1 %cmp, double %x, double -1.0
12  ret double %cond
13}
14; CHECK: f1
15; CHECK: ret double -1.000000e+00
16define double @f1(double %x) nounwind readnone {
17entry:
18  %cmp = fcmp une double %x, -1.0
19  %cond = select i1 %cmp, double -1.0, double %x
20  ret double %cond
21}
22; CHECK: f2
23; CHECK: ret double %cond
24define double @f2(double %x, double %y) nounwind readnone {
25entry:
26  %cmp = fcmp une double %x, %y
27  %cond = select i1 %cmp, double %x, double %y
28  ret double %cond
29}
30; CHECK: f3
31; CHECK: ret double %cond
32define double @f3(double %x, double %y) nounwind readnone {
33entry:
34  %cmp = fcmp une double %x, %y
35  %cond = select i1 %cmp, double %y, double %x
36  ret double %cond
37}
38; CHECK: f4
39; CHECK: ret double %cond
40define double @f4(double %x) nounwind readnone {
41entry:
42  %cmp = fcmp one double %x, -1.0
43  %cond = select i1 %cmp, double %x, double -1.0
44  ret double %cond
45}
46; CHECK: f5
47; CHECK: ret double %cond
48define double @f5(double %x) nounwind readnone {
49entry:
50  %cmp = fcmp one double %x, -1.0
51  %cond = select i1 %cmp, double -1.0, double %x
52  ret double %cond
53}
54