1/* { dg-do run } */
2/* { dg-options "-O2 -ftree-vectorize -ffast-math -mavx512bw -save-temps" } */
3/* { dg-require-effective-target avx512bw } */
4
5#include "avx512bw-check.h"
6
7#define N 400
8unsigned char yy[10000];
9unsigned char xx[10000];
10
11void
12__attribute__ ((noinline)) foo (unsigned short s)
13{
14   unsigned short i;
15   for (i = 0; i < s; i++)
16     yy[i] = xx [i*2 + 1];
17}
18
19void
20avx512bw_test ()
21{
22  unsigned short i;
23  unsigned char j = 0;
24  for (i = 0; i < 2 * N + 1; i++, j++)
25    xx [i] = j;
26
27  foo (N);
28
29  for (i = 0; i < N; i++)
30    if ( (unsigned char)(2*i+1) != yy [i] )
31      abort ();
32}
33
34/* { dg-final { scan-assembler-times "vpmovwb\[ \\t\]+\[^\n\]*%zmm" 2 } } */
35