Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -S | FileCheck %s
      2 
      3 define zeroext i8 @t1(float %x, float %y) nounwind {
      4        %a = fcmp ueq float %x, %y
      5        %b = fcmp ord float %x, %y
      6        %c = and i1 %a, %b
      7        %retval = zext i1 %c to i8
      8        ret i8 %retval
      9 ; CHECK: t1
     10 ; CHECK: fcmp oeq float %x, %y
     11 ; CHECK-NOT: fcmp ueq float %x, %y
     12 ; CHECK-NOT: fcmp ord float %x, %y
     13 ; CHECK-NOT: and
     14 }
     15 
     16 define zeroext i8 @t2(float %x, float %y) nounwind {
     17        %a = fcmp olt float %x, %y
     18        %b = fcmp ord float %x, %y
     19        %c = and i1 %a, %b
     20        %retval = zext i1 %c to i8
     21        ret i8 %retval
     22 ; CHECK: t2
     23 ; CHECK: fcmp olt float %x, %y
     24 ; CHECK-NOT: fcmp ord float %x, %y
     25 ; CHECK-NOT: and
     26 }
     27 
     28 define zeroext i8 @t3(float %x, float %y) nounwind {
     29        %a = fcmp oge float %x, %y
     30        %b = fcmp uno float %x, %y
     31        %c = and i1 %a, %b
     32        %retval = zext i1 %c to i8
     33        ret i8 %retval
     34 ; CHECK: t3
     35 ; CHECK: ret i8 0
     36 }
     37 
     38 define zeroext i8 @t4(float %x, float %y) nounwind {
     39        %a = fcmp one float %y, %x
     40        %b = fcmp ord float %x, %y
     41        %c = and i1 %a, %b
     42        %retval = zext i1 %c to i8
     43        ret i8 %retval
     44 ; CHECK: t4
     45 ; CHECK: fcmp one float %y, %x
     46 ; CHECK-NOT: fcmp ord float %x, %y
     47 ; CHECK-NOT: and
     48 }
     49 
     50 define zeroext i8 @t5(float %x, float %y) nounwind {
     51        %a = fcmp ord float %x, %y
     52        %b = fcmp uno float %x, %y
     53        %c = and i1 %a, %b
     54        %retval = zext i1 %c to i8
     55        ret i8 %retval
     56 ; CHECK: t5
     57 ; CHECK: ret i8 0
     58 }
     59 
     60 define zeroext i8 @t6(float %x, float %y) nounwind {
     61        %a = fcmp uno float %x, %y
     62        %b = fcmp ord float %x, %y
     63        %c = and i1 %a, %b
     64        %retval = zext i1 %c to i8
     65        ret i8 %retval
     66 ; CHECK: t6
     67 ; CHECK: ret i8 0
     68 }
     69 
     70 define zeroext i8 @t7(float %x, float %y) nounwind {
     71        %a = fcmp uno float %x, %y
     72        %b = fcmp ult float %x, %y
     73        %c = and i1 %a, %b
     74        %retval = zext i1 %c to i8
     75        ret i8 %retval
     76 ; CHECK: t7
     77 ; CHECK: fcmp uno
     78 ; CHECK-NOT: fcmp ult
     79 }
     80 
     81 ; PR15737
     82 define i1 @t8(float %a, double %b) {
     83   %cmp = fcmp ord float %a, 0.000000e+00
     84   %cmp1 = fcmp ord double %b, 0.000000e+00
     85   %and = and i1 %cmp, %cmp1
     86   ret i1 %and
     87 ; CHECK: t8
     88 ; CHECK: fcmp ord
     89 ; CHECK: fcmp ord
     90 }
     91 
     92 define <2 x i1> @t9(<2 x float> %a, <2 x double> %b) {
     93   %cmp = fcmp ord <2 x float> %a, zeroinitializer
     94   %cmp1 = fcmp ord <2 x double> %b, zeroinitializer
     95   %and = and <2 x i1> %cmp, %cmp1
     96   ret <2 x i1> %and
     97 ; CHECK: t9
     98 ; CHECK: fcmp ord
     99 ; CHECK: fcmp ord
    100 }
    101