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-apple-darwin -mattr=+avx512f | FileCheck %s --check-prefix=ALL --check-prefix=KNL
      3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f -mattr=+avx512vl -mattr=+avx512bw -mattr=+avx512dq | FileCheck %s --check-prefix=ALL --check-prefix=SKX
      4 
      5  attributes #0 = { nounwind }
      6 
      7 define <16 x i8> @trunc_16x32_to_16x8(<16 x i32> %i) #0 {
      8 ; ALL-LABEL: trunc_16x32_to_16x8:
      9 ; ALL:       ## BB#0:
     10 ; ALL-NEXT:    vpmovdb %zmm0, %xmm0
     11 ; ALL-NEXT:    retq
     12   %x = trunc <16 x i32> %i to <16 x i8>
     13   ret <16 x i8> %x
     14 }
     15 
     16 define <8 x i16> @trunc_8x64_to_8x16(<8 x i64> %i) #0 {
     17 ; ALL-LABEL: trunc_8x64_to_8x16:
     18 ; ALL:       ## BB#0:
     19 ; ALL-NEXT:    vpmovqw %zmm0, %xmm0
     20 ; ALL-NEXT:    retq
     21   %x = trunc <8 x i64> %i to <8 x i16>
     22   ret <8 x i16> %x
     23 }
     24 
     25 define <16 x i16> @trunc_v16i32_to_v16i16(<16 x i32> %x) #0 {
     26 ; ALL-LABEL: trunc_v16i32_to_v16i16:
     27 ; ALL:       ## BB#0:
     28 ; ALL-NEXT:    vpmovdw %zmm0, %ymm0
     29 ; ALL-NEXT:    retq
     30   %1 = trunc <16 x i32> %x to <16 x i16>
     31   ret <16 x i16> %1
     32 }
     33 
     34 define <8 x i8> @trunc_qb_512(<8 x i64> %i) #0 {
     35 ; ALL-LABEL: trunc_qb_512:
     36 ; ALL:       ## BB#0:
     37 ; ALL-NEXT:    vpmovqw %zmm0, %xmm0
     38 ; ALL-NEXT:    retq
     39   %x = trunc <8 x i64> %i to <8 x i8>
     40   ret <8 x i8> %x
     41 }
     42 
     43 define void @trunc_qb_512_mem(<8 x i64> %i, <8 x i8>* %res) #0 {
     44 ; ALL-LABEL: trunc_qb_512_mem:
     45 ; ALL:       ## BB#0:
     46 ; ALL-NEXT:    vpmovqb %zmm0, (%rdi)
     47 ; ALL-NEXT:    retq
     48     %x = trunc <8 x i64> %i to <8 x i8>
     49     store <8 x i8> %x, <8 x i8>* %res
     50     ret void
     51 }
     52 
     53 define <4 x i8> @trunc_qb_256(<4 x i64> %i) #0 {
     54 ; KNL-LABEL: trunc_qb_256:
     55 ; KNL:       ## BB#0:
     56 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
     57 ; KNL-NEXT:    vpmovqd %zmm0, %ymm0
     58 ; KNL-NEXT:    ## kill: %XMM0<def> %XMM0<kill> %YMM0<kill>
     59 ; KNL-NEXT:    retq
     60 ;
     61 ; SKX-LABEL: trunc_qb_256:
     62 ; SKX:       ## BB#0:
     63 ; SKX-NEXT:    vpmovqd %ymm0, %xmm0
     64 ; SKX-NEXT:    retq
     65   %x = trunc <4 x i64> %i to <4 x i8>
     66   ret <4 x i8> %x
     67 }
     68 
     69 define void @trunc_qb_256_mem(<4 x i64> %i, <4 x i8>* %res) #0 {
     70 ; KNL-LABEL: trunc_qb_256_mem:
     71 ; KNL:       ## BB#0:
     72 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
     73 ; KNL-NEXT:    vpmovqd %zmm0, %ymm0
     74 ; KNL-NEXT:    vpshufb {{.*#+}} xmm0 = xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]
     75 ; KNL-NEXT:    vmovd %xmm0, (%rdi)
     76 ; KNL-NEXT:    retq
     77 ;
     78 ; SKX-LABEL: trunc_qb_256_mem:
     79 ; SKX:       ## BB#0:
     80 ; SKX-NEXT:    vpmovqb %ymm0, (%rdi)
     81 ; SKX-NEXT:    retq
     82     %x = trunc <4 x i64> %i to <4 x i8>
     83     store <4 x i8> %x, <4 x i8>* %res
     84     ret void
     85 }
     86 
     87 define <2 x i8> @trunc_qb_128(<2 x i64> %i) #0 {
     88 ; ALL-LABEL: trunc_qb_128:
     89 ; ALL:       ## BB#0:
     90 ; ALL-NEXT:    retq
     91   %x = trunc <2 x i64> %i to <2 x i8>
     92   ret <2 x i8> %x
     93 }
     94 
     95 define void @trunc_qb_128_mem(<2 x i64> %i, <2 x i8>* %res) #0 {
     96 ; KNL-LABEL: trunc_qb_128_mem:
     97 ; KNL:       ## BB#0:
     98 ; KNL-NEXT:    vpshufb {{.*#+}} xmm0 = xmm0[0,8,u,u,u,u,u,u,u,u,u,u,u,u,u,u]
     99 ; KNL-NEXT:    vmovd %xmm0, %eax
    100 ; KNL-NEXT:    movw %ax, (%rdi)
    101 ; KNL-NEXT:    retq
    102 ;
    103 ; SKX-LABEL: trunc_qb_128_mem:
    104 ; SKX:       ## BB#0:
    105 ; SKX-NEXT:    vpmovqb %xmm0, (%rdi)
    106 ; SKX-NEXT:    retq
    107     %x = trunc <2 x i64> %i to <2 x i8>
    108     store <2 x i8> %x, <2 x i8>* %res
    109     ret void
    110 }
    111 
    112 define <8 x i16> @trunc_qw_512(<8 x i64> %i) #0 {
    113 ; ALL-LABEL: trunc_qw_512:
    114 ; ALL:       ## BB#0:
    115 ; ALL-NEXT:    vpmovqw %zmm0, %xmm0
    116 ; ALL-NEXT:    retq
    117   %x = trunc <8 x i64> %i to <8 x i16>
    118   ret <8 x i16> %x
    119 }
    120 
    121 define void @trunc_qw_512_mem(<8 x i64> %i, <8 x i16>* %res) #0 {
    122 ; ALL-LABEL: trunc_qw_512_mem:
    123 ; ALL:       ## BB#0:
    124 ; ALL-NEXT:    vpmovqw %zmm0, (%rdi)
    125 ; ALL-NEXT:    retq
    126     %x = trunc <8 x i64> %i to <8 x i16>
    127     store <8 x i16> %x, <8 x i16>* %res
    128     ret void
    129 }
    130 
    131 define <4 x i16> @trunc_qw_256(<4 x i64> %i) #0 {
    132 ; KNL-LABEL: trunc_qw_256:
    133 ; KNL:       ## BB#0:
    134 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
    135 ; KNL-NEXT:    vpmovqd %zmm0, %ymm0
    136 ; KNL-NEXT:    ## kill: %XMM0<def> %XMM0<kill> %YMM0<kill>
    137 ; KNL-NEXT:    retq
    138 ;
    139 ; SKX-LABEL: trunc_qw_256:
    140 ; SKX:       ## BB#0:
    141 ; SKX-NEXT:    vpmovqd %ymm0, %xmm0
    142 ; SKX-NEXT:    retq
    143   %x = trunc <4 x i64> %i to <4 x i16>
    144   ret <4 x i16> %x
    145 }
    146 
    147 define void @trunc_qw_256_mem(<4 x i64> %i, <4 x i16>* %res) #0 {
    148 ; KNL-LABEL: trunc_qw_256_mem:
    149 ; KNL:       ## BB#0:
    150 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
    151 ; KNL-NEXT:    vpmovqd %zmm0, %ymm0
    152 ; KNL-NEXT:    vpshufb {{.*#+}} xmm0 = xmm0[0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
    153 ; KNL-NEXT:    vmovq %xmm0, (%rdi)
    154 ; KNL-NEXT:    retq
    155 ;
    156 ; SKX-LABEL: trunc_qw_256_mem:
    157 ; SKX:       ## BB#0:
    158 ; SKX-NEXT:    vpmovqw %ymm0, (%rdi)
    159 ; SKX-NEXT:    retq
    160     %x = trunc <4 x i64> %i to <4 x i16>
    161     store <4 x i16> %x, <4 x i16>* %res
    162     ret void
    163 }
    164 
    165 define <2 x i16> @trunc_qw_128(<2 x i64> %i) #0 {
    166 ; ALL-LABEL: trunc_qw_128:
    167 ; ALL:       ## BB#0:
    168 ; ALL-NEXT:    retq
    169   %x = trunc <2 x i64> %i to <2 x i16>
    170   ret <2 x i16> %x
    171 }
    172 
    173 define void @trunc_qw_128_mem(<2 x i64> %i, <2 x i16>* %res) #0 {
    174 ; KNL-LABEL: trunc_qw_128_mem:
    175 ; KNL:       ## BB#0:
    176 ; KNL-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
    177 ; KNL-NEXT:    vpshuflw {{.*#+}} xmm0 = xmm0[0,2,2,3,4,5,6,7]
    178 ; KNL-NEXT:    vmovd %xmm0, (%rdi)
    179 ; KNL-NEXT:    retq
    180 ;
    181 ; SKX-LABEL: trunc_qw_128_mem:
    182 ; SKX:       ## BB#0:
    183 ; SKX-NEXT:    vpmovqw %xmm0, (%rdi)
    184 ; SKX-NEXT:    retq
    185     %x = trunc <2 x i64> %i to <2 x i16>
    186     store <2 x i16> %x, <2 x i16>* %res
    187     ret void
    188 }
    189 
    190 define <8 x i32> @trunc_qd_512(<8 x i64> %i) #0 {
    191 ; ALL-LABEL: trunc_qd_512:
    192 ; ALL:       ## BB#0:
    193 ; ALL-NEXT:    vpmovqd %zmm0, %ymm0
    194 ; ALL-NEXT:    retq
    195   %x = trunc <8 x i64> %i to <8 x i32>
    196   ret <8 x i32> %x
    197 }
    198 
    199 define void @trunc_qd_512_mem(<8 x i64> %i, <8 x i32>* %res) #0 {
    200 ; ALL-LABEL: trunc_qd_512_mem:
    201 ; ALL:       ## BB#0:
    202 ; ALL-NEXT:    vpmovqd %zmm0, (%rdi)
    203 ; ALL-NEXT:    retq
    204     %x = trunc <8 x i64> %i to <8 x i32>
    205     store <8 x i32> %x, <8 x i32>* %res
    206     ret void
    207 }
    208 
    209 define <4 x i32> @trunc_qd_256(<4 x i64> %i) #0 {
    210 ; KNL-LABEL: trunc_qd_256:
    211 ; KNL:       ## BB#0:
    212 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
    213 ; KNL-NEXT:    vpmovqd %zmm0, %ymm0
    214 ; KNL-NEXT:    ## kill: %XMM0<def> %XMM0<kill> %YMM0<kill>
    215 ; KNL-NEXT:    retq
    216 ;
    217 ; SKX-LABEL: trunc_qd_256:
    218 ; SKX:       ## BB#0:
    219 ; SKX-NEXT:    vpmovqd %ymm0, %xmm0
    220 ; SKX-NEXT:    retq
    221   %x = trunc <4 x i64> %i to <4 x i32>
    222   ret <4 x i32> %x
    223 }
    224 
    225 define void @trunc_qd_256_mem(<4 x i64> %i, <4 x i32>* %res) #0 {
    226 ; KNL-LABEL: trunc_qd_256_mem:
    227 ; KNL:       ## BB#0:
    228 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
    229 ; KNL-NEXT:    vpmovqd %zmm0, %ymm0
    230 ; KNL-NEXT:    vmovaps %xmm0, (%rdi)
    231 ; KNL-NEXT:    retq
    232 ;
    233 ; SKX-LABEL: trunc_qd_256_mem:
    234 ; SKX:       ## BB#0:
    235 ; SKX-NEXT:    vpmovqd %ymm0, (%rdi)
    236 ; SKX-NEXT:    retq
    237     %x = trunc <4 x i64> %i to <4 x i32>
    238     store <4 x i32> %x, <4 x i32>* %res
    239     ret void
    240 }
    241 
    242 define <2 x i32> @trunc_qd_128(<2 x i64> %i) #0 {
    243 ; ALL-LABEL: trunc_qd_128:
    244 ; ALL:       ## BB#0:
    245 ; ALL-NEXT:    retq
    246   %x = trunc <2 x i64> %i to <2 x i32>
    247   ret <2 x i32> %x
    248 }
    249 
    250 define void @trunc_qd_128_mem(<2 x i64> %i, <2 x i32>* %res) #0 {
    251 ; KNL-LABEL: trunc_qd_128_mem:
    252 ; KNL:       ## BB#0:
    253 ; KNL-NEXT:    vpshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
    254 ; KNL-NEXT:    vmovq %xmm0, (%rdi)
    255 ; KNL-NEXT:    retq
    256 ;
    257 ; SKX-LABEL: trunc_qd_128_mem:
    258 ; SKX:       ## BB#0:
    259 ; SKX-NEXT:    vpmovqd %xmm0, (%rdi)
    260 ; SKX-NEXT:    retq
    261     %x = trunc <2 x i64> %i to <2 x i32>
    262     store <2 x i32> %x, <2 x i32>* %res
    263     ret void
    264 }
    265 
    266 define <16 x i8> @trunc_db_512(<16 x i32> %i) #0 {
    267 ; ALL-LABEL: trunc_db_512:
    268 ; ALL:       ## BB#0:
    269 ; ALL-NEXT:    vpmovdb %zmm0, %xmm0
    270 ; ALL-NEXT:    retq
    271   %x = trunc <16 x i32> %i to <16 x i8>
    272   ret <16 x i8> %x
    273 }
    274 
    275 define void @trunc_db_512_mem(<16 x i32> %i, <16 x i8>* %res) #0 {
    276 ; ALL-LABEL: trunc_db_512_mem:
    277 ; ALL:       ## BB#0:
    278 ; ALL-NEXT:    vpmovdb %zmm0, (%rdi)
    279 ; ALL-NEXT:    retq
    280     %x = trunc <16 x i32> %i to <16 x i8>
    281     store <16 x i8> %x, <16 x i8>* %res
    282     ret void
    283 }
    284 
    285 define <8 x i8> @trunc_db_256(<8 x i32> %i) #0 {
    286 ; KNL-LABEL: trunc_db_256:
    287 ; KNL:       ## BB#0:
    288 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
    289 ; KNL-NEXT:    vpmovdw %zmm0, %ymm0
    290 ; KNL-NEXT:    ## kill: %XMM0<def> %XMM0<kill> %YMM0<kill>
    291 ; KNL-NEXT:    retq
    292 ;
    293 ; SKX-LABEL: trunc_db_256:
    294 ; SKX:       ## BB#0:
    295 ; SKX-NEXT:    vpmovdw %ymm0, %xmm0
    296 ; SKX-NEXT:    retq
    297   %x = trunc <8 x i32> %i to <8 x i8>
    298   ret <8 x i8> %x
    299 }
    300 
    301 define void @trunc_db_256_mem(<8 x i32> %i, <8 x i8>* %res) #0 {
    302 ; KNL-LABEL: trunc_db_256_mem:
    303 ; KNL:       ## BB#0:
    304 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
    305 ; KNL-NEXT:    vpmovdw %zmm0, %ymm0
    306 ; KNL-NEXT:    vpshufb {{.*#+}} xmm0 = xmm0[0,2,4,6,8,10,12,14,u,u,u,u,u,u,u,u]
    307 ; KNL-NEXT:    vmovq %xmm0, (%rdi)
    308 ; KNL-NEXT:    retq
    309 ;
    310 ; SKX-LABEL: trunc_db_256_mem:
    311 ; SKX:       ## BB#0:
    312 ; SKX-NEXT:    vpmovdb %ymm0, (%rdi)
    313 ; SKX-NEXT:    retq
    314     %x = trunc <8 x i32> %i to <8 x i8>
    315     store <8 x i8> %x, <8 x i8>* %res
    316     ret void
    317 }
    318 
    319 define <4 x i8> @trunc_db_128(<4 x i32> %i) #0 {
    320 ; ALL-LABEL: trunc_db_128:
    321 ; ALL:       ## BB#0:
    322 ; ALL-NEXT:    retq
    323   %x = trunc <4 x i32> %i to <4 x i8>
    324   ret <4 x i8> %x
    325 }
    326 
    327 define void @trunc_db_128_mem(<4 x i32> %i, <4 x i8>* %res) #0 {
    328 ; KNL-LABEL: trunc_db_128_mem:
    329 ; KNL:       ## BB#0:
    330 ; KNL-NEXT:    vpshufb {{.*#+}} xmm0 = xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]
    331 ; KNL-NEXT:    vmovd %xmm0, (%rdi)
    332 ; KNL-NEXT:    retq
    333 ;
    334 ; SKX-LABEL: trunc_db_128_mem:
    335 ; SKX:       ## BB#0:
    336 ; SKX-NEXT:    vpmovdb %xmm0, (%rdi)
    337 ; SKX-NEXT:    retq
    338     %x = trunc <4 x i32> %i to <4 x i8>
    339     store <4 x i8> %x, <4 x i8>* %res
    340     ret void
    341 }
    342 
    343 define <16 x i16> @trunc_dw_512(<16 x i32> %i) #0 {
    344 ; ALL-LABEL: trunc_dw_512:
    345 ; ALL:       ## BB#0:
    346 ; ALL-NEXT:    vpmovdw %zmm0, %ymm0
    347 ; ALL-NEXT:    retq
    348   %x = trunc <16 x i32> %i to <16 x i16>
    349   ret <16 x i16> %x
    350 }
    351 
    352 define void @trunc_dw_512_mem(<16 x i32> %i, <16 x i16>* %res) #0 {
    353 ; ALL-LABEL: trunc_dw_512_mem:
    354 ; ALL:       ## BB#0:
    355 ; ALL-NEXT:    vpmovdw %zmm0, (%rdi)
    356 ; ALL-NEXT:    retq
    357     %x = trunc <16 x i32> %i to <16 x i16>
    358     store <16 x i16> %x, <16 x i16>* %res
    359     ret void
    360 }
    361 
    362 define <8 x i16> @trunc_dw_256(<8 x i32> %i) #0 {
    363 ; KNL-LABEL: trunc_dw_256:
    364 ; KNL:       ## BB#0:
    365 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
    366 ; KNL-NEXT:    vpmovdw %zmm0, %ymm0
    367 ; KNL-NEXT:    ## kill: %XMM0<def> %XMM0<kill> %YMM0<kill>
    368 ; KNL-NEXT:    retq
    369 ;
    370 ; SKX-LABEL: trunc_dw_256:
    371 ; SKX:       ## BB#0:
    372 ; SKX-NEXT:    vpmovdw %ymm0, %xmm0
    373 ; SKX-NEXT:    retq
    374   %x = trunc <8 x i32> %i to <8 x i16>
    375   ret <8 x i16> %x
    376 }
    377 
    378 define void @trunc_dw_256_mem(<8 x i32> %i, <8 x i16>* %res) #0 {
    379 ; KNL-LABEL: trunc_dw_256_mem:
    380 ; KNL:       ## BB#0:
    381 ; KNL-NEXT:    ## kill: %YMM0<def> %YMM0<kill> %ZMM0<def>
    382 ; KNL-NEXT:    vpmovdw %zmm0, %ymm0
    383 ; KNL-NEXT:    vmovaps %xmm0, (%rdi)
    384 ; KNL-NEXT:    retq
    385 ;
    386 ; SKX-LABEL: trunc_dw_256_mem:
    387 ; SKX:       ## BB#0:
    388 ; SKX-NEXT:    vpmovdw %ymm0, (%rdi)
    389 ; SKX-NEXT:    retq
    390     %x = trunc <8 x i32> %i to <8 x i16>
    391     store <8 x i16> %x, <8 x i16>* %res
    392     ret void
    393 }
    394 
    395 define void @trunc_dw_128_mem(<4 x i32> %i, <4 x i16>* %res) #0 {
    396 ; KNL-LABEL: trunc_dw_128_mem:
    397 ; KNL:       ## BB#0:
    398 ; KNL-NEXT:    vpshufb {{.*#+}} xmm0 = xmm0[0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
    399 ; KNL-NEXT:    vmovq %xmm0, (%rdi)
    400 ; KNL-NEXT:    retq
    401 ;
    402 ; SKX-LABEL: trunc_dw_128_mem:
    403 ; SKX:       ## BB#0:
    404 ; SKX-NEXT:    vpmovdw %xmm0, (%rdi)
    405 ; SKX-NEXT:    retq
    406     %x = trunc <4 x i32> %i to <4 x i16>
    407     store <4 x i16> %x, <4 x i16>* %res
    408     ret void
    409 }
    410 
    411 define <32 x i8> @trunc_wb_512(<32 x i16> %i) #0 {
    412 ; KNL-LABEL: trunc_wb_512:
    413 ; KNL:       ## BB#0:
    414 ; KNL-NEXT:    vpmovsxwd %ymm0, %zmm0
    415 ; KNL-NEXT:    vpmovdb %zmm0, %xmm0
    416 ; KNL-NEXT:    vpmovsxwd %ymm1, %zmm1
    417 ; KNL-NEXT:    vpmovdb %zmm1, %xmm1
    418 ; KNL-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
    419 ; KNL-NEXT:    retq
    420 ;
    421 ; SKX-LABEL: trunc_wb_512:
    422 ; SKX:       ## BB#0:
    423 ; SKX-NEXT:    vpmovwb %zmm0, %ymm0
    424 ; SKX-NEXT:    retq
    425   %x = trunc <32 x i16> %i to <32 x i8>
    426   ret <32 x i8> %x
    427 }
    428 
    429 define void @trunc_wb_512_mem(<32 x i16> %i, <32 x i8>* %res) #0 {
    430 ; KNL-LABEL: trunc_wb_512_mem:
    431 ; KNL:       ## BB#0:
    432 ; KNL-NEXT:    vpmovsxwd %ymm0, %zmm0
    433 ; KNL-NEXT:    vpmovdb %zmm0, %xmm0
    434 ; KNL-NEXT:    vpmovsxwd %ymm1, %zmm1
    435 ; KNL-NEXT:    vpmovdb %zmm1, %xmm1
    436 ; KNL-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
    437 ; KNL-NEXT:    vmovaps %ymm0, (%rdi)
    438 ; KNL-NEXT:    retq
    439 ;
    440 ; SKX-LABEL: trunc_wb_512_mem:
    441 ; SKX:       ## BB#0:
    442 ; SKX-NEXT:    vpmovwb %zmm0, (%rdi)
    443 ; SKX-NEXT:    retq
    444     %x = trunc <32 x i16> %i to <32 x i8>
    445     store <32 x i8> %x, <32 x i8>* %res
    446     ret void
    447 }
    448 
    449 define <16 x i8> @trunc_wb_256(<16 x i16> %i) #0 {
    450 ; KNL-LABEL: trunc_wb_256:
    451 ; KNL:       ## BB#0:
    452 ; KNL-NEXT:    vpmovsxwd %ymm0, %zmm0
    453 ; KNL-NEXT:    vpmovdb %zmm0, %xmm0
    454 ; KNL-NEXT:    retq
    455 ;
    456 ; SKX-LABEL: trunc_wb_256:
    457 ; SKX:       ## BB#0:
    458 ; SKX-NEXT:    vpmovwb %ymm0, %xmm0
    459 ; SKX-NEXT:    retq
    460   %x = trunc <16 x i16> %i to <16 x i8>
    461   ret <16 x i8> %x
    462 }
    463 
    464 define void @trunc_wb_256_mem(<16 x i16> %i, <16 x i8>* %res) #0 {
    465 ; KNL-LABEL: trunc_wb_256_mem:
    466 ; KNL:       ## BB#0:
    467 ; KNL-NEXT:    vpmovsxwd %ymm0, %zmm0
    468 ; KNL-NEXT:    vpmovdb %zmm0, %xmm0
    469 ; KNL-NEXT:    vmovaps %xmm0, (%rdi)
    470 ; KNL-NEXT:    retq
    471 ;
    472 ; SKX-LABEL: trunc_wb_256_mem:
    473 ; SKX:       ## BB#0:
    474 ; SKX-NEXT:    vpmovwb %ymm0, (%rdi)
    475 ; SKX-NEXT:    retq
    476     %x = trunc <16 x i16> %i to <16 x i8>
    477     store <16 x i8> %x, <16 x i8>* %res
    478     ret void
    479 }
    480 
    481 define <8 x i8> @trunc_wb_128(<8 x i16> %i) #0 {
    482 ; ALL-LABEL: trunc_wb_128:
    483 ; ALL:       ## BB#0:
    484 ; ALL-NEXT:    retq
    485   %x = trunc <8 x i16> %i to <8 x i8>
    486   ret <8 x i8> %x
    487 }
    488 
    489 define void @trunc_wb_128_mem(<8 x i16> %i, <8 x i8>* %res) #0 {
    490 ; KNL-LABEL: trunc_wb_128_mem:
    491 ; KNL:       ## BB#0:
    492 ; KNL-NEXT:    vpshufb {{.*#+}} xmm0 = xmm0[0,2,4,6,8,10,12,14,u,u,u,u,u,u,u,u]
    493 ; KNL-NEXT:    vmovq %xmm0, (%rdi)
    494 ; KNL-NEXT:    retq
    495 ;
    496 ; SKX-LABEL: trunc_wb_128_mem:
    497 ; SKX:       ## BB#0:
    498 ; SKX-NEXT:    vpmovwb %xmm0, (%rdi)
    499 ; SKX-NEXT:    retq
    500     %x = trunc <8 x i16> %i to <8 x i8>
    501     store <8 x i8> %x, <8 x i8>* %res
    502     ret void
    503 }
    504