1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O2 -ftree-vectorize" } */
3 
4 #include "slp_11.c"
5 
6 #define N1 (103 * 2)
7 #define N2 (111 * 2)
8 
9 #define HARNESS(TYPE1, TYPE2)					\
10   {								\
11     TYPE1 a[N2];						\
12     TYPE2 b[N2 * 2];						\
13     for (unsigned int i = 0; i < N2; ++i)			\
14       {								\
15 	a[i] = i * 2 + i % 5;					\
16 	b[i * 2] = i * 3 + i % 7;				\
17 	b[i * 2 + 1] = i * 5 + i % 9;				\
18       }								\
19     vec_slp_##TYPE1##_##TYPE2 (a, b, N1 / 2);			\
20     for (unsigned int i = 0; i < N2; ++i)			\
21       {								\
22 	TYPE1 orig_a = i * 2 + i % 5;				\
23 	TYPE2 orig_b1 = i * 3 + i % 7;				\
24 	TYPE2 orig_b2 = i * 5 + i % 9;				\
25 	TYPE1 expected_a = orig_a;				\
26 	TYPE2 expected_b1 = orig_b1;				\
27 	TYPE2 expected_b2 = orig_b2;				\
28 	if (i < N1)						\
29 	  {							\
30 	    expected_a += i & 1 ? 2 : 1;			\
31 	    expected_b1 += i & 1 ? 5 : 3;			\
32 	    expected_b2 += i & 1 ? 6 : 4;			\
33 	  }							\
34 	if (a[i] != expected_a					\
35 	    || b[i * 2] != expected_b1				\
36 	    || b[i * 2 + 1] != expected_b2)			\
37 	  __builtin_abort ();					\
38       }								\
39   }
40 
41 int __attribute__ ((optimize (1)))
main(void)42 main (void)
43 {
44   TEST_ALL (HARNESS)
45 }
46