blob: e5702c25a1d3c46110d5bc008237f6adb414df16 (
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/* { dg-require-effective-target vect_cond_mixed } */
#include "tree-vect.h"
#define N 1024
float a[N], b[N], c[N];
int d[N], e[N], f[N];
unsigned char k[N];
__attribute__((noinline, noclone)) void
f1 (void)
{
int i;
for (i = 0; i < N; ++i)
k[i] = a[i] < b[i] ? 17 : 0;
}
__attribute__((noinline, noclone)) void
f2 (void)
{
int i;
for (i = 0; i < N; ++i)
k[i] = a[i] < b[i] ? 0 : 24;
}
__attribute__((noinline, noclone)) void
f3 (void)
{
int i;
for (i = 0; i < N; ++i)
k[i] = a[i] < b[i] ? 51 : 12;
}
__attribute__((noinline, noclone)) void
f4 (void)
{
int i;
for (i = 0; i < N; ++i)
{
int d2 = d[i], e2 = e[i];
f[i] = a[i] < b[i] ? d2 : e2;
}
}
__attribute__((noinline, noclone)) void
f5 (void)
{
int i;
for (i = 0; i < N; ++i)
{
float a2 = a[i], b2 = b[i];
c[i] = d[i] < e[i] ? a2 : b2;
}
}
int
main ()
{
int i;
check_vect ();
for (i = 0; i < N; i++)
{
switch (i % 9)
{
case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break;
case 1: a[i] = 0; b[i] = 0; break;
case 2: a[i] = i + 1; b[i] = - i - 1; break;
case 3: a[i] = i; b[i] = i + 7; break;
case 4: a[i] = i; b[i] = i; break;
case 5: a[i] = i + 16; b[i] = i + 3; break;
case 6: a[i] = - i - 5; b[i] = - i; break;
case 7: a[i] = - i; b[i] = - i; break;
case 8: a[i] = - i; b[i] = - i - 7; break;
}
d[i] = i;
e[i] = 2 * i;
}
f1 ();
for (i = 0; i < N; i++)
if (k[i] != ((i % 3) == 0 ? 17 : 0))
abort ();
f2 ();
for (i = 0; i < N; i++)
if (k[i] != ((i % 3) == 0 ? 0 : 24))
abort ();
f3 ();
for (i = 0; i < N; i++)
if (k[i] != ((i % 3) == 0 ? 51 : 12))
abort ();
f4 ();
for (i = 0; i < N; i++)
if (f[i] != ((i % 3) == 0 ? d[i] : e[i]))
abort ();
for (i = 0; i < N; i++)
{
switch (i % 9)
{
case 0: asm (""); d[i] = - i - 1; e[i] = i + 1; break;
case 1: d[i] = 0; e[i] = 0; break;
case 2: d[i] = i + 1; e[i] = - i - 1; break;
case 3: d[i] = i; e[i] = i + 7; break;
case 4: d[i] = i; e[i] = i; break;
case 5: d[i] = i + 16; e[i] = i + 3; break;
case 6: d[i] = - i - 5; e[i] = - i; break;
case 7: d[i] = - i; e[i] = - i; break;
case 8: d[i] = - i; e[i] = - i - 7; break;
}
a[i] = i;
b[i] = i / 2;
}
f5 ();
for (i = 0; i < N; i++)
if (c[i] != ((i % 3) == 0 ? a[i] : b[i]))
abort ();
return 0;
}
/* { dg-final { scan-tree-dump-times "note: vectorized 1 loops" 5 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
|