1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details --save-temps" } */
       3  
       4  #include <stdint.h>
       5  
       6  #define SIGNED(S) int##S##_t
       7  
       8  #define DIV(x,y) ((x)/(y))
       9  #define MOD(x,y) ((x)%(y))
      10  
      11  #define TEMPLATE(OP,SIZE)						\
      12  void __attribute__ ((noinline, noclone))				\
      13  f_##OP##_##SIZE (SIGNED(SIZE) *restrict a, SIGNED(SIZE) *restrict b,	\
      14  		 __INTPTR_TYPE__ n)					\
      15  {									\
      16    for (__INTPTR_TYPE__ i = 0; i < n; ++i)				\
      17      a[i] = OP (b[i], ((SIGNED(SIZE))1 << ((SIZE)/2+1)));		\
      18  }
      19  #define DIVMOD(SIZE)	\
      20  TEMPLATE (DIV,SIZE);	\
      21  TEMPLATE (MOD,SIZE);
      22  
      23  DIVMOD (8);
      24  DIVMOD (16);
      25  DIVMOD (32);
      26  DIVMOD (64);
      27  
      28  /* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 8 "vect" } } */
      29  
      30  /* { dg-final { scan-assembler-times {\tmovprfx\tz[0-9]+, z[0-9]+\n} 4 } } */
      31  
      32  /* { dg-final { scan-assembler-times {\tasrd\tz[0-9]+\.b, p[0-9]+/m, z[0-9]+\.b, #5\n} 2 } } */
      33  /* { dg-final { scan-assembler-times {\tlsl\tz[0-9]+\.b, z[0-9]+\.b, #5\n} 1 } } */
      34  /* { dg-final { scan-assembler-times {\tsub\tz[0-9]+\.b, z[0-9]+\.b, z[0-9]+\.b\n} 1 } } */
      35  
      36  /* { dg-final { scan-assembler-times {\tasrd\tz[0-9]+\.h, p[0-9]+/m, z[0-9]+\.h, #9\n} 2 } } */
      37  /* { dg-final { scan-assembler-times {\tlsl\tz[0-9]+\.h, z[0-9]+\.h, #9\n} 1 } } */
      38  /* { dg-final { scan-assembler-times {\tsub\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
      39  
      40  /* { dg-final { scan-assembler-times {\tasrd\tz[0-9]+\.s, p[0-9]+/m, z[0-9]+\.s, #17\n} 2 } } */
      41  /* { dg-final { scan-assembler-times {\tlsl\tz[0-9]+\.s, z[0-9]+\.s, #17\n} 1 } } */
      42  /* { dg-final { scan-assembler-times {\tsub\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
      43  
      44  /* { dg-final { scan-assembler-times {\tasrd\tz[0-9]+\.d, p[0-9]+/m, z[0-9]+\.d, #33\n} 2 } } */
      45  /* { dg-final { scan-assembler-times {\tlsl\tz[0-9]+\.d, z[0-9]+\.d, #33\n} 1 } } */
      46  /* { dg-final { scan-assembler-times {\tsub\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
      47  
      48  /* { dg-final { scan-assembler-not {\tasr\t} } } */
      49  /* { dg-final { scan-assembler-not {\tlsr\t} } } */
      50  /* { dg-final { scan-assembler-not {\tcmplt\t} } } */
      51  /* { dg-final { scan-assembler-not {\tand\t} } } */