1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math" } */
3 
4 #include <stdint.h>
5 
6 void consumer (void *);
7 
8 #define TEST_LOOP(TYPE, VAL)			\
9   void						\
10   multi_loop_##TYPE (TYPE *x)			\
11   {						\
12     for (int i = 0; i < 100; ++i)		\
13       x[i] += VAL + i;				\
14     consumer (x);				\
15     for (int i = 0; i < 100; ++i)		\
16       x[i] += VAL + i;				\
17     consumer (x);				\
18     for (int i = 0; i < 100; ++i)		\
19       x[i] += VAL + i;				\
20     consumer (x);				\
21   }
22 
23 TEST_LOOP (uint8_t, 3);
24 TEST_LOOP (uint16_t, 4);
25 TEST_LOOP (uint32_t, 5);
26 TEST_LOOP (uint64_t, 6);
27 TEST_LOOP (float, 2.5f);
28 TEST_LOOP (double, 3.5);
29 
30 /* { dg-final { scan-assembler-times {\tindex\tz[0-9]+\..,} 18 } } */
31 /* { dg-final { scan-assembler-not {\tldr\tz[0-9]} } } */
32 /* { dg-final { scan-assembler-not {\tstr\tz[0-9]} } } */
33 /* { dg-final { scan-assembler-not {\tldr\tp[0-9]} } } */
34 /* { dg-final { scan-assembler-not {\tstr\tp[0-9]} } } */
35