Debian Codegraph @

gcc/testsuite/gcc.dg/vect/no-vfa-pr29145.c

raw
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "--param vect-max-version-for-alias-checks=0 -fno-ipa-icf" } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 __attribute__ ((noinline))
8 void with_restrict(int * __restrict p)
9 {
10 int i;
11 int *q = p - 1;
12
13 for (i = 0; i < 1000; ++i) {
14 p[i] = q[i];
15 }
16 }
17
18 __attribute__ ((noinline))
19 void without_restrict(int * p)
20 {
21 int i;
22 int *q = p - 1;
23
24 for (i = 0; i < 1000; ++i) {
25 p[i] = q[i];
26 }
27 }
28
29 int main(void)
30 {
31 int i;
32 int a[1002];
33 int b[1002];
34
35 check_vect ();
36
37 for (i = 0; i < 1002; ++i) {
38 a[i] = b[i] = i;
39 }
40
41 with_restrict(a + 1);
42 without_restrict(b + 1);
43
44 #pragma GCC novector
45 for (i = 0; i < 1002; ++i) {
46 if (a[i] != b[i])
47 abort();
48 }
49 return 0;
50 }
51
52 /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" } } */
53 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */