Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-iv-7.c

raw
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7 int result[N] = {8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38};
8
9 __attribute__ ((noinline, noclone)) int main1 (int X)
10 {
11 int arr[N];
12 int k = 3;
13 int m, i=0;
14
15 /* Vectorization of induction with non-constant step X. */
16
17 do {
18 m = k + 5;
19 arr[i] = m;
20 k = k + X;
21 i++;
22 } while (i < N);
23
24 /* check results: */
25 #pragma GCC novector
26 for (i = 0; i < N; i++)
27 {
28 if (arr[i] != result[i])
29 abort ();
30 }
31
32 return 0;
33 }
34
35 int main (void)
36 {
37 check_vect ();
38
39 return main1 (2);
40 }
41
42 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */