Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.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 #pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3)
14 __attribute__((noinline)) int
15 foo (int a, int b, int c)
16 /* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } .-1 } */
17 {
18 if (a < 30)
19 return 5;
20 return a + b + c;
21 }
22
23 __attribute__((noinline, noclone)) void
24 bar ()
25 {
26 int i;
27 #pragma omp simd
28 for (i = 0; i < N; ++i)
29 {
30 d[i] = foo (i, 123, i * 3);
31 e[i] = e[i] + i;
32 }
33 }
34
35 int
36 main ()
37 {
38 int i;
39 check_vect ();
40 bar ();
41 #pragma GCC novector
42 for (i = 0; i < N; i++)
43 if (d[i] != (i < 30 ? 5 : i * 4 + 123) || e[i] != i)
44 abort ();
45 return 0;
46 }