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