111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-require-effective-target fopenmp } */
|
|
3 /* { dg-require-effective-target vect_int } */
|
|
4 /* { dg-additional-options "-fopenmp -fipa-pta" } */
|
|
5
|
|
6 extern void abort (void);
|
|
7
|
|
8 #define nEvents 1000
|
|
9
|
|
10 static void __attribute__((noinline, noclone, optimize("-fno-tree-vectorize")))
|
|
11 init (unsigned *results, unsigned *pData)
|
|
12 {
|
|
13 unsigned int i;
|
|
14 for (i = 0; i < nEvents; ++i)
|
|
15 pData[i] = i % 3;
|
|
16 }
|
|
17
|
|
18 static void __attribute__((noinline, noclone, optimize("-fno-tree-vectorize")))
|
|
19 check (unsigned *results)
|
|
20 {
|
|
21 unsigned sum = 0;
|
|
22 for (int idx = 0; idx < (int)nEvents; idx++)
|
|
23 sum += results[idx];
|
|
24
|
|
25 if (sum != 1998)
|
|
26 abort ();
|
|
27 }
|
|
28
|
|
29 int
|
|
30 main (void)
|
|
31 {
|
|
32 unsigned results[nEvents];
|
|
33 unsigned pData[nEvents];
|
|
34 unsigned coeff = 2;
|
|
35
|
|
36 init (&results[0], &pData[0]);
|
|
37
|
|
38 #pragma omp parallel for
|
|
39 for (int idx = 0; idx < (int)nEvents; idx++)
|
|
40 results[idx] = coeff * pData[idx];
|
|
41
|
|
42 check (&results[0]);
|
|
43
|
|
44 return 0;
|
|
45 }
|
|
46
|
131
|
47 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
|
111
|
48 /* { dg-final { scan-tree-dump-not "versioning for alias required" "vect" } } */
|
|
49
|