2016-12-07 Thomas Preud'homme <thomas.preudhomme@arm.com>
[official-gcc.git] / gcc / testsuite / g++.dg / vect / simd-clone-2.cc
blob1a1b982fc2034fc9e31f7bfdb2f3086d5a0f8beb
1 // { dg-require-effective-target vect_simd_clones }
2 // { dg-additional-options "-fopenmp-simd -fno-inline -DONE_FILE" }
3 // { dg-additional-options "-mavx" { target avx_runtime } }
5 #include "../../gcc.dg/vect/tree-vect.h"
7 #ifdef ONE_FILE
8 #include "simd-clone-3.cc"
9 #else
10 #include "simd-clone-2.h"
11 #endif
13 T b __attribute__((aligned (32)));
15 void
16 do_main ()
18 int i, r = 0;
19 S a[64];
20 for (i = 0; i < 64; i++)
22 a[i].s = i;
23 b.t[i] = i;
25 #pragma omp simd reduction(+:r)
26 for (i = 0; i < 64; i++)
27 r += a[16].f0 (i);
28 if (r != 64 * 63 / 2 + 64 * 16)
29 __builtin_abort ();
30 r = 0;
31 #pragma omp simd reduction(+:r)
32 for (i = 0; i < 64; i++)
33 r += a[32].f1 (i);
34 if (r != 64 * 63 / 2 + 64 * 32)
35 __builtin_abort ();
36 r = 0;
37 #pragma omp simd reduction(+:r)
38 for (i = 0; i < 64; i++)
39 r += a[i].f2 (i);
40 if (r != 64 * 63)
41 __builtin_abort ();
42 r = 0;
43 #pragma omp simd reduction(+:r)
44 for (i = 0; i < 64; i++)
45 r += b.f3 (i);
46 if (r != 64 * 63 / 2)
47 __builtin_abort ();
50 int
51 main ()
53 check_vect ();
54 do_main ();