Handle peeling for alignment with masking
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / slp_8_run.c
blob3ef1e93c864df18a016314c7db6809aa2c9687d2
1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O2 -ftree-vectorize" } */
4 #include "slp_8.c"
6 #define N1 (103 * 2)
7 #define N2 (111 * 2)
9 #define HARNESS(TYPE) \
10 { \
11 TYPE a[N2], b[N2 * 2]; \
12 for (unsigned int i = 0; i < N2; ++i) \
13 { \
14 a[i] = i * 2 + i % 5; \
15 b[i * 2] = i * 3 + i % 7; \
16 b[i * 2 + 1] = i * 5 + i % 9; \
17 } \
18 vec_slp_##TYPE (a, b, N1 / 2); \
19 for (unsigned int i = 0; i < N2; ++i) \
20 { \
21 TYPE orig_a = i * 2 + i % 5; \
22 TYPE orig_b1 = i * 3 + i % 7; \
23 TYPE orig_b2 = i * 5 + i % 9; \
24 TYPE expected_a = orig_a; \
25 TYPE expected_b1 = orig_b1; \
26 TYPE expected_b2 = orig_b2; \
27 if (i < N1) \
28 { \
29 expected_a += i & 1 ? 2 : 1; \
30 expected_b1 += i & 1 ? 5 : 3; \
31 expected_b2 += i & 1 ? 6 : 4; \
32 } \
33 if (a[i] != expected_a \
34 || b[i * 2] != expected_b1 \
35 || b[i * 2 + 1] != expected_b2) \
36 __builtin_abort (); \
37 } \
40 int __attribute__ ((optimize (1)))
41 main (void)
43 TEST_ALL (HARNESS)