aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pr55845.c
blob: daf04e54a726714844297c1068b1355b4234346b (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
37
38
39
40
/* { dg-do run } */
/* { dg-require-effective-target avx } */
/* { dg-options "-O3 -ffast-math -fschedule-insns -mavx -mvzeroupper" } */

#include "avx-check.h"

#define N 100

double
__attribute__((noinline))
foo (int size, double *y, double *x)
{
  double sum = 0.0;
  int i;

  for (i = 0; i < size; i++)
    sum += y[i] * x[i];

  return sum;
}

static void
__attribute__ ((noinline))
avx_test ()
{
  double x[N], y[N];
  double s;
  int i;

  for (i = 0; i < N; i++)
    {
      x[i] = i;
      y[i] = i;
    }

  s = foo (N, y, x);

  if (s != 328350.0)
    abort ();
}