Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
      2 
      3 ; CHECK: vcmpltps %ymm
      4 ; CHECK-NOT: vucomiss
      5 define <8 x i32> @cmp00(<8 x float> %a, <8 x float> %b) nounwind readnone {
      6   %bincmp = fcmp olt <8 x float> %a, %b
      7   %s = sext <8 x i1> %bincmp to <8 x i32>
      8   ret <8 x i32> %s
      9 }
     10 
     11 ; CHECK: vcmpltpd %ymm
     12 ; CHECK-NOT: vucomisd
     13 define <4 x i64> @cmp01(<4 x double> %a, <4 x double> %b) nounwind readnone {
     14   %bincmp = fcmp olt <4 x double> %a, %b
     15   %s = sext <4 x i1> %bincmp to <4 x i64>
     16   ret <4 x i64> %s
     17 }
     18 
     19 declare void @scale() nounwind uwtable
     20 
     21 ; CHECK: vucomisd
     22 define void @render() nounwind uwtable {
     23 entry:
     24   br i1 undef, label %for.cond5, label %for.end52
     25 
     26 for.cond5:
     27   %or.cond = and i1 undef, false
     28   br i1 %or.cond, label %for.body33, label %for.cond5
     29 
     30 for.cond30:
     31   br i1 false, label %for.body33, label %for.cond5
     32 
     33 for.body33:
     34   %tobool = fcmp une double undef, 0.000000e+00
     35   br i1 %tobool, label %if.then, label %for.cond30
     36 
     37 if.then:
     38   call void @scale()
     39   br label %for.cond30
     40 
     41 for.end52:
     42   ret void
     43 }
     44 
     45 ; CHECK: vextractf128  $1
     46 ; CHECK: vextractf128  $1
     47 ; CHECK-NEXT: vpcmpgtd  %xmm
     48 ; CHECK-NEXT: vpcmpgtd  %xmm
     49 ; CHECK-NEXT: vinsertf128 $1
     50 define <8 x i32> @int256-cmp(<8 x i32> %i, <8 x i32> %j) nounwind readnone {
     51   %bincmp = icmp slt <8 x i32> %i, %j
     52   %x = sext <8 x i1> %bincmp to <8 x i32>
     53   ret <8 x i32> %x
     54 }
     55 
     56 ; CHECK: vextractf128  $1
     57 ; CHECK: vextractf128  $1
     58 ; CHECK-NEXT: vpcmpgtq  %xmm
     59 ; CHECK-NEXT: vpcmpgtq  %xmm
     60 ; CHECK-NEXT: vinsertf128 $1
     61 define <4 x i64> @v4i64-cmp(<4 x i64> %i, <4 x i64> %j) nounwind readnone {
     62   %bincmp = icmp slt <4 x i64> %i, %j
     63   %x = sext <4 x i1> %bincmp to <4 x i64>
     64   ret <4 x i64> %x
     65 }
     66 
     67 ; CHECK: vextractf128  $1
     68 ; CHECK: vextractf128  $1
     69 ; CHECK-NEXT: vpcmpgtw  %xmm
     70 ; CHECK-NEXT: vpcmpgtw  %xmm
     71 ; CHECK-NEXT: vinsertf128 $1
     72 define <16 x i16> @v16i16-cmp(<16 x i16> %i, <16 x i16> %j) nounwind readnone {
     73   %bincmp = icmp slt <16 x i16> %i, %j
     74   %x = sext <16 x i1> %bincmp to <16 x i16>
     75   ret <16 x i16> %x
     76 }
     77 
     78 ; CHECK: vextractf128  $1
     79 ; CHECK: vextractf128  $1
     80 ; CHECK-NEXT: vpcmpgtb  %xmm
     81 ; CHECK-NEXT: vpcmpgtb  %xmm
     82 ; CHECK-NEXT: vinsertf128 $1
     83 define <32 x i8> @v32i8-cmp(<32 x i8> %i, <32 x i8> %j) nounwind readnone {
     84   %bincmp = icmp slt <32 x i8> %i, %j
     85   %x = sext <32 x i1> %bincmp to <32 x i8>
     86   ret <32 x i8> %x
     87 }
     88 
     89 ; CHECK: vextractf128  $1
     90 ; CHECK: vextractf128  $1
     91 ; CHECK-NEXT: vpcmpeqd  %xmm
     92 ; CHECK-NEXT: vpcmpeqd  %xmm
     93 ; CHECK-NEXT: vinsertf128 $1
     94 define <8 x i32> @int256-cmpeq(<8 x i32> %i, <8 x i32> %j) nounwind readnone {
     95   %bincmp = icmp eq <8 x i32> %i, %j
     96   %x = sext <8 x i1> %bincmp to <8 x i32>
     97   ret <8 x i32> %x
     98 }
     99 
    100 ; CHECK: vextractf128  $1
    101 ; CHECK: vextractf128  $1
    102 ; CHECK-NEXT: vpcmpeqq  %xmm
    103 ; CHECK-NEXT: vpcmpeqq  %xmm
    104 ; CHECK-NEXT: vinsertf128 $1
    105 define <4 x i64> @v4i64-cmpeq(<4 x i64> %i, <4 x i64> %j) nounwind readnone {
    106   %bincmp = icmp eq <4 x i64> %i, %j
    107   %x = sext <4 x i1> %bincmp to <4 x i64>
    108   ret <4 x i64> %x
    109 }
    110 
    111 ; CHECK: vextractf128  $1
    112 ; CHECK: vextractf128  $1
    113 ; CHECK-NEXT: vpcmpeqw  %xmm
    114 ; CHECK-NEXT: vpcmpeqw  %xmm
    115 ; CHECK-NEXT: vinsertf128 $1
    116 define <16 x i16> @v16i16-cmpeq(<16 x i16> %i, <16 x i16> %j) nounwind readnone {
    117   %bincmp = icmp eq <16 x i16> %i, %j
    118   %x = sext <16 x i1> %bincmp to <16 x i16>
    119   ret <16 x i16> %x
    120 }
    121 
    122 ; CHECK: vextractf128  $1
    123 ; CHECK: vextractf128  $1
    124 ; CHECK-NEXT: vpcmpeqb  %xmm
    125 ; CHECK-NEXT: vpcmpeqb  %xmm
    126 ; CHECK-NEXT: vinsertf128 $1
    127 define <32 x i8> @v32i8-cmpeq(<32 x i8> %i, <32 x i8> %j) nounwind readnone {
    128   %bincmp = icmp eq <32 x i8> %i, %j
    129   %x = sext <32 x i1> %bincmp to <32 x i8>
    130   ret <32 x i8> %x
    131 }
    132 
    133 ;; Scalar comparison
    134 
    135 ; CHECK: scalarcmpA
    136 ; CHECK: vcmpeqsd
    137 define i32 @scalarcmpA() uwtable ssp {
    138   %cmp29 = fcmp oeq double undef, 0.000000e+00
    139   %res = zext i1 %cmp29 to i32
    140   ret i32 %res
    141 }
    142 
    143 ; CHECK: scalarcmpB
    144 ; CHECK: vcmpeqss
    145 define i32 @scalarcmpB() uwtable ssp {
    146   %cmp29 = fcmp oeq float undef, 0.000000e+00
    147   %res = zext i1 %cmp29 to i32
    148   ret i32 %res
    149 }
    150 
    151