1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math" } */
3 
4 #include "slp_6.c"
5 
6 #define N (77 * 3)
7 
8 #define HARNESS(TYPE)					\
9   {							\
10     TYPE a[N], b[3] = { 40, 22, 75 };			\
11     for (unsigned int i = 0; i < N; ++i)		\
12       {							\
13 	a[i] = i * 2 + i % 5;				\
14 	asm volatile ("" ::: "memory");			\
15       }							\
16     vec_slp_##TYPE (a, b, N / 3);			\
17     TYPE x0 = 40;					\
18     TYPE x1 = 22;					\
19     TYPE x2 = 75;					\
20     for (unsigned int i = 0; i < N; i += 3)		\
21       {							\
22 	x0 += a[i];					\
23 	x1 += a[i + 1];					\
24 	x2 += a[i + 2];					\
25 	asm volatile ("" ::: "memory");			\
26       }							\
27     /* _Float16 isn't precise enough for this.  */	\
28     if ((TYPE) 0x1000 + 1 != (TYPE) 0x1000		\
29 	&& (x0 != b[0] || x1 != b[1] || x2 != b[2]))	\
30       __builtin_abort ();				\
31   }
32 
33 int __attribute__ ((optimize (1)))
main(void)34 main (void)
35 {
36   TEST_ALL (HARNESS)
37 }
38