[InstCombine] Fold IntToPtr and PtrToInt into preceding loads.
[oota-llvm.git] / test / Transforms / InstCombine / fcmp-select.ll
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
8 define double @f0(double %x) nounwind readnone {
9 entry:
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
16 define double @f1(double %x) nounwind readnone {
17 entry:
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
24 define double @f2(double %x, double %y) nounwind readnone {
25 entry:
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
32 define double @f3(double %x, double %y) nounwind readnone {
33 entry:
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
40 define double @f4(double %x) nounwind readnone {
41 entry:
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
48 define double @f5(double %x) nounwind readnone {
49 entry:
50   %cmp = fcmp one double %x, -1.0
51   %cond = select i1 %cmp, double -1.0, double %x
52   ret double %cond
53 }