PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr46032.c
blobbad87453a7de62024b89561b2dd5c0aa03a71a77
1 /* { dg-do compile } */
2 /* { dg-require-effective-target fopenmp } */
3 /* { dg-require-effective-target vect_int } */
4 /* { dg-additional-options "-fopenmp -fipa-pta" } */
6 extern void abort (void);
8 #define nEvents 1000
10 static void __attribute__((noinline, noclone, optimize("-fno-tree-vectorize")))
11 init (unsigned *results, unsigned *pData)
13 unsigned int i;
14 for (i = 0; i < nEvents; ++i)
15 pData[i] = i % 3;
18 static void __attribute__((noinline, noclone, optimize("-fno-tree-vectorize")))
19 check (unsigned *results)
21 unsigned sum = 0;
22 for (int idx = 0; idx < (int)nEvents; idx++)
23 sum += results[idx];
25 if (sum != 1998)
26 abort ();
29 int
30 main (void)
32 unsigned results[nEvents];
33 unsigned pData[nEvents];
34 unsigned coeff = 2;
36 init (&results[0], &pData[0]);
38 #pragma omp parallel for
39 for (int idx = 0; idx < (int)nEvents; idx++)
40 results[idx] = coeff * pData[idx];
42 check (&results[0]);
44 return 0;
47 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
48 /* { dg-final { scan-tree-dump-not "versioning for alias required" "vect" } } */