aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/pr82374.c
blob: 453266ed84e690200ee72a44a33427e03714eb99 (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
/* PR tree-optimization/82374 */
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-vect-details" } */
/* { dg-additional-options "-mavx -mno-avx2" { target i?86-*-* x86_64-*-* } } */
/* { dg-additional-options "-mvsx" { target powerpc_vsx_ok } } */

#define SIZE (1024 * 1024)

float a[SIZE];
float b[SIZE];
float c[SIZE];
float d[SIZE];

__attribute__((optimize ("O2", "tree-vectorize"))) void
foo (void)
{
  int i;
#pragma omp parallel for
  for (i = 0; i < SIZE; i++)
    c[i] = a[i] + b[i];
}

__attribute__((optimize ("O2", "tree-vectorize"))) void
bar (void)
{
  int i;
  for (i = 0; i < SIZE; i++)
    d[i] = a[i] + b[i];
}

/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { { i?86-*-* x86_64-*-* } || { powerpc_vsx_ok } } } } } */