Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -march=x86-64 -mcpu=knl | FileCheck %s
      2 
      3 define i16 @mask16(i16 %x) {
      4   %m0 = bitcast i16 %x to <16 x i1>
      5   %m1 = xor <16 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
      6   %ret = bitcast <16 x i1> %m1 to i16
      7   ret i16 %ret
      8 ; CHECK: mask16
      9 ; CHECK: knotw
     10 ; CHECK: ret
     11 }
     12 
     13 define i8 @mask8(i8 %x) {
     14   %m0 = bitcast i8 %x to <8 x i1>
     15   %m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
     16   %ret = bitcast <8 x i1> %m1 to i8
     17   ret i8 %ret
     18 ; CHECK: mask8
     19 ; CHECK: knotw
     20 ; CHECK: ret
     21 }
     22 
     23 define i16 @mand16(i16 %x, i16 %y) {
     24   %ma = bitcast i16 %x to <16 x i1>
     25   %mb = bitcast i16 %y to <16 x i1>
     26   %mc = and <16 x i1> %ma, %mb
     27   %md = xor <16 x i1> %ma, %mb
     28   %me = or <16 x i1> %mc, %md
     29   %ret = bitcast <16 x i1> %me to i16
     30 ; CHECK: kxorw
     31 ; CHECK: kandw
     32 ; CHECK: korw
     33   ret i16 %ret
     34 }
     35 
     36 ; CHECK: unpckbw_test
     37 ; CHECK: kunpckbw
     38 ; CHECK:ret
     39 declare <16 x i1> @llvm.x86.kunpck.v16i1(<8 x i1>, <8 x i1>) nounwind readnone
     40 
     41 define i16 @unpckbw_test(i8 %x, i8 %y) {
     42   %m0 = bitcast i8 %x to <8 x i1>
     43   %m1 = bitcast i8 %y to <8 x i1>
     44   %k = tail call <16 x i1> @llvm.x86.kunpck.v16i1(<8 x i1> %m0, <8 x i1> %m1)
     45   %r = bitcast <16 x i1> %k to i16
     46   ret i16 %r
     47 }
     48 
     49 ; CHECK: shuf_test1
     50 ; CHECK: kshiftrw        $8
     51 ; CHECK:ret
     52 define i8 @shuf_test1(i16 %v) nounwind {
     53    %v1 = bitcast i16 %v to <16 x i1>
     54    %mask = shufflevector <16 x i1> %v1, <16 x i1> undef, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
     55    %mask1 = bitcast <8 x i1> %mask to i8
     56    ret i8 %mask1
     57 }
     58 
     59