blob: 93cb9f993c0d5a76dd6bf1c8aa749782a3dcd4a1 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/* { dg-do run } */
/* { dg-require-effective-target vect_simd_clones } */
/* { dg-additional-options "-fopenmp-simd" } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
/* { dg-additional-sources vect-simd-clone-10a.c } */
#include "tree-vect.h"
#ifndef N
#define N 1024
#endif
int a[N], b[N];
long int c[N];
unsigned char d[N];
#include "vect-simd-clone-10.h"
__attribute__((noinline)) void
fn1 (void)
{
int i;
#pragma omp simd
for (i = 0; i < N; i++)
a[i] = foo (c[i], a[i], b[i]) + 6;
#pragma omp simd
for (i = 0; i < N; i++)
c[i] = bar (a[i], b[i], c[i]) * 2;
}
__attribute__((noinline)) void
fn2 (void)
{
int i;
#pragma omp simd
for (i = 0; i < N; i++)
{
a[i] = foo (c[i], a[i], b[i]) + 6;
d[i]++;
}
#pragma omp simd
for (i = 0; i < N; i++)
{
c[i] = bar (a[i], b[i], c[i]) * 2;
d[i] /= 2;
}
}
__attribute__((noinline)) void
fn3 (void)
{
int i;
for (i = 0; i < N; i++)
{
a[i] = i * 2;
b[i] = 17 + (i % 37);
c[i] = (i & 63);
d[i] = 16 + i;
}
}
int
main ()
{
int i;
check_vect ();
fn3 ();
fn1 ();
for (i = 0; i < N; i++)
if (a[i] != i * 2 + 23 + (i % 37) + (i & 63)
|| b[i] != 17 + (i % 37)
|| c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63))
abort ();
fn3 ();
fn2 ();
for (i = 0; i < N; i++)
if (a[i] != i * 2 + 23 + (i % 37) + (i & 63)
|| b[i] != 17 + (i % 37)
|| c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63)
|| d[i] != ((unsigned char) (17 + i)) / 2)
abort ();
return 0;
}
/* { dg-final { cleanup-tree-dump "vect" } } */
|