1 #include "tree-vect.h"
2
3 #define N (VECTOR_BITS / 32)
4 #define MAX_COUNT 4
5
6 void __attribute__ ((noipa))
7 run (int *restrict a, int *restrict b, int count)
8 {
9 for (int i = 0; i < count * N; ++i)
10 {
11 a[i * 2] = b[i * 2] + count;
12 a[i * 2 + 1] = count;
13 }
14 }
15
16 void __attribute__ ((noipa))
17 check (int *restrict a, int count)
18 {
19 for (int i = 0; i < count * N; ++i)
20 if (a[i * 2] != i * 41 + count || a[i * 2 + 1] != count)
21 __builtin_abort ();
22 if (a[count * 2 * N] != 999)
23 __builtin_abort ();
24 }
25
26 int a[N * MAX_COUNT * 2 + 1], b[N * MAX_COUNT * 2];
27
28 int
29 main (void)
30 {
31 check_vect ();
32
33 for (int i = 0; i < N * MAX_COUNT; ++i)
34 {
35 b[i * 2] = i * 41;
36 asm volatile ("" ::: "memory");
37 }
38
39 for (int i = 0; i <= MAX_COUNT; ++i)
40 {
41 a[i * 2 * N] = 999;
42 run (a, b, i);
43 check (a, i);
44 }
45
46 return 0;
47 }
48
49 /* { dg-final { scan-tree-dump-times {LOOP VECTORIZED} 1 "vect" { target { { vect_int && vect_perm } && vect_element_align } } } } */