Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-simd-16.c

raw
1 /* { dg-additional-options "-fopenmp-simd" } */
2 /* { dg-additional-options "-mavx" { target avx_runtime } } */
3 /* { dg-final { scan-tree-dump-times "vectorized \[1-3] loops" 3 "vect" { target i?86-*-* x86_64-*-* } } } */
4
5 #include "tree-vect.h"
6
7 __attribute__((noipa)) int
8 foo (int *a)
9 {
10 int i;
11 #pragma omp simd lastprivate (i)
12 for (i = 0; i < 64; i++)
13 a[i] = i;
14 return i;
15 }
16
17 __attribute__((noipa)) void
18 bar (int *a)
19 {
20 int i;
21 #pragma omp simd private (i)
22 for (i = 0; i < 64; i++)
23 a[i] = i + 1;
24 }
25
26 __attribute__((noipa)) int
27 baz (int *a)
28 {
29 int i;
30 #pragma omp simd linear (i)
31 for (i = 0; i < 64; i++)
32 a[i] = i + 2;
33 return i;
34 }
35
36 int
37 main ()
38 {
39 int i;
40 int a[64];
41 check_vect ();
42 if (foo (a) != 64)
43 abort ();
44 #pragma GCC novector
45 for (i = 0; i < 64; ++i)
46 if (a[i] != i)
47 abort ();
48 else
49 a[i] = -8;
50 bar (a);
51 #pragma GCC novector
52 for (i = 0; i < 64; ++i)
53 if (a[i] != i + 1)
54 abort ();
55 else
56 a[i] = -8;
57 if (baz (a) != 64)
58 abort ();
59 #pragma GCC novector
60 for (i = 0; i < 64; ++i)
61 if (a[i] != i + 2)
62 abort ();
63 return 0;
64 }