PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / c-c++-common / gomp / pr60823-2.c
blob4c87620076a0c5961c06d6a5beeb20d9afd2865d
1 /* PR tree-optimization/60823 */
2 /* { dg-do run } */
3 /* { dg-require-effective-target vect_simd_clones } */
4 /* { dg-options "-O2 -fopenmp-simd" } */
6 #pragma omp declare simd simdlen(4) notinbranch
7 __attribute__((noinline)) int
8 foo (double c1, double c2)
10 double z1 = c1, z2 = c2;
11 int res = 100, i;
13 for (i = 0; i < 5; i++)
15 res = (z1 * z1 + z2 * z2 > 4.0) ? (i < res ? i : res) : res;
16 z1 = c1 + z1 * z1 - z2 * z2;
17 z2 = c2 + 2.0 * z1 * z2;
18 c1 += 0.5;
19 c2 += 0.5;
21 return res;
24 __attribute__((noinline, noclone)) void
25 bar (double *x, double *y)
27 asm volatile ("" : : "rm" (x), "rm" (y) : "memory");
30 int
31 main ()
33 int i;
34 double c[4] = { 0.0, 1.0, 0.0, 1.0 };
35 double d[4] = { 0.0, 1.0, 2.0, 0.0 };
36 int e[4];
37 bar (c, d);
38 #pragma omp simd safelen(4)
39 for (i = 0; i < 4; i++)
40 e[i] = foo (c[i], d[i]);
41 if (e[0] != 3 || e[1] != 1 || e[2] != 1 || e[3] != 2)
42 __builtin_abort ();
43 return 0;