Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c

raw
1 /* { dg-require-effective-target vect_simd_clones } */
2 /* { dg-additional-options "-fopenmp-simd" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
4
5 #include "tree-vect.h"
6
7 #ifndef N
8 #define N 1024
9 #endif
10
11 int d[N], e[N];
12
13 #ifdef __aarch64__
14 #pragma omp declare simd simdlen(2) notinbranch uniform(b) linear(c:3)
15 #else
16 #pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3)
17 #endif
18 __attribute__((noinline)) long long int
19 foo (int a, int b, int c)
20 /* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } .-1 } */
21 {
22 return a + b + c;
23 }
24
25 __attribute__((noinline, noclone)) void
26 bar ()
27 {
28 int i;
29 #pragma omp simd
30 for (i = 0; i < N; ++i)
31 {
32 d[i] = foo (i, 123, i * 3);
33 e[i] = e[i] + i;
34 }
35 }
36
37 int
38 main ()
39 {
40 int i;
41 check_vect ();
42 bar ();
43 #pragma GCC novector
44 for (i = 0; i < N; i++)
45 if (d[i] != i * 4 + 123 || e[i] != i)
46 abort ();
47 return 0;
48 }