(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
sve/
spill_2.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -ftree-vectorize -msve-vector-bits=scalable" } */
       3  
       4  #include <stdint.h>
       5  
       6  void consumer (void *);
       7  
       8  #define TEST_LOOP(TYPE)				\
       9    void						\
      10    multi_loop_##TYPE (TYPE *x, TYPE val)		\
      11    {						\
      12      for (int i = 0; i < 9; ++i)			\
      13        x[i] += val;				\
      14      consumer (x);				\
      15      for (int i = 0; i < 9; ++i)			\
      16        x[i] += val;				\
      17      consumer (x);				\
      18      for (int i = 0; i < 9; ++i)			\
      19        x[i] += val;				\
      20      consumer (x);				\
      21    }
      22  
      23  /* One iteration is enough.  */
      24  TEST_LOOP (uint8_t);
      25  /* Two iterations are enough.  We specialize the second two loops based
      26     on whether the first executes once or twice.  */
      27  TEST_LOOP (uint16_t);
      28  /* Three iterations are needed; ought to stay a loop.  */
      29  TEST_LOOP (uint32_t);
      30  /* Five iterations are needed; ought to stay a loop.  */
      31  TEST_LOOP (uint64_t);
      32  
      33  /* { dg-final { scan-assembler-times {\twhilelo\tp[0-9]\.b} 3 } } */
      34  /* { dg-final { scan-assembler-times {\twhilelo\tp[0-9]\.h} 8 } } */
      35  /* { dg-final { scan-assembler-times {\twhilelo\tp[0-9]\.s} 6 } } */
      36  /* { dg-final { scan-assembler-times {\twhilelo\tp[0-9]\.d} 6 } } */
      37  /* { dg-final { scan-assembler-not {\tldr\tz[0-9]} } } */
      38  /* { dg-final { scan-assembler-not {\tstr\tz[0-9]} } } */
      39  /* { dg-final { scan-assembler-not {\tldr\tp[0-9]} } } */
      40  /* { dg-final { scan-assembler-not {\tstr\tp[0-9]} } } */