blob: 1ac13a5c5b4f568afa448af8d294d114533c061b (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/* { dg-additional-options "-fopenmp-simd" } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-final { scan-tree-dump-times "vectorized \[1-3] loops" 3 "vect" { target i?86-*-* x86_64-*-* } } } */
#include "tree-vect.h"
__attribute__((noipa)) int
foo (int *a)
{
int i;
#pragma omp simd lastprivate (i)
for (i = 0; i < 64; i++)
a[i] = i;
return i;
}
__attribute__((noipa)) void
bar (int *a)
{
int i;
#pragma omp simd private (i)
for (i = 0; i < 64; i++)
a[i] = i + 1;
}
__attribute__((noipa)) int
baz (int *a)
{
int i;
#pragma omp simd linear (i)
for (i = 0; i < 64; i++)
a[i] = i + 2;
return i;
}
int
main ()
{
int i;
int a[64];
check_vect ();
if (foo (a) != 64)
abort ();
#pragma GCC novector
for (i = 0; i < 64; ++i)
if (a[i] != i)
abort ();
else
a[i] = -8;
bar (a);
#pragma GCC novector
for (i = 0; i < 64; ++i)
if (a[i] != i + 1)
abort ();
else
a[i] = -8;
if (baz (a) != 64)
abort ();
#pragma GCC novector
for (i = 0; i < 64; ++i)
if (a[i] != i + 2)
abort ();
return 0;
}
|