Home | History | Annotate | Download | only in X86
      1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
      2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE2-SSSE3,SSE2
      3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ssse3 | FileCheck %s --check-prefixes=SSE2-SSSE3,SSSE3
      4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX12,AVX1
      5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX12,AVX2
      6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl | FileCheck %s --check-prefixes=AVX512 --check-prefixes=AVX512F
      7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw | FileCheck %s --check-prefixes=AVX512 --check-prefixes=AVX512BW
      8 
      9 define i8 @v8i16(<8 x i16> %a, <8 x i16> %b, <8 x i16> %c, <8 x i16> %d) {
     10 ; SSE2-SSSE3-LABEL: v8i16:
     11 ; SSE2-SSSE3:       # %bb.0:
     12 ; SSE2-SSSE3-NEXT:    pcmpgtw %xmm1, %xmm0
     13 ; SSE2-SSSE3-NEXT:    pcmpgtw %xmm3, %xmm2
     14 ; SSE2-SSSE3-NEXT:    pand %xmm0, %xmm2
     15 ; SSE2-SSSE3-NEXT:    packsswb %xmm0, %xmm2
     16 ; SSE2-SSSE3-NEXT:    pmovmskb %xmm2, %eax
     17 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
     18 ; SSE2-SSSE3-NEXT:    retq
     19 ;
     20 ; AVX12-LABEL: v8i16:
     21 ; AVX12:       # %bb.0:
     22 ; AVX12-NEXT:    vpcmpgtw %xmm1, %xmm0, %xmm0
     23 ; AVX12-NEXT:    vpcmpgtw %xmm3, %xmm2, %xmm1
     24 ; AVX12-NEXT:    vpand %xmm1, %xmm0, %xmm0
     25 ; AVX12-NEXT:    vpacksswb %xmm0, %xmm0, %xmm0
     26 ; AVX12-NEXT:    vpmovmskb %xmm0, %eax
     27 ; AVX12-NEXT:    # kill: def $al killed $al killed $eax
     28 ; AVX12-NEXT:    retq
     29 ;
     30 ; AVX512F-LABEL: v8i16:
     31 ; AVX512F:       # %bb.0:
     32 ; AVX512F-NEXT:    vpcmpgtw %xmm1, %xmm0, %xmm0
     33 ; AVX512F-NEXT:    vpmovsxwd %xmm0, %ymm0
     34 ; AVX512F-NEXT:    vptestmd %ymm0, %ymm0, %k1
     35 ; AVX512F-NEXT:    vpcmpgtw %xmm3, %xmm2, %xmm0
     36 ; AVX512F-NEXT:    vpmovsxwd %xmm0, %ymm0
     37 ; AVX512F-NEXT:    vptestmd %ymm0, %ymm0, %k0 {%k1}
     38 ; AVX512F-NEXT:    kmovw %k0, %eax
     39 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
     40 ; AVX512F-NEXT:    vzeroupper
     41 ; AVX512F-NEXT:    retq
     42 ;
     43 ; AVX512BW-LABEL: v8i16:
     44 ; AVX512BW:       # %bb.0:
     45 ; AVX512BW-NEXT:    vpcmpgtw %xmm1, %xmm0, %k1
     46 ; AVX512BW-NEXT:    vpcmpgtw %xmm3, %xmm2, %k0 {%k1}
     47 ; AVX512BW-NEXT:    kmovd %k0, %eax
     48 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
     49 ; AVX512BW-NEXT:    retq
     50   %x0 = icmp sgt <8 x i16> %a, %b
     51   %x1 = icmp sgt <8 x i16> %c, %d
     52   %y = and <8 x i1> %x0, %x1
     53   %res = bitcast <8 x i1> %y to i8
     54   ret i8 %res
     55 }
     56 
     57 define i4 @v4i32(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c, <4 x i32> %d) {
     58 ; SSE2-SSSE3-LABEL: v4i32:
     59 ; SSE2-SSSE3:       # %bb.0:
     60 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm1, %xmm0
     61 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm3, %xmm2
     62 ; SSE2-SSSE3-NEXT:    pand %xmm0, %xmm2
     63 ; SSE2-SSSE3-NEXT:    movmskps %xmm2, %eax
     64 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
     65 ; SSE2-SSSE3-NEXT:    retq
     66 ;
     67 ; AVX12-LABEL: v4i32:
     68 ; AVX12:       # %bb.0:
     69 ; AVX12-NEXT:    vpcmpgtd %xmm1, %xmm0, %xmm0
     70 ; AVX12-NEXT:    vpcmpgtd %xmm3, %xmm2, %xmm1
     71 ; AVX12-NEXT:    vpand %xmm1, %xmm0, %xmm0
     72 ; AVX12-NEXT:    vmovmskps %xmm0, %eax
     73 ; AVX12-NEXT:    # kill: def $al killed $al killed $eax
     74 ; AVX12-NEXT:    retq
     75 ;
     76 ; AVX512F-LABEL: v4i32:
     77 ; AVX512F:       # %bb.0:
     78 ; AVX512F-NEXT:    vpcmpgtd %xmm1, %xmm0, %k1
     79 ; AVX512F-NEXT:    vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
     80 ; AVX512F-NEXT:    kmovw %k0, %eax
     81 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
     82 ; AVX512F-NEXT:    retq
     83 ;
     84 ; AVX512BW-LABEL: v4i32:
     85 ; AVX512BW:       # %bb.0:
     86 ; AVX512BW-NEXT:    vpcmpgtd %xmm1, %xmm0, %k1
     87 ; AVX512BW-NEXT:    vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
     88 ; AVX512BW-NEXT:    kmovd %k0, %eax
     89 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
     90 ; AVX512BW-NEXT:    retq
     91   %x0 = icmp sgt <4 x i32> %a, %b
     92   %x1 = icmp sgt <4 x i32> %c, %d
     93   %y = and <4 x i1> %x0, %x1
     94   %res = bitcast <4 x i1> %y to i4
     95   ret i4 %res
     96 }
     97 
     98 define i4 @v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %c, <4 x float> %d) {
     99 ; SSE2-SSSE3-LABEL: v4f32:
    100 ; SSE2-SSSE3:       # %bb.0:
    101 ; SSE2-SSSE3-NEXT:    cmpltps %xmm0, %xmm1
    102 ; SSE2-SSSE3-NEXT:    cmpltps %xmm2, %xmm3
    103 ; SSE2-SSSE3-NEXT:    andps %xmm1, %xmm3
    104 ; SSE2-SSSE3-NEXT:    movmskps %xmm3, %eax
    105 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    106 ; SSE2-SSSE3-NEXT:    retq
    107 ;
    108 ; AVX12-LABEL: v4f32:
    109 ; AVX12:       # %bb.0:
    110 ; AVX12-NEXT:    vcmpltps %xmm0, %xmm1, %xmm0
    111 ; AVX12-NEXT:    vcmpltps %xmm2, %xmm3, %xmm1
    112 ; AVX12-NEXT:    vandps %xmm1, %xmm0, %xmm0
    113 ; AVX12-NEXT:    vmovmskps %xmm0, %eax
    114 ; AVX12-NEXT:    # kill: def $al killed $al killed $eax
    115 ; AVX12-NEXT:    retq
    116 ;
    117 ; AVX512F-LABEL: v4f32:
    118 ; AVX512F:       # %bb.0:
    119 ; AVX512F-NEXT:    vcmpltps %xmm0, %xmm1, %k1
    120 ; AVX512F-NEXT:    vcmpltps %xmm2, %xmm3, %k0 {%k1}
    121 ; AVX512F-NEXT:    kmovw %k0, %eax
    122 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    123 ; AVX512F-NEXT:    retq
    124 ;
    125 ; AVX512BW-LABEL: v4f32:
    126 ; AVX512BW:       # %bb.0:
    127 ; AVX512BW-NEXT:    vcmpltps %xmm0, %xmm1, %k1
    128 ; AVX512BW-NEXT:    vcmpltps %xmm2, %xmm3, %k0 {%k1}
    129 ; AVX512BW-NEXT:    kmovd %k0, %eax
    130 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    131 ; AVX512BW-NEXT:    retq
    132   %x0 = fcmp ogt <4 x float> %a, %b
    133   %x1 = fcmp ogt <4 x float> %c, %d
    134   %y = and <4 x i1> %x0, %x1
    135   %res = bitcast <4 x i1> %y to i4
    136   ret i4 %res
    137 }
    138 
    139 define i16 @v16i8(<16 x i8> %a, <16 x i8> %b, <16 x i8> %c, <16 x i8> %d) {
    140 ; SSE2-SSSE3-LABEL: v16i8:
    141 ; SSE2-SSSE3:       # %bb.0:
    142 ; SSE2-SSSE3-NEXT:    pcmpgtb %xmm1, %xmm0
    143 ; SSE2-SSSE3-NEXT:    pcmpgtb %xmm3, %xmm2
    144 ; SSE2-SSSE3-NEXT:    pand %xmm0, %xmm2
    145 ; SSE2-SSSE3-NEXT:    pmovmskb %xmm2, %eax
    146 ; SSE2-SSSE3-NEXT:    # kill: def $ax killed $ax killed $eax
    147 ; SSE2-SSSE3-NEXT:    retq
    148 ;
    149 ; AVX12-LABEL: v16i8:
    150 ; AVX12:       # %bb.0:
    151 ; AVX12-NEXT:    vpcmpgtb %xmm1, %xmm0, %xmm0
    152 ; AVX12-NEXT:    vpcmpgtb %xmm3, %xmm2, %xmm1
    153 ; AVX12-NEXT:    vpand %xmm1, %xmm0, %xmm0
    154 ; AVX12-NEXT:    vpmovmskb %xmm0, %eax
    155 ; AVX12-NEXT:    # kill: def $ax killed $ax killed $eax
    156 ; AVX12-NEXT:    retq
    157 ;
    158 ; AVX512F-LABEL: v16i8:
    159 ; AVX512F:       # %bb.0:
    160 ; AVX512F-NEXT:    vpcmpgtb %xmm1, %xmm0, %xmm0
    161 ; AVX512F-NEXT:    vpmovsxbd %xmm0, %zmm0
    162 ; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k1
    163 ; AVX512F-NEXT:    vpcmpgtb %xmm3, %xmm2, %xmm0
    164 ; AVX512F-NEXT:    vpmovsxbd %xmm0, %zmm0
    165 ; AVX512F-NEXT:    vptestmd %zmm0, %zmm0, %k0 {%k1}
    166 ; AVX512F-NEXT:    kmovw %k0, %eax
    167 ; AVX512F-NEXT:    # kill: def $ax killed $ax killed $eax
    168 ; AVX512F-NEXT:    vzeroupper
    169 ; AVX512F-NEXT:    retq
    170 ;
    171 ; AVX512BW-LABEL: v16i8:
    172 ; AVX512BW:       # %bb.0:
    173 ; AVX512BW-NEXT:    vpcmpgtb %xmm1, %xmm0, %k1
    174 ; AVX512BW-NEXT:    vpcmpgtb %xmm3, %xmm2, %k0 {%k1}
    175 ; AVX512BW-NEXT:    kmovd %k0, %eax
    176 ; AVX512BW-NEXT:    # kill: def $ax killed $ax killed $eax
    177 ; AVX512BW-NEXT:    retq
    178   %x0 = icmp sgt <16 x i8> %a, %b
    179   %x1 = icmp sgt <16 x i8> %c, %d
    180   %y = and <16 x i1> %x0, %x1
    181   %res = bitcast <16 x i1> %y to i16
    182   ret i16 %res
    183 }
    184 
    185 define i2 @v2i8(<2 x i8> %a, <2 x i8> %b, <2 x i8> %c, <2 x i8> %d) {
    186 ; SSE2-SSSE3-LABEL: v2i8:
    187 ; SSE2-SSSE3:       # %bb.0:
    188 ; SSE2-SSSE3-NEXT:    psllq $56, %xmm2
    189 ; SSE2-SSSE3-NEXT:    movdqa %xmm2, %xmm4
    190 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm4
    191 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
    192 ; SSE2-SSSE3-NEXT:    psrad $24, %xmm2
    193 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
    194 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
    195 ; SSE2-SSSE3-NEXT:    psllq $56, %xmm3
    196 ; SSE2-SSSE3-NEXT:    movdqa %xmm3, %xmm4
    197 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm4
    198 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
    199 ; SSE2-SSSE3-NEXT:    psrad $24, %xmm3
    200 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,3,2,3]
    201 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
    202 ; SSE2-SSSE3-NEXT:    psllq $56, %xmm0
    203 ; SSE2-SSSE3-NEXT:    movdqa %xmm0, %xmm4
    204 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm4
    205 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
    206 ; SSE2-SSSE3-NEXT:    psrad $24, %xmm0
    207 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
    208 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
    209 ; SSE2-SSSE3-NEXT:    psllq $56, %xmm1
    210 ; SSE2-SSSE3-NEXT:    movdqa %xmm1, %xmm4
    211 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm4
    212 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
    213 ; SSE2-SSSE3-NEXT:    psrad $24, %xmm1
    214 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
    215 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
    216 ; SSE2-SSSE3-NEXT:    movdqa {{.*#+}} xmm4 = [2147483648,0,2147483648,0]
    217 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm1
    218 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm0
    219 ; SSE2-SSSE3-NEXT:    movdqa %xmm0, %xmm5
    220 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm1, %xmm5
    221 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
    222 ; SSE2-SSSE3-NEXT:    pcmpeqd %xmm1, %xmm0
    223 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    224 ; SSE2-SSSE3-NEXT:    pand %xmm6, %xmm0
    225 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm1 = xmm5[1,1,3,3]
    226 ; SSE2-SSSE3-NEXT:    por %xmm0, %xmm1
    227 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm3
    228 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm2
    229 ; SSE2-SSSE3-NEXT:    movdqa %xmm2, %xmm0
    230 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm3, %xmm0
    231 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm0[0,0,2,2]
    232 ; SSE2-SSSE3-NEXT:    pcmpeqd %xmm3, %xmm2
    233 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    234 ; SSE2-SSSE3-NEXT:    pand %xmm4, %xmm2
    235 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    236 ; SSE2-SSSE3-NEXT:    por %xmm2, %xmm0
    237 ; SSE2-SSSE3-NEXT:    pand %xmm1, %xmm0
    238 ; SSE2-SSSE3-NEXT:    movmskpd %xmm0, %eax
    239 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    240 ; SSE2-SSSE3-NEXT:    retq
    241 ;
    242 ; AVX1-LABEL: v2i8:
    243 ; AVX1:       # %bb.0:
    244 ; AVX1-NEXT:    vpsllq $56, %xmm3, %xmm3
    245 ; AVX1-NEXT:    vpsrad $31, %xmm3, %xmm4
    246 ; AVX1-NEXT:    vpsrad $24, %xmm3, %xmm3
    247 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
    248 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm3 = xmm3[0,1],xmm4[2,3],xmm3[4,5],xmm4[6,7]
    249 ; AVX1-NEXT:    vpsllq $56, %xmm2, %xmm2
    250 ; AVX1-NEXT:    vpsrad $31, %xmm2, %xmm4
    251 ; AVX1-NEXT:    vpsrad $24, %xmm2, %xmm2
    252 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    253 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm2 = xmm2[0,1],xmm4[2,3],xmm2[4,5],xmm4[6,7]
    254 ; AVX1-NEXT:    vpcmpgtq %xmm3, %xmm2, %xmm2
    255 ; AVX1-NEXT:    vpsllq $56, %xmm1, %xmm1
    256 ; AVX1-NEXT:    vpsrad $31, %xmm1, %xmm3
    257 ; AVX1-NEXT:    vpsrad $24, %xmm1, %xmm1
    258 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
    259 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
    260 ; AVX1-NEXT:    vpsllq $56, %xmm0, %xmm0
    261 ; AVX1-NEXT:    vpsrad $31, %xmm0, %xmm3
    262 ; AVX1-NEXT:    vpsrad $24, %xmm0, %xmm0
    263 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    264 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm3[2,3],xmm0[4,5],xmm3[6,7]
    265 ; AVX1-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0
    266 ; AVX1-NEXT:    vpand %xmm2, %xmm0, %xmm0
    267 ; AVX1-NEXT:    vmovmskpd %xmm0, %eax
    268 ; AVX1-NEXT:    # kill: def $al killed $al killed $eax
    269 ; AVX1-NEXT:    retq
    270 ;
    271 ; AVX2-LABEL: v2i8:
    272 ; AVX2:       # %bb.0:
    273 ; AVX2-NEXT:    vpsllq $56, %xmm3, %xmm3
    274 ; AVX2-NEXT:    vpsrad $31, %xmm3, %xmm4
    275 ; AVX2-NEXT:    vpsrad $24, %xmm3, %xmm3
    276 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
    277 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm3 = xmm3[0],xmm4[1],xmm3[2],xmm4[3]
    278 ; AVX2-NEXT:    vpsllq $56, %xmm2, %xmm2
    279 ; AVX2-NEXT:    vpsrad $31, %xmm2, %xmm4
    280 ; AVX2-NEXT:    vpsrad $24, %xmm2, %xmm2
    281 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    282 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm2 = xmm2[0],xmm4[1],xmm2[2],xmm4[3]
    283 ; AVX2-NEXT:    vpcmpgtq %xmm3, %xmm2, %xmm2
    284 ; AVX2-NEXT:    vpsllq $56, %xmm1, %xmm1
    285 ; AVX2-NEXT:    vpsrad $31, %xmm1, %xmm3
    286 ; AVX2-NEXT:    vpsrad $24, %xmm1, %xmm1
    287 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
    288 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm1 = xmm1[0],xmm3[1],xmm1[2],xmm3[3]
    289 ; AVX2-NEXT:    vpsllq $56, %xmm0, %xmm0
    290 ; AVX2-NEXT:    vpsrad $31, %xmm0, %xmm3
    291 ; AVX2-NEXT:    vpsrad $24, %xmm0, %xmm0
    292 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    293 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm0 = xmm0[0],xmm3[1],xmm0[2],xmm3[3]
    294 ; AVX2-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0
    295 ; AVX2-NEXT:    vpand %xmm2, %xmm0, %xmm0
    296 ; AVX2-NEXT:    vmovmskpd %xmm0, %eax
    297 ; AVX2-NEXT:    # kill: def $al killed $al killed $eax
    298 ; AVX2-NEXT:    retq
    299 ;
    300 ; AVX512F-LABEL: v2i8:
    301 ; AVX512F:       # %bb.0:
    302 ; AVX512F-NEXT:    vpsllq $56, %xmm3, %xmm3
    303 ; AVX512F-NEXT:    vpsraq $56, %xmm3, %xmm3
    304 ; AVX512F-NEXT:    vpsllq $56, %xmm2, %xmm2
    305 ; AVX512F-NEXT:    vpsraq $56, %xmm2, %xmm2
    306 ; AVX512F-NEXT:    vpsllq $56, %xmm1, %xmm1
    307 ; AVX512F-NEXT:    vpsraq $56, %xmm1, %xmm1
    308 ; AVX512F-NEXT:    vpsllq $56, %xmm0, %xmm0
    309 ; AVX512F-NEXT:    vpsraq $56, %xmm0, %xmm0
    310 ; AVX512F-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
    311 ; AVX512F-NEXT:    vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
    312 ; AVX512F-NEXT:    kmovw %k0, %eax
    313 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    314 ; AVX512F-NEXT:    retq
    315 ;
    316 ; AVX512BW-LABEL: v2i8:
    317 ; AVX512BW:       # %bb.0:
    318 ; AVX512BW-NEXT:    vpsllq $56, %xmm3, %xmm3
    319 ; AVX512BW-NEXT:    vpsraq $56, %xmm3, %xmm3
    320 ; AVX512BW-NEXT:    vpsllq $56, %xmm2, %xmm2
    321 ; AVX512BW-NEXT:    vpsraq $56, %xmm2, %xmm2
    322 ; AVX512BW-NEXT:    vpsllq $56, %xmm1, %xmm1
    323 ; AVX512BW-NEXT:    vpsraq $56, %xmm1, %xmm1
    324 ; AVX512BW-NEXT:    vpsllq $56, %xmm0, %xmm0
    325 ; AVX512BW-NEXT:    vpsraq $56, %xmm0, %xmm0
    326 ; AVX512BW-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
    327 ; AVX512BW-NEXT:    vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
    328 ; AVX512BW-NEXT:    kmovd %k0, %eax
    329 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    330 ; AVX512BW-NEXT:    retq
    331   %x0 = icmp sgt <2 x i8> %a, %b
    332   %x1 = icmp sgt <2 x i8> %c, %d
    333   %y = and <2 x i1> %x0, %x1
    334   %res = bitcast <2 x i1> %y to i2
    335   ret i2 %res
    336 }
    337 
    338 define i2 @v2i16(<2 x i16> %a, <2 x i16> %b, <2 x i16> %c, <2 x i16> %d) {
    339 ; SSE2-SSSE3-LABEL: v2i16:
    340 ; SSE2-SSSE3:       # %bb.0:
    341 ; SSE2-SSSE3-NEXT:    psllq $48, %xmm2
    342 ; SSE2-SSSE3-NEXT:    movdqa %xmm2, %xmm4
    343 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm4
    344 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
    345 ; SSE2-SSSE3-NEXT:    psrad $16, %xmm2
    346 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
    347 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
    348 ; SSE2-SSSE3-NEXT:    psllq $48, %xmm3
    349 ; SSE2-SSSE3-NEXT:    movdqa %xmm3, %xmm4
    350 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm4
    351 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
    352 ; SSE2-SSSE3-NEXT:    psrad $16, %xmm3
    353 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,3,2,3]
    354 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm4[0],xmm3[1],xmm4[1]
    355 ; SSE2-SSSE3-NEXT:    psllq $48, %xmm0
    356 ; SSE2-SSSE3-NEXT:    movdqa %xmm0, %xmm4
    357 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm4
    358 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
    359 ; SSE2-SSSE3-NEXT:    psrad $16, %xmm0
    360 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
    361 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
    362 ; SSE2-SSSE3-NEXT:    psllq $48, %xmm1
    363 ; SSE2-SSSE3-NEXT:    movdqa %xmm1, %xmm4
    364 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm4
    365 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm4[1,3,2,3]
    366 ; SSE2-SSSE3-NEXT:    psrad $16, %xmm1
    367 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
    368 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
    369 ; SSE2-SSSE3-NEXT:    movdqa {{.*#+}} xmm4 = [2147483648,0,2147483648,0]
    370 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm1
    371 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm0
    372 ; SSE2-SSSE3-NEXT:    movdqa %xmm0, %xmm5
    373 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm1, %xmm5
    374 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
    375 ; SSE2-SSSE3-NEXT:    pcmpeqd %xmm1, %xmm0
    376 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    377 ; SSE2-SSSE3-NEXT:    pand %xmm6, %xmm0
    378 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm1 = xmm5[1,1,3,3]
    379 ; SSE2-SSSE3-NEXT:    por %xmm0, %xmm1
    380 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm3
    381 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm2
    382 ; SSE2-SSSE3-NEXT:    movdqa %xmm2, %xmm0
    383 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm3, %xmm0
    384 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm0[0,0,2,2]
    385 ; SSE2-SSSE3-NEXT:    pcmpeqd %xmm3, %xmm2
    386 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    387 ; SSE2-SSSE3-NEXT:    pand %xmm4, %xmm2
    388 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    389 ; SSE2-SSSE3-NEXT:    por %xmm2, %xmm0
    390 ; SSE2-SSSE3-NEXT:    pand %xmm1, %xmm0
    391 ; SSE2-SSSE3-NEXT:    movmskpd %xmm0, %eax
    392 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    393 ; SSE2-SSSE3-NEXT:    retq
    394 ;
    395 ; AVX1-LABEL: v2i16:
    396 ; AVX1:       # %bb.0:
    397 ; AVX1-NEXT:    vpsllq $48, %xmm3, %xmm3
    398 ; AVX1-NEXT:    vpsrad $31, %xmm3, %xmm4
    399 ; AVX1-NEXT:    vpsrad $16, %xmm3, %xmm3
    400 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
    401 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm3 = xmm3[0,1],xmm4[2,3],xmm3[4,5],xmm4[6,7]
    402 ; AVX1-NEXT:    vpsllq $48, %xmm2, %xmm2
    403 ; AVX1-NEXT:    vpsrad $31, %xmm2, %xmm4
    404 ; AVX1-NEXT:    vpsrad $16, %xmm2, %xmm2
    405 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    406 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm2 = xmm2[0,1],xmm4[2,3],xmm2[4,5],xmm4[6,7]
    407 ; AVX1-NEXT:    vpcmpgtq %xmm3, %xmm2, %xmm2
    408 ; AVX1-NEXT:    vpsllq $48, %xmm1, %xmm1
    409 ; AVX1-NEXT:    vpsrad $31, %xmm1, %xmm3
    410 ; AVX1-NEXT:    vpsrad $16, %xmm1, %xmm1
    411 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
    412 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
    413 ; AVX1-NEXT:    vpsllq $48, %xmm0, %xmm0
    414 ; AVX1-NEXT:    vpsrad $31, %xmm0, %xmm3
    415 ; AVX1-NEXT:    vpsrad $16, %xmm0, %xmm0
    416 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    417 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm3[2,3],xmm0[4,5],xmm3[6,7]
    418 ; AVX1-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0
    419 ; AVX1-NEXT:    vpand %xmm2, %xmm0, %xmm0
    420 ; AVX1-NEXT:    vmovmskpd %xmm0, %eax
    421 ; AVX1-NEXT:    # kill: def $al killed $al killed $eax
    422 ; AVX1-NEXT:    retq
    423 ;
    424 ; AVX2-LABEL: v2i16:
    425 ; AVX2:       # %bb.0:
    426 ; AVX2-NEXT:    vpsllq $48, %xmm3, %xmm3
    427 ; AVX2-NEXT:    vpsrad $31, %xmm3, %xmm4
    428 ; AVX2-NEXT:    vpsrad $16, %xmm3, %xmm3
    429 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
    430 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm3 = xmm3[0],xmm4[1],xmm3[2],xmm4[3]
    431 ; AVX2-NEXT:    vpsllq $48, %xmm2, %xmm2
    432 ; AVX2-NEXT:    vpsrad $31, %xmm2, %xmm4
    433 ; AVX2-NEXT:    vpsrad $16, %xmm2, %xmm2
    434 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    435 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm2 = xmm2[0],xmm4[1],xmm2[2],xmm4[3]
    436 ; AVX2-NEXT:    vpcmpgtq %xmm3, %xmm2, %xmm2
    437 ; AVX2-NEXT:    vpsllq $48, %xmm1, %xmm1
    438 ; AVX2-NEXT:    vpsrad $31, %xmm1, %xmm3
    439 ; AVX2-NEXT:    vpsrad $16, %xmm1, %xmm1
    440 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
    441 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm1 = xmm1[0],xmm3[1],xmm1[2],xmm3[3]
    442 ; AVX2-NEXT:    vpsllq $48, %xmm0, %xmm0
    443 ; AVX2-NEXT:    vpsrad $31, %xmm0, %xmm3
    444 ; AVX2-NEXT:    vpsrad $16, %xmm0, %xmm0
    445 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    446 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm0 = xmm0[0],xmm3[1],xmm0[2],xmm3[3]
    447 ; AVX2-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0
    448 ; AVX2-NEXT:    vpand %xmm2, %xmm0, %xmm0
    449 ; AVX2-NEXT:    vmovmskpd %xmm0, %eax
    450 ; AVX2-NEXT:    # kill: def $al killed $al killed $eax
    451 ; AVX2-NEXT:    retq
    452 ;
    453 ; AVX512F-LABEL: v2i16:
    454 ; AVX512F:       # %bb.0:
    455 ; AVX512F-NEXT:    vpsllq $48, %xmm3, %xmm3
    456 ; AVX512F-NEXT:    vpsraq $48, %xmm3, %xmm3
    457 ; AVX512F-NEXT:    vpsllq $48, %xmm2, %xmm2
    458 ; AVX512F-NEXT:    vpsraq $48, %xmm2, %xmm2
    459 ; AVX512F-NEXT:    vpsllq $48, %xmm1, %xmm1
    460 ; AVX512F-NEXT:    vpsraq $48, %xmm1, %xmm1
    461 ; AVX512F-NEXT:    vpsllq $48, %xmm0, %xmm0
    462 ; AVX512F-NEXT:    vpsraq $48, %xmm0, %xmm0
    463 ; AVX512F-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
    464 ; AVX512F-NEXT:    vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
    465 ; AVX512F-NEXT:    kmovw %k0, %eax
    466 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    467 ; AVX512F-NEXT:    retq
    468 ;
    469 ; AVX512BW-LABEL: v2i16:
    470 ; AVX512BW:       # %bb.0:
    471 ; AVX512BW-NEXT:    vpsllq $48, %xmm3, %xmm3
    472 ; AVX512BW-NEXT:    vpsraq $48, %xmm3, %xmm3
    473 ; AVX512BW-NEXT:    vpsllq $48, %xmm2, %xmm2
    474 ; AVX512BW-NEXT:    vpsraq $48, %xmm2, %xmm2
    475 ; AVX512BW-NEXT:    vpsllq $48, %xmm1, %xmm1
    476 ; AVX512BW-NEXT:    vpsraq $48, %xmm1, %xmm1
    477 ; AVX512BW-NEXT:    vpsllq $48, %xmm0, %xmm0
    478 ; AVX512BW-NEXT:    vpsraq $48, %xmm0, %xmm0
    479 ; AVX512BW-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
    480 ; AVX512BW-NEXT:    vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
    481 ; AVX512BW-NEXT:    kmovd %k0, %eax
    482 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    483 ; AVX512BW-NEXT:    retq
    484   %x0 = icmp sgt <2 x i16> %a, %b
    485   %x1 = icmp sgt <2 x i16> %c, %d
    486   %y = and <2 x i1> %x0, %x1
    487   %res = bitcast <2 x i1> %y to i2
    488   ret i2 %res
    489 }
    490 
    491 define i2 @v2i32(<2 x i32> %a, <2 x i32> %b, <2 x i32> %c, <2 x i32> %d) {
    492 ; SSE2-SSSE3-LABEL: v2i32:
    493 ; SSE2-SSSE3:       # %bb.0:
    494 ; SSE2-SSSE3-NEXT:    psllq $32, %xmm2
    495 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm2[1,3,2,3]
    496 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm2
    497 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
    498 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
    499 ; SSE2-SSSE3-NEXT:    psllq $32, %xmm3
    500 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm2 = xmm3[1,3,2,3]
    501 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm3
    502 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm3 = xmm3[1,3,2,3]
    503 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
    504 ; SSE2-SSSE3-NEXT:    psllq $32, %xmm0
    505 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm3 = xmm0[1,3,2,3]
    506 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm0
    507 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
    508 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
    509 ; SSE2-SSSE3-NEXT:    psllq $32, %xmm1
    510 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm1[1,3,2,3]
    511 ; SSE2-SSSE3-NEXT:    psrad $31, %xmm1
    512 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
    513 ; SSE2-SSSE3-NEXT:    punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
    514 ; SSE2-SSSE3-NEXT:    movdqa {{.*#+}} xmm1 = [2147483648,0,2147483648,0]
    515 ; SSE2-SSSE3-NEXT:    pxor %xmm1, %xmm0
    516 ; SSE2-SSSE3-NEXT:    pxor %xmm1, %xmm3
    517 ; SSE2-SSSE3-NEXT:    movdqa %xmm3, %xmm5
    518 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm0, %xmm5
    519 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
    520 ; SSE2-SSSE3-NEXT:    pcmpeqd %xmm0, %xmm3
    521 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm3[1,1,3,3]
    522 ; SSE2-SSSE3-NEXT:    pand %xmm6, %xmm0
    523 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm3 = xmm5[1,1,3,3]
    524 ; SSE2-SSSE3-NEXT:    por %xmm0, %xmm3
    525 ; SSE2-SSSE3-NEXT:    pxor %xmm1, %xmm2
    526 ; SSE2-SSSE3-NEXT:    pxor %xmm1, %xmm4
    527 ; SSE2-SSSE3-NEXT:    movdqa %xmm4, %xmm0
    528 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm2, %xmm0
    529 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm1 = xmm0[0,0,2,2]
    530 ; SSE2-SSSE3-NEXT:    pcmpeqd %xmm2, %xmm4
    531 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm2 = xmm4[1,1,3,3]
    532 ; SSE2-SSSE3-NEXT:    pand %xmm1, %xmm2
    533 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    534 ; SSE2-SSSE3-NEXT:    por %xmm2, %xmm0
    535 ; SSE2-SSSE3-NEXT:    pand %xmm3, %xmm0
    536 ; SSE2-SSSE3-NEXT:    movmskpd %xmm0, %eax
    537 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    538 ; SSE2-SSSE3-NEXT:    retq
    539 ;
    540 ; AVX1-LABEL: v2i32:
    541 ; AVX1:       # %bb.0:
    542 ; AVX1-NEXT:    vpsllq $32, %xmm3, %xmm3
    543 ; AVX1-NEXT:    vpsrad $31, %xmm3, %xmm4
    544 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
    545 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm3 = xmm3[0,1],xmm4[2,3],xmm3[4,5],xmm4[6,7]
    546 ; AVX1-NEXT:    vpsllq $32, %xmm2, %xmm2
    547 ; AVX1-NEXT:    vpsrad $31, %xmm2, %xmm4
    548 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    549 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm2 = xmm2[0,1],xmm4[2,3],xmm2[4,5],xmm4[6,7]
    550 ; AVX1-NEXT:    vpcmpgtq %xmm3, %xmm2, %xmm2
    551 ; AVX1-NEXT:    vpsllq $32, %xmm1, %xmm1
    552 ; AVX1-NEXT:    vpsrad $31, %xmm1, %xmm3
    553 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
    554 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
    555 ; AVX1-NEXT:    vpsllq $32, %xmm0, %xmm0
    556 ; AVX1-NEXT:    vpsrad $31, %xmm0, %xmm3
    557 ; AVX1-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    558 ; AVX1-NEXT:    vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm3[2,3],xmm0[4,5],xmm3[6,7]
    559 ; AVX1-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0
    560 ; AVX1-NEXT:    vpand %xmm2, %xmm0, %xmm0
    561 ; AVX1-NEXT:    vmovmskpd %xmm0, %eax
    562 ; AVX1-NEXT:    # kill: def $al killed $al killed $eax
    563 ; AVX1-NEXT:    retq
    564 ;
    565 ; AVX2-LABEL: v2i32:
    566 ; AVX2:       # %bb.0:
    567 ; AVX2-NEXT:    vpsllq $32, %xmm3, %xmm3
    568 ; AVX2-NEXT:    vpsrad $31, %xmm3, %xmm4
    569 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm3 = xmm3[1,1,3,3]
    570 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm3 = xmm3[0],xmm4[1],xmm3[2],xmm4[3]
    571 ; AVX2-NEXT:    vpsllq $32, %xmm2, %xmm2
    572 ; AVX2-NEXT:    vpsrad $31, %xmm2, %xmm4
    573 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    574 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm2 = xmm2[0],xmm4[1],xmm2[2],xmm4[3]
    575 ; AVX2-NEXT:    vpcmpgtq %xmm3, %xmm2, %xmm2
    576 ; AVX2-NEXT:    vpsllq $32, %xmm1, %xmm1
    577 ; AVX2-NEXT:    vpsrad $31, %xmm1, %xmm3
    578 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
    579 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm1 = xmm1[0],xmm3[1],xmm1[2],xmm3[3]
    580 ; AVX2-NEXT:    vpsllq $32, %xmm0, %xmm0
    581 ; AVX2-NEXT:    vpsrad $31, %xmm0, %xmm3
    582 ; AVX2-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    583 ; AVX2-NEXT:    vpblendd {{.*#+}} xmm0 = xmm0[0],xmm3[1],xmm0[2],xmm3[3]
    584 ; AVX2-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0
    585 ; AVX2-NEXT:    vpand %xmm2, %xmm0, %xmm0
    586 ; AVX2-NEXT:    vmovmskpd %xmm0, %eax
    587 ; AVX2-NEXT:    # kill: def $al killed $al killed $eax
    588 ; AVX2-NEXT:    retq
    589 ;
    590 ; AVX512F-LABEL: v2i32:
    591 ; AVX512F:       # %bb.0:
    592 ; AVX512F-NEXT:    vpsllq $32, %xmm3, %xmm3
    593 ; AVX512F-NEXT:    vpsraq $32, %xmm3, %xmm3
    594 ; AVX512F-NEXT:    vpsllq $32, %xmm2, %xmm2
    595 ; AVX512F-NEXT:    vpsraq $32, %xmm2, %xmm2
    596 ; AVX512F-NEXT:    vpsllq $32, %xmm1, %xmm1
    597 ; AVX512F-NEXT:    vpsraq $32, %xmm1, %xmm1
    598 ; AVX512F-NEXT:    vpsllq $32, %xmm0, %xmm0
    599 ; AVX512F-NEXT:    vpsraq $32, %xmm0, %xmm0
    600 ; AVX512F-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
    601 ; AVX512F-NEXT:    vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
    602 ; AVX512F-NEXT:    kmovw %k0, %eax
    603 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    604 ; AVX512F-NEXT:    retq
    605 ;
    606 ; AVX512BW-LABEL: v2i32:
    607 ; AVX512BW:       # %bb.0:
    608 ; AVX512BW-NEXT:    vpsllq $32, %xmm3, %xmm3
    609 ; AVX512BW-NEXT:    vpsraq $32, %xmm3, %xmm3
    610 ; AVX512BW-NEXT:    vpsllq $32, %xmm2, %xmm2
    611 ; AVX512BW-NEXT:    vpsraq $32, %xmm2, %xmm2
    612 ; AVX512BW-NEXT:    vpsllq $32, %xmm1, %xmm1
    613 ; AVX512BW-NEXT:    vpsraq $32, %xmm1, %xmm1
    614 ; AVX512BW-NEXT:    vpsllq $32, %xmm0, %xmm0
    615 ; AVX512BW-NEXT:    vpsraq $32, %xmm0, %xmm0
    616 ; AVX512BW-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
    617 ; AVX512BW-NEXT:    vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
    618 ; AVX512BW-NEXT:    kmovd %k0, %eax
    619 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    620 ; AVX512BW-NEXT:    retq
    621   %x0 = icmp sgt <2 x i32> %a, %b
    622   %x1 = icmp sgt <2 x i32> %c, %d
    623   %y = and <2 x i1> %x0, %x1
    624   %res = bitcast <2 x i1> %y to i2
    625   ret i2 %res
    626 }
    627 
    628 define i2 @v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c, <2 x i64> %d) {
    629 ; SSE2-SSSE3-LABEL: v2i64:
    630 ; SSE2-SSSE3:       # %bb.0:
    631 ; SSE2-SSSE3-NEXT:    movdqa {{.*#+}} xmm4 = [2147483648,0,2147483648,0]
    632 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm1
    633 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm0
    634 ; SSE2-SSSE3-NEXT:    movdqa %xmm0, %xmm5
    635 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm1, %xmm5
    636 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm6 = xmm5[0,0,2,2]
    637 ; SSE2-SSSE3-NEXT:    pcmpeqd %xmm1, %xmm0
    638 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    639 ; SSE2-SSSE3-NEXT:    pand %xmm6, %xmm0
    640 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm1 = xmm5[1,1,3,3]
    641 ; SSE2-SSSE3-NEXT:    por %xmm0, %xmm1
    642 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm3
    643 ; SSE2-SSSE3-NEXT:    pxor %xmm4, %xmm2
    644 ; SSE2-SSSE3-NEXT:    movdqa %xmm2, %xmm0
    645 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm3, %xmm0
    646 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm4 = xmm0[0,0,2,2]
    647 ; SSE2-SSSE3-NEXT:    pcmpeqd %xmm3, %xmm2
    648 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
    649 ; SSE2-SSSE3-NEXT:    pand %xmm4, %xmm2
    650 ; SSE2-SSSE3-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[1,1,3,3]
    651 ; SSE2-SSSE3-NEXT:    por %xmm2, %xmm0
    652 ; SSE2-SSSE3-NEXT:    pand %xmm1, %xmm0
    653 ; SSE2-SSSE3-NEXT:    movmskpd %xmm0, %eax
    654 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    655 ; SSE2-SSSE3-NEXT:    retq
    656 ;
    657 ; AVX12-LABEL: v2i64:
    658 ; AVX12:       # %bb.0:
    659 ; AVX12-NEXT:    vpcmpgtq %xmm1, %xmm0, %xmm0
    660 ; AVX12-NEXT:    vpcmpgtq %xmm3, %xmm2, %xmm1
    661 ; AVX12-NEXT:    vpand %xmm1, %xmm0, %xmm0
    662 ; AVX12-NEXT:    vmovmskpd %xmm0, %eax
    663 ; AVX12-NEXT:    # kill: def $al killed $al killed $eax
    664 ; AVX12-NEXT:    retq
    665 ;
    666 ; AVX512F-LABEL: v2i64:
    667 ; AVX512F:       # %bb.0:
    668 ; AVX512F-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
    669 ; AVX512F-NEXT:    vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
    670 ; AVX512F-NEXT:    kmovw %k0, %eax
    671 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    672 ; AVX512F-NEXT:    retq
    673 ;
    674 ; AVX512BW-LABEL: v2i64:
    675 ; AVX512BW:       # %bb.0:
    676 ; AVX512BW-NEXT:    vpcmpgtq %xmm1, %xmm0, %k1
    677 ; AVX512BW-NEXT:    vpcmpgtq %xmm3, %xmm2, %k0 {%k1}
    678 ; AVX512BW-NEXT:    kmovd %k0, %eax
    679 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    680 ; AVX512BW-NEXT:    retq
    681   %x0 = icmp sgt <2 x i64> %a, %b
    682   %x1 = icmp sgt <2 x i64> %c, %d
    683   %y = and <2 x i1> %x0, %x1
    684   %res = bitcast <2 x i1> %y to i2
    685   ret i2 %res
    686 }
    687 
    688 define i2 @v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %c, <2 x double> %d) {
    689 ; SSE2-SSSE3-LABEL: v2f64:
    690 ; SSE2-SSSE3:       # %bb.0:
    691 ; SSE2-SSSE3-NEXT:    cmpltpd %xmm0, %xmm1
    692 ; SSE2-SSSE3-NEXT:    cmpltpd %xmm2, %xmm3
    693 ; SSE2-SSSE3-NEXT:    andpd %xmm1, %xmm3
    694 ; SSE2-SSSE3-NEXT:    movmskpd %xmm3, %eax
    695 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    696 ; SSE2-SSSE3-NEXT:    retq
    697 ;
    698 ; AVX12-LABEL: v2f64:
    699 ; AVX12:       # %bb.0:
    700 ; AVX12-NEXT:    vcmpltpd %xmm0, %xmm1, %xmm0
    701 ; AVX12-NEXT:    vcmpltpd %xmm2, %xmm3, %xmm1
    702 ; AVX12-NEXT:    vandpd %xmm1, %xmm0, %xmm0
    703 ; AVX12-NEXT:    vmovmskpd %xmm0, %eax
    704 ; AVX12-NEXT:    # kill: def $al killed $al killed $eax
    705 ; AVX12-NEXT:    retq
    706 ;
    707 ; AVX512F-LABEL: v2f64:
    708 ; AVX512F:       # %bb.0:
    709 ; AVX512F-NEXT:    vcmpltpd %xmm0, %xmm1, %k1
    710 ; AVX512F-NEXT:    vcmpltpd %xmm2, %xmm3, %k0 {%k1}
    711 ; AVX512F-NEXT:    kmovw %k0, %eax
    712 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    713 ; AVX512F-NEXT:    retq
    714 ;
    715 ; AVX512BW-LABEL: v2f64:
    716 ; AVX512BW:       # %bb.0:
    717 ; AVX512BW-NEXT:    vcmpltpd %xmm0, %xmm1, %k1
    718 ; AVX512BW-NEXT:    vcmpltpd %xmm2, %xmm3, %k0 {%k1}
    719 ; AVX512BW-NEXT:    kmovd %k0, %eax
    720 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    721 ; AVX512BW-NEXT:    retq
    722   %x0 = fcmp ogt <2 x double> %a, %b
    723   %x1 = fcmp ogt <2 x double> %c, %d
    724   %y = and <2 x i1> %x0, %x1
    725   %res = bitcast <2 x i1> %y to i2
    726   ret i2 %res
    727 }
    728 
    729 define i4 @v4i8(<4 x i8> %a, <4 x i8> %b, <4 x i8> %c, <4 x i8> %d) {
    730 ; SSE2-SSSE3-LABEL: v4i8:
    731 ; SSE2-SSSE3:       # %bb.0:
    732 ; SSE2-SSSE3-NEXT:    pslld $24, %xmm3
    733 ; SSE2-SSSE3-NEXT:    psrad $24, %xmm3
    734 ; SSE2-SSSE3-NEXT:    pslld $24, %xmm2
    735 ; SSE2-SSSE3-NEXT:    psrad $24, %xmm2
    736 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm3, %xmm2
    737 ; SSE2-SSSE3-NEXT:    pslld $24, %xmm1
    738 ; SSE2-SSSE3-NEXT:    psrad $24, %xmm1
    739 ; SSE2-SSSE3-NEXT:    pslld $24, %xmm0
    740 ; SSE2-SSSE3-NEXT:    psrad $24, %xmm0
    741 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm1, %xmm0
    742 ; SSE2-SSSE3-NEXT:    pand %xmm2, %xmm0
    743 ; SSE2-SSSE3-NEXT:    movmskps %xmm0, %eax
    744 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    745 ; SSE2-SSSE3-NEXT:    retq
    746 ;
    747 ; AVX12-LABEL: v4i8:
    748 ; AVX12:       # %bb.0:
    749 ; AVX12-NEXT:    vpslld $24, %xmm3, %xmm3
    750 ; AVX12-NEXT:    vpsrad $24, %xmm3, %xmm3
    751 ; AVX12-NEXT:    vpslld $24, %xmm2, %xmm2
    752 ; AVX12-NEXT:    vpsrad $24, %xmm2, %xmm2
    753 ; AVX12-NEXT:    vpcmpgtd %xmm3, %xmm2, %xmm2
    754 ; AVX12-NEXT:    vpslld $24, %xmm1, %xmm1
    755 ; AVX12-NEXT:    vpsrad $24, %xmm1, %xmm1
    756 ; AVX12-NEXT:    vpslld $24, %xmm0, %xmm0
    757 ; AVX12-NEXT:    vpsrad $24, %xmm0, %xmm0
    758 ; AVX12-NEXT:    vpcmpgtd %xmm1, %xmm0, %xmm0
    759 ; AVX12-NEXT:    vpand %xmm2, %xmm0, %xmm0
    760 ; AVX12-NEXT:    vmovmskps %xmm0, %eax
    761 ; AVX12-NEXT:    # kill: def $al killed $al killed $eax
    762 ; AVX12-NEXT:    retq
    763 ;
    764 ; AVX512F-LABEL: v4i8:
    765 ; AVX512F:       # %bb.0:
    766 ; AVX512F-NEXT:    vpslld $24, %xmm3, %xmm3
    767 ; AVX512F-NEXT:    vpsrad $24, %xmm3, %xmm3
    768 ; AVX512F-NEXT:    vpslld $24, %xmm2, %xmm2
    769 ; AVX512F-NEXT:    vpsrad $24, %xmm2, %xmm2
    770 ; AVX512F-NEXT:    vpslld $24, %xmm1, %xmm1
    771 ; AVX512F-NEXT:    vpsrad $24, %xmm1, %xmm1
    772 ; AVX512F-NEXT:    vpslld $24, %xmm0, %xmm0
    773 ; AVX512F-NEXT:    vpsrad $24, %xmm0, %xmm0
    774 ; AVX512F-NEXT:    vpcmpgtd %xmm1, %xmm0, %k1
    775 ; AVX512F-NEXT:    vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
    776 ; AVX512F-NEXT:    kmovw %k0, %eax
    777 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    778 ; AVX512F-NEXT:    retq
    779 ;
    780 ; AVX512BW-LABEL: v4i8:
    781 ; AVX512BW:       # %bb.0:
    782 ; AVX512BW-NEXT:    vpslld $24, %xmm3, %xmm3
    783 ; AVX512BW-NEXT:    vpsrad $24, %xmm3, %xmm3
    784 ; AVX512BW-NEXT:    vpslld $24, %xmm2, %xmm2
    785 ; AVX512BW-NEXT:    vpsrad $24, %xmm2, %xmm2
    786 ; AVX512BW-NEXT:    vpslld $24, %xmm1, %xmm1
    787 ; AVX512BW-NEXT:    vpsrad $24, %xmm1, %xmm1
    788 ; AVX512BW-NEXT:    vpslld $24, %xmm0, %xmm0
    789 ; AVX512BW-NEXT:    vpsrad $24, %xmm0, %xmm0
    790 ; AVX512BW-NEXT:    vpcmpgtd %xmm1, %xmm0, %k1
    791 ; AVX512BW-NEXT:    vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
    792 ; AVX512BW-NEXT:    kmovd %k0, %eax
    793 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    794 ; AVX512BW-NEXT:    retq
    795   %x0 = icmp sgt <4 x i8> %a, %b
    796   %x1 = icmp sgt <4 x i8> %c, %d
    797   %y = and <4 x i1> %x0, %x1
    798   %res = bitcast <4 x i1> %y to i4
    799   ret i4 %res
    800 }
    801 
    802 define i4 @v4i16(<4 x i16> %a, <4 x i16> %b, <4 x i16> %c, <4 x i16> %d) {
    803 ; SSE2-SSSE3-LABEL: v4i16:
    804 ; SSE2-SSSE3:       # %bb.0:
    805 ; SSE2-SSSE3-NEXT:    pslld $16, %xmm3
    806 ; SSE2-SSSE3-NEXT:    psrad $16, %xmm3
    807 ; SSE2-SSSE3-NEXT:    pslld $16, %xmm2
    808 ; SSE2-SSSE3-NEXT:    psrad $16, %xmm2
    809 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm3, %xmm2
    810 ; SSE2-SSSE3-NEXT:    pslld $16, %xmm1
    811 ; SSE2-SSSE3-NEXT:    psrad $16, %xmm1
    812 ; SSE2-SSSE3-NEXT:    pslld $16, %xmm0
    813 ; SSE2-SSSE3-NEXT:    psrad $16, %xmm0
    814 ; SSE2-SSSE3-NEXT:    pcmpgtd %xmm1, %xmm0
    815 ; SSE2-SSSE3-NEXT:    pand %xmm2, %xmm0
    816 ; SSE2-SSSE3-NEXT:    movmskps %xmm0, %eax
    817 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    818 ; SSE2-SSSE3-NEXT:    retq
    819 ;
    820 ; AVX12-LABEL: v4i16:
    821 ; AVX12:       # %bb.0:
    822 ; AVX12-NEXT:    vpslld $16, %xmm3, %xmm3
    823 ; AVX12-NEXT:    vpsrad $16, %xmm3, %xmm3
    824 ; AVX12-NEXT:    vpslld $16, %xmm2, %xmm2
    825 ; AVX12-NEXT:    vpsrad $16, %xmm2, %xmm2
    826 ; AVX12-NEXT:    vpcmpgtd %xmm3, %xmm2, %xmm2
    827 ; AVX12-NEXT:    vpslld $16, %xmm1, %xmm1
    828 ; AVX12-NEXT:    vpsrad $16, %xmm1, %xmm1
    829 ; AVX12-NEXT:    vpslld $16, %xmm0, %xmm0
    830 ; AVX12-NEXT:    vpsrad $16, %xmm0, %xmm0
    831 ; AVX12-NEXT:    vpcmpgtd %xmm1, %xmm0, %xmm0
    832 ; AVX12-NEXT:    vpand %xmm2, %xmm0, %xmm0
    833 ; AVX12-NEXT:    vmovmskps %xmm0, %eax
    834 ; AVX12-NEXT:    # kill: def $al killed $al killed $eax
    835 ; AVX12-NEXT:    retq
    836 ;
    837 ; AVX512F-LABEL: v4i16:
    838 ; AVX512F:       # %bb.0:
    839 ; AVX512F-NEXT:    vpslld $16, %xmm3, %xmm3
    840 ; AVX512F-NEXT:    vpsrad $16, %xmm3, %xmm3
    841 ; AVX512F-NEXT:    vpslld $16, %xmm2, %xmm2
    842 ; AVX512F-NEXT:    vpsrad $16, %xmm2, %xmm2
    843 ; AVX512F-NEXT:    vpslld $16, %xmm1, %xmm1
    844 ; AVX512F-NEXT:    vpsrad $16, %xmm1, %xmm1
    845 ; AVX512F-NEXT:    vpslld $16, %xmm0, %xmm0
    846 ; AVX512F-NEXT:    vpsrad $16, %xmm0, %xmm0
    847 ; AVX512F-NEXT:    vpcmpgtd %xmm1, %xmm0, %k1
    848 ; AVX512F-NEXT:    vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
    849 ; AVX512F-NEXT:    kmovw %k0, %eax
    850 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    851 ; AVX512F-NEXT:    retq
    852 ;
    853 ; AVX512BW-LABEL: v4i16:
    854 ; AVX512BW:       # %bb.0:
    855 ; AVX512BW-NEXT:    vpslld $16, %xmm3, %xmm3
    856 ; AVX512BW-NEXT:    vpsrad $16, %xmm3, %xmm3
    857 ; AVX512BW-NEXT:    vpslld $16, %xmm2, %xmm2
    858 ; AVX512BW-NEXT:    vpsrad $16, %xmm2, %xmm2
    859 ; AVX512BW-NEXT:    vpslld $16, %xmm1, %xmm1
    860 ; AVX512BW-NEXT:    vpsrad $16, %xmm1, %xmm1
    861 ; AVX512BW-NEXT:    vpslld $16, %xmm0, %xmm0
    862 ; AVX512BW-NEXT:    vpsrad $16, %xmm0, %xmm0
    863 ; AVX512BW-NEXT:    vpcmpgtd %xmm1, %xmm0, %k1
    864 ; AVX512BW-NEXT:    vpcmpgtd %xmm3, %xmm2, %k0 {%k1}
    865 ; AVX512BW-NEXT:    kmovd %k0, %eax
    866 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    867 ; AVX512BW-NEXT:    retq
    868   %x0 = icmp sgt <4 x i16> %a, %b
    869   %x1 = icmp sgt <4 x i16> %c, %d
    870   %y = and <4 x i1> %x0, %x1
    871   %res = bitcast <4 x i1> %y to i4
    872   ret i4 %res
    873 }
    874 
    875 define i8 @v8i8(<8 x i8> %a, <8 x i8> %b, <8 x i8> %c, <8 x i8> %d) {
    876 ; SSE2-SSSE3-LABEL: v8i8:
    877 ; SSE2-SSSE3:       # %bb.0:
    878 ; SSE2-SSSE3-NEXT:    psllw $8, %xmm3
    879 ; SSE2-SSSE3-NEXT:    psraw $8, %xmm3
    880 ; SSE2-SSSE3-NEXT:    psllw $8, %xmm2
    881 ; SSE2-SSSE3-NEXT:    psraw $8, %xmm2
    882 ; SSE2-SSSE3-NEXT:    pcmpgtw %xmm3, %xmm2
    883 ; SSE2-SSSE3-NEXT:    psllw $8, %xmm1
    884 ; SSE2-SSSE3-NEXT:    psraw $8, %xmm1
    885 ; SSE2-SSSE3-NEXT:    psllw $8, %xmm0
    886 ; SSE2-SSSE3-NEXT:    psraw $8, %xmm0
    887 ; SSE2-SSSE3-NEXT:    pcmpgtw %xmm1, %xmm0
    888 ; SSE2-SSSE3-NEXT:    pand %xmm2, %xmm0
    889 ; SSE2-SSSE3-NEXT:    packsswb %xmm0, %xmm0
    890 ; SSE2-SSSE3-NEXT:    pmovmskb %xmm0, %eax
    891 ; SSE2-SSSE3-NEXT:    # kill: def $al killed $al killed $eax
    892 ; SSE2-SSSE3-NEXT:    retq
    893 ;
    894 ; AVX12-LABEL: v8i8:
    895 ; AVX12:       # %bb.0:
    896 ; AVX12-NEXT:    vpsllw $8, %xmm3, %xmm3
    897 ; AVX12-NEXT:    vpsraw $8, %xmm3, %xmm3
    898 ; AVX12-NEXT:    vpsllw $8, %xmm2, %xmm2
    899 ; AVX12-NEXT:    vpsraw $8, %xmm2, %xmm2
    900 ; AVX12-NEXT:    vpcmpgtw %xmm3, %xmm2, %xmm2
    901 ; AVX12-NEXT:    vpsllw $8, %xmm1, %xmm1
    902 ; AVX12-NEXT:    vpsraw $8, %xmm1, %xmm1
    903 ; AVX12-NEXT:    vpsllw $8, %xmm0, %xmm0
    904 ; AVX12-NEXT:    vpsraw $8, %xmm0, %xmm0
    905 ; AVX12-NEXT:    vpcmpgtw %xmm1, %xmm0, %xmm0
    906 ; AVX12-NEXT:    vpand %xmm2, %xmm0, %xmm0
    907 ; AVX12-NEXT:    vpacksswb %xmm0, %xmm0, %xmm0
    908 ; AVX12-NEXT:    vpmovmskb %xmm0, %eax
    909 ; AVX12-NEXT:    # kill: def $al killed $al killed $eax
    910 ; AVX12-NEXT:    retq
    911 ;
    912 ; AVX512F-LABEL: v8i8:
    913 ; AVX512F:       # %bb.0:
    914 ; AVX512F-NEXT:    vpsllw $8, %xmm3, %xmm3
    915 ; AVX512F-NEXT:    vpsraw $8, %xmm3, %xmm3
    916 ; AVX512F-NEXT:    vpsllw $8, %xmm2, %xmm2
    917 ; AVX512F-NEXT:    vpsraw $8, %xmm2, %xmm2
    918 ; AVX512F-NEXT:    vpcmpgtw %xmm3, %xmm2, %xmm2
    919 ; AVX512F-NEXT:    vpsllw $8, %xmm1, %xmm1
    920 ; AVX512F-NEXT:    vpsraw $8, %xmm1, %xmm1
    921 ; AVX512F-NEXT:    vpsllw $8, %xmm0, %xmm0
    922 ; AVX512F-NEXT:    vpsraw $8, %xmm0, %xmm0
    923 ; AVX512F-NEXT:    vpcmpgtw %xmm1, %xmm0, %xmm0
    924 ; AVX512F-NEXT:    vpmovsxwd %xmm0, %ymm0
    925 ; AVX512F-NEXT:    vptestmd %ymm0, %ymm0, %k1
    926 ; AVX512F-NEXT:    vpmovsxwd %xmm2, %ymm0
    927 ; AVX512F-NEXT:    vptestmd %ymm0, %ymm0, %k0 {%k1}
    928 ; AVX512F-NEXT:    kmovw %k0, %eax
    929 ; AVX512F-NEXT:    # kill: def $al killed $al killed $eax
    930 ; AVX512F-NEXT:    vzeroupper
    931 ; AVX512F-NEXT:    retq
    932 ;
    933 ; AVX512BW-LABEL: v8i8:
    934 ; AVX512BW:       # %bb.0:
    935 ; AVX512BW-NEXT:    vpsllw $8, %xmm3, %xmm3
    936 ; AVX512BW-NEXT:    vpsraw $8, %xmm3, %xmm3
    937 ; AVX512BW-NEXT:    vpsllw $8, %xmm2, %xmm2
    938 ; AVX512BW-NEXT:    vpsraw $8, %xmm2, %xmm2
    939 ; AVX512BW-NEXT:    vpsllw $8, %xmm1, %xmm1
    940 ; AVX512BW-NEXT:    vpsraw $8, %xmm1, %xmm1
    941 ; AVX512BW-NEXT:    vpsllw $8, %xmm0, %xmm0
    942 ; AVX512BW-NEXT:    vpsraw $8, %xmm0, %xmm0
    943 ; AVX512BW-NEXT:    vpcmpgtw %xmm1, %xmm0, %k1
    944 ; AVX512BW-NEXT:    vpcmpgtw %xmm3, %xmm2, %k0 {%k1}
    945 ; AVX512BW-NEXT:    kmovd %k0, %eax
    946 ; AVX512BW-NEXT:    # kill: def $al killed $al killed $eax
    947 ; AVX512BW-NEXT:    retq
    948   %x0 = icmp sgt <8 x i8> %a, %b
    949   %x1 = icmp sgt <8 x i8> %c, %d
    950   %y = and <8 x i1> %x0, %x1
    951   %res = bitcast <8 x i1> %y to i8
    952   ret i8 %res
    953 }
    954