aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-prof/pr66295.c
blob: 36a30acc24e8ef581813016b535e546d11bb4668 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* { dg-require-ifunc "" } */
/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target avx512f } */
/* { dg-options "-O2" } */

static double bar (double *__restrict, double *__restrict, int)
__attribute__ ((target_clones("avx,avx2,avx512f,default")));

double
foo (double *__restrict a, double *__restrict b, int n)
{
  return bar (a,b,n);
}

double
bar (double *__restrict a, double *__restrict b, int n)
{
  double s;
  int i;
  s = 0.0;
  for (i=0; i<n; i++)
    s += a[i] + b[i];

  return s;
}

#define N 5

int main ()
{
  double a[N] = {1.2f, 1.2f, 1.2f, 1.2f, 1.2f };
  double b[N] = {1.2f, 1.2f, 1.2f, 1.2f, 1.2f };

  __builtin_printf ("value: %.5f\n", foo (a, b, N));
  return 0;
}