Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw -mattr=+avx512dq -mattr=+avx512vl| FileCheck %s
      2 
      3 define <8 x i1> @test(<2 x i1> %a) {
      4 ; CHECK-LABEL: test:
      5 ; CHECK:       # BB#0:
      6 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
      7 ; CHECK-NEXT:    kshiftlb $2, %k0, %k0
      8 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
      9 ; CHECK-NEXT:    retq
     10   %res = shufflevector <2 x i1> %a, <2 x i1> undef, <8 x i32> <i32 undef, i32 undef, i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef>
     11   ret <8 x i1> %res
     12 }
     13 
     14 define <8 x i1> @test1(<2 x i1> %a) {
     15 ; CHECK-LABEL: test1:
     16 ; CHECK:       # BB#0:
     17 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
     18 ; CHECK-NEXT:    kshiftlb $4, %k0, %k0
     19 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
     20 ; CHECK-NEXT:    retq
     21   %res = shufflevector <2 x i1> %a, <2 x i1> undef, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 0, i32 1, i32 undef, i32 undef>
     22   ret <8 x i1> %res
     23 }
     24 
     25 define <8 x i1> @test2(<2 x i1> %a) {
     26 ; CHECK-LABEL: test2:
     27 ; CHECK:       # BB#0:
     28 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
     29 ; CHECK-NEXT:    vpmovm2q %k0, %zmm0
     30 ; CHECK-NEXT:    vpxord %zmm1, %zmm1, %zmm1
     31 ; CHECK-NEXT:    vshufi64x2 {{.*#+}} zmm0 = zmm1[0,1,0,1],zmm0[0,1,0,1]
     32 ; CHECK-NEXT:    vpmovq2m %zmm0, %k0
     33 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
     34 ; CHECK-NEXT:    retq
     35   %res = shufflevector <2 x i1> %a, <2 x i1> zeroinitializer, <8 x i32> <i32 3, i32 3, i32 undef, i32 undef, i32 0, i32 1, i32 undef, i32 undef>
     36   ret <8 x i1> %res
     37 }
     38 
     39 define <8 x i1> @test3(<4 x i1> %a) {
     40 ; CHECK-LABEL: test3:
     41 ; CHECK:       # BB#0:
     42 ; CHECK-NEXT:    vpmovd2m %xmm0, %k0
     43 ; CHECK-NEXT:    kshiftlb $4, %k0, %k0
     44 ; CHECK-NEXT:    kshiftrb $4, %k0, %k0
     45 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
     46 ; CHECK-NEXT:    retq
     47 
     48   %res = shufflevector <4 x i1> %a, <4 x i1> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
     49   ret <8 x i1> %res
     50 }
     51 
     52 define <8 x i1> @test4(<4 x i1> %a, <4 x i1>%b) {
     53 ; CHECK-LABEL: test4:
     54 ; CHECK:       # BB#0:
     55 ; CHECK-NEXT:    vpmovd2m %xmm0, %k0
     56 ; CHECK-NEXT:    kshiftlb $4, %k0, %k0
     57 ; CHECK-NEXT:    kshiftrb $4, %k0, %k1
     58 ; CHECK-NEXT:    korb %k0, %k1, %k0
     59 ; CHECK-NEXT:    vpmovm2w %k0, %xmm0
     60 ; CHECK-NEXT:    retq
     61 
     62   %res = shufflevector <4 x i1> %a, <4 x i1> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
     63   ret <8 x i1> %res
     64 }
     65 
     66 define <4 x i1> @test5(<2 x i1> %a, <2 x i1>%b) {
     67 ; CHECK-LABEL: test5:
     68 ; CHECK:       # BB#0:
     69 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
     70 ; CHECK-NEXT:    kshiftlw $2, %k0, %k0
     71 ; CHECK-NEXT:    kshiftrw $2, %k0, %k1
     72 ; CHECK-NEXT:    korw %k0, %k1, %k0
     73 ; CHECK-NEXT:    vpmovm2d %k0, %xmm0
     74 ; CHECK-NEXT:    retq
     75 
     76   %res = shufflevector <2 x i1> %a, <2 x i1> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
     77   ret <4 x i1> %res
     78 }
     79 
     80 define <16 x i1> @test6(<2 x i1> %a, <2 x i1>%b) {
     81 ; CHECK-LABEL: test6:
     82 ; CHECK:       # BB#0:
     83 ; CHECK-NEXT:    vpmovq2m %xmm0, %k0
     84 ; CHECK-NEXT:    kshiftlw $2, %k0, %k0
     85 ; CHECK-NEXT:    kshiftrw $2, %k0, %k1
     86 ; CHECK-NEXT:    korw %k0, %k1, %k0
     87 ; CHECK-NEXT:    kunpckbw %k0, %k0, %k0
     88 ; CHECK-NEXT:    vpmovm2b %k0, %xmm0
     89 ; CHECK-NEXT:    retq
     90 
     91   %res = shufflevector <2 x i1> %a, <2 x i1> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
     92   ret <16 x i1> %res
     93 }
     94 
     95 define <32 x i1> @test7(<4 x i1> %a, <4 x i1>%b) {
     96 ; CHECK-LABEL: test7:
     97 ; CHECK:       # BB#0:
     98 ; CHECK-NEXT:    vpmovd2m %xmm0, %k0
     99 ; CHECK-NEXT:    kshiftlb $4, %k0, %k0
    100 ; CHECK-NEXT:    kshiftrb $4, %k0, %k1
    101 ; CHECK-NEXT:    korb %k0, %k1, %k0
    102 ; CHECK-NEXT:    kunpckbw %k0, %k0, %k0
    103 ; CHECK-NEXT:    kunpckwd %k0, %k0, %k0
    104 ; CHECK-NEXT:    vpmovm2b %k0, %ymm0
    105 ; CHECK-NEXT:    retq
    106 
    107   %res = shufflevector <4 x i1> %a, <4 x i1> %b, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
    108   ret <32 x i1> %res
    109 }
    110 
    111 define <64 x i1> @test8(<8 x i1> %a, <8 x i1>%b) {
    112 ; CHECK-LABEL: test8:
    113 ; CHECK:       # BB#0:
    114 ; CHECK-NEXT:    vpmovw2m %xmm1, %k0
    115 ; CHECK-NEXT:    vpmovw2m %xmm0, %k1
    116 ; CHECK-NEXT:    kunpckdq %k1, %k0, %k0
    117 ; CHECK-NEXT:    vpmovm2b %k0, %zmm0
    118 ; CHECK-NEXT:    retq
    119 
    120   %res = shufflevector <8 x i1> %a, <8 x i1> %b, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
    121   ret <64 x i1> %res
    122 }
    123 
    124