1  /* { dg-options "-O2 -ftree-vectorize -msve-vector-bits=256" } */
       2  
       3  #include <stdint.h>
       4  
       5  #define TEST(NAME, TYPE)			\
       6   void						\
       7   NAME##1 (TYPE *x, int n)			\
       8   {						\
       9     for (int i = 0; i < n; ++i)			\
      10       x[i] += 1;					\
      11   }						\
      12   TYPE NAME##_array[1024];			\
      13   void						\
      14   NAME##2 (void)					\
      15   {						\
      16     for (int i = 1; i < 200; ++i)		\
      17       NAME##_array[i] += 1;			\
      18   }
      19  
      20  TEST (s8, int8_t)
      21  TEST (u8, uint8_t)
      22  TEST (s16, int16_t)
      23  TEST (u16, uint16_t)
      24  TEST (s32, int32_t)
      25  TEST (u32, uint32_t)
      26  TEST (s64, int64_t)
      27  TEST (u64, uint64_t)
      28  TEST (f16, _Float16)
      29  TEST (f32, float)
      30  TEST (f64, double)
      31  
      32  /* No scalar memory accesses.  */
      33  /* { dg-final { scan-assembler-not {[wx][0-9]*, \[} } } */
      34  /* 2 for each NAME##1 test, one in the header and one in the main loop
      35     and 1 for each NAME##2 test, in the main loop only.  */
      36  /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.b,} 6 } } */
      37  /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.h,} 9 } } */
      38  /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.s,} 9 } } */
      39  /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.d,} 9 } } */