Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-cond-6.c

raw
1 /* { dg-require-effective-target vect_condition } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define K 32
7
8 int cond_array[2*K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9 int a[K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
10 int out[K];
11
12 __attribute__ ((noinline)) void
13 foo (int c)
14 {
15 int res, i, j, k, next;
16
17 for (k = 0; k < K; k++)
18 {
19 for (j = 0; j < K; j++)
20 {
21 res = 0;
22 for (i = 0; i < K; i++)
23 {
24 next = a[i][j];
25 res = c > cond_array[i+k][j] ? next : res;
26 }
27
28 out[j] = res;
29 }
30 }
31 }
32
33 int main ()
34 {
35 int i, j, k;
36
37 check_vect ();
38
39 for (j = 0; j < K; j++)
40 {
41 for (i = 0; i < 2*K; i++)
42 cond_array[i][j] = i+j;
43
44 for (i = 0; i < K; i++)
45 a[i][j] = i+2;
46 }
47
48 foo(125);
49
50 #pragma GCC novector
51 for (k = 0; k < K; k++)
52 if (out[k] != 33)
53 abort ();
54
55 return 0;
56 }
57
58 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
59