blob: a6a3217ee86ea0d8e41027f1b61533de020287ef (
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
|
/* PR tree-optimization/46009 */
/* { dg-require-effective-target vect_int } */
#include "tree-vect.h"
int a[1024] __attribute__((aligned));
int b[1024] __attribute__((aligned));
int c[1024] __attribute__((aligned));
int d[1024] __attribute__((aligned));
int e[1024] __attribute__((aligned));
void __attribute__((noinline))
foo (void)
{
int i, g;
for (i = 0; i < 1024; i++)
{
g = a[i] + b[i] + c[i] * d[i];;
e[i] = g < 10 ? 1 : g;
}
}
void __attribute__((noinline))
bar (void)
{
int i, g;
for (i = 0; i < 1024; i++)
{
g = a[i] + b[i] + c[i] * d[i];;
if (g < 10)
e[i] = 1;
else
e[i] = g;
}
}
int
main (void)
{
int i;
check_vect ();
for (i = 0; i < 1024; i++)
{
asm volatile ("" : "+r" (i));
a[i] = i % 10;
b[i] = i % 10;
c[i] = 1;
d[i] = -1;
e[i] = -1;
}
foo ();
for (i = 0; i < 1024; i++)
{
int g;
asm volatile ("" : "+r" (i));
g = 2 * (i % 10) - 1;
if (e[i] != (g < 10 ? 1 : g))
abort ();
e[i] = -1;
}
bar ();
for (i = 0; i < 1024; i++)
{
int g;
asm volatile ("" : "+r" (i));
g = 2 * (i % 10) - 1;
if (e[i] != (g < 10 ? 1 : g))
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_int_mult } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
|