Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -S | FileCheck %s
      2 
      3 ; Infinity
      4 
      5 ; CHECK: inf0
      6 ; CHECK: ret i1 false
      7 define i1 @inf0(double %arg) nounwind readnone {
      8   %tmp = fcmp ogt double %arg, 0x7FF0000000000000
      9   ret i1 %tmp
     10 }
     11 
     12 ; CHECK: inf1
     13 ; CHECK: ret i1 true
     14 define i1 @inf1(double %arg) nounwind readnone {
     15   %tmp = fcmp ule double %arg, 0x7FF0000000000000
     16   ret i1 %tmp
     17 }
     18 
     19 ; Negative infinity
     20 
     21 ; CHECK: ninf0
     22 ; CHECK: ret i1 false
     23 define i1 @ninf0(double %arg) nounwind readnone {
     24   %tmp = fcmp olt double %arg, 0xFFF0000000000000
     25   ret i1 %tmp
     26 }
     27 
     28 ; CHECK: ninf1
     29 ; CHECK: ret i1 true
     30 define i1 @ninf1(double %arg) nounwind readnone {
     31   %tmp = fcmp uge double %arg, 0xFFF0000000000000
     32   ret i1 %tmp
     33 }
     34 
     35 ; NaNs
     36 
     37 ; CHECK: nan0
     38 ; CHECK: ret i1 false
     39 define i1 @nan0(double %arg) nounwind readnone {
     40   %tmp = fcmp ord double %arg, 0x7FF00000FFFFFFFF
     41   ret i1 %tmp
     42 }
     43 
     44 ; CHECK: nan1
     45 ; CHECK: ret i1 false
     46 define i1 @nan1(double %arg) nounwind readnone {
     47   %tmp = fcmp oeq double %arg, 0x7FF00000FFFFFFFF
     48   ret i1 %tmp
     49 }
     50 
     51 ; CHECK: nan2
     52 ; CHECK: ret i1 false
     53 define i1 @nan2(double %arg) nounwind readnone {
     54   %tmp = fcmp olt double %arg, 0x7FF00000FFFFFFFF
     55   ret i1 %tmp
     56 }
     57 
     58 ; CHECK: nan3
     59 ; CHECK: ret i1 true
     60 define i1 @nan3(double %arg) nounwind readnone {
     61   %tmp = fcmp uno double %arg, 0x7FF00000FFFFFFFF
     62   ret i1 %tmp
     63 }
     64 
     65 ; CHECK: nan4
     66 ; CHECK: ret i1 true
     67 define i1 @nan4(double %arg) nounwind readnone {
     68   %tmp = fcmp une double %arg, 0x7FF00000FFFFFFFF
     69   ret i1 %tmp
     70 }
     71 
     72 ; CHECK: nan5
     73 ; CHECK: ret i1 true
     74 define i1 @nan5(double %arg) nounwind readnone {
     75   %tmp = fcmp ult double %arg, 0x7FF00000FFFFFFFF
     76   ret i1 %tmp
     77 }
     78 
     79 ; Negative NaN.
     80 
     81 ; CHECK: nnan0
     82 ; CHECK: ret i1 false
     83 define i1 @nnan0(double %arg) nounwind readnone {
     84   %tmp = fcmp ord double %arg, 0xFFF00000FFFFFFFF
     85   ret i1 %tmp
     86 }
     87 
     88 ; CHECK: nnan1
     89 ; CHECK: ret i1 false
     90 define i1 @nnan1(double %arg) nounwind readnone {
     91   %tmp = fcmp oeq double %arg, 0xFFF00000FFFFFFFF
     92   ret i1 %tmp
     93 }
     94 
     95 ; CHECK: nnan2
     96 ; CHECK: ret i1 false
     97 define i1 @nnan2(double %arg) nounwind readnone {
     98   %tmp = fcmp olt double %arg, 0xFFF00000FFFFFFFF
     99   ret i1 %tmp
    100 }
    101 
    102 ; CHECK: nnan3
    103 ; CHECK: ret i1 true
    104 define i1 @nnan3(double %arg) nounwind readnone {
    105   %tmp = fcmp uno double %arg, 0xFFF00000FFFFFFFF
    106   ret i1 %tmp
    107 }
    108 
    109 ; CHECK: nnan4
    110 ; CHECK: ret i1 true
    111 define i1 @nnan4(double %arg) nounwind readnone {
    112   %tmp = fcmp une double %arg, 0xFFF00000FFFFFFFF
    113   ret i1 %tmp
    114 }
    115 
    116 ; CHECK: nnan5
    117 ; CHECK: ret i1 true
    118 define i1 @nnan5(double %arg) nounwind readnone {
    119   %tmp = fcmp ult double %arg, 0xFFF00000FFFFFFFF
    120   ret i1 %tmp
    121 }
    122 
    123 ; Negative zero.
    124 
    125 ; CHECK: nzero0
    126 ; CHECK: ret i1 true
    127 define i1 @nzero0() {
    128   %tmp = fcmp oeq double 0.0, -0.0
    129   ret i1 %tmp
    130 }
    131 
    132 ; CHECK: nzero1
    133 ; CHECK: ret i1 false
    134 define i1 @nzero1() {
    135   %tmp = fcmp ogt double 0.0, -0.0
    136   ret i1 %tmp
    137 }
    138 
    139 ; Misc.
    140 
    141 ; CHECK: misc0
    142 ; CHECK: %tmp = fcmp ord double %arg, 0.000000e+00
    143 ; CHECK: ret i1 %tmp
    144 define i1 @misc0(double %arg) {
    145   %tmp = fcmp oeq double %arg, %arg
    146   ret i1 %tmp
    147 }
    148 
    149 ; CHECK: misc1
    150 ; CHECK: ret i1 false
    151 define i1 @misc1(double %arg) {
    152   %tmp = fcmp one double %arg, %arg
    153   ret i1 %tmp
    154 }
    155 
    156