Debian Codegraph @

gcc/testsuite/gcc.dg/vect/bb-slp-42.c

raw
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_perm } */
3
4 #include "tree-vect.h"
5
6 #define ARR_SIZE 1024
7
8 void __attribute__((noipa))
9 foo (int a[][ARR_SIZE], int *b)
10 {
11 int i;
12 for (i = 0; i < ARR_SIZE; ++i)
13 {
14 a[0][i] += b[0];
15 a[1][i] += b[1];
16 a[2][i] += b[2];
17 a[3][i] += b[3];
18 }
19 }
20
21 int
22 main ()
23 {
24 int a[4][ARR_SIZE];
25 int b[4];
26
27 check_vect ();
28
29 for (int i = 0; i < 4; ++i)
30 {
31 b[i] = 20 * i;
32 for (int j = 0; j < ARR_SIZE; ++j)
33 a[i][j] = (i + 1) * ARR_SIZE - j;
34 }
35
36 foo (a, b);
37
38 for (int i = 0; i < 4; ++i)
39 #pragma GCC novector
40 for (int j = 0; j < ARR_SIZE; ++j)
41 if (a[i][j] != (i + 1) * ARR_SIZE - j + 20 * i)
42 __builtin_abort ();
43
44 return 0;
45
46 }
47
48 /* See that we do not try to vectorize the uniform CTORs. */
49 /* { dg-final { scan-tree-dump-not "Analyzing vectorizable constructor" "slp1" } } */