111
|
1 /* { dg-require-effective-target vect_condition } */
|
|
2
|
|
3 #include "tree-vect.h"
|
|
4
|
|
5 #define N 128
|
|
6
|
|
7 /* Comparison in short, then/else and result in int. */
|
|
8 static inline int
|
|
9 foo (short x, short y, int a, int b)
|
|
10 {
|
|
11 if (x >= y)
|
|
12 return a;
|
|
13 else
|
|
14 return b;
|
|
15 }
|
|
16
|
|
17 __attribute__((noinline, noclone)) void
|
|
18 bar (short * __restrict__ a, short * __restrict__ b,
|
|
19 short * __restrict__ c, short * __restrict__ d,
|
|
20 int * __restrict__ e, int w)
|
|
21 {
|
|
22 int i;
|
|
23 int stride = 16;
|
|
24
|
|
25 for (i = 0; i < N/stride; i++, a += stride, b += stride, c += stride,
|
|
26 d += stride, e += stride)
|
|
27 {
|
|
28 e[0] = foo (c[0], d[0], a[0], b[0]);
|
|
29 e[1] = foo (c[1], d[1], a[1], b[1]);
|
|
30 e[2] = foo (c[2], d[2], a[2], b[2]);
|
|
31 e[3] = foo (c[3], d[3], a[3], b[3]);
|
|
32 e[4] = foo (c[4], d[4], a[4], b[4]);
|
|
33 e[5] = foo (c[5], d[5], a[5], b[5]);
|
|
34 e[6] = foo (c[6], d[6], a[6], b[6]);
|
|
35 e[7] = foo (c[7], d[7], a[7], b[7]);
|
|
36 e[8] = foo (c[8], d[8], a[8], b[8]);
|
|
37 e[9] = foo (c[9], d[9], a[9], b[9]);
|
|
38 e[10] = foo (c[10], d[10], a[10], b[10]);
|
|
39 e[11] = foo (c[11], d[11], a[11], b[11]);
|
|
40 e[12] = foo (c[12], d[12], a[12], b[12]);
|
|
41 e[13] = foo (c[13], d[13], a[13], b[13]);
|
|
42 e[14] = foo (c[14], d[14], a[14], b[14]);
|
|
43 e[15] = foo (c[15], d[15], a[15], b[15]);
|
|
44 }
|
|
45 }
|
|
46
|
|
47
|
|
48 short a[N], b[N], c[N], d[N];
|
|
49 int e[N];
|
|
50
|
|
51 int main ()
|
|
52 {
|
|
53 int i;
|
|
54
|
|
55 check_vect ();
|
|
56
|
|
57 for (i = 0; i < N; i++)
|
|
58 {
|
|
59 a[i] = i;
|
|
60 b[i] = 5;
|
|
61 e[i] = 0;
|
|
62
|
|
63 switch (i % 9)
|
|
64 {
|
|
65 case 0: asm (""); c[i] = - i - 1; d[i] = i + 1; break;
|
|
66 case 1: c[i] = 0; d[i] = 0; break;
|
|
67 case 2: c[i] = i + 1; d[i] = - i - 1; break;
|
|
68 case 3: c[i] = i; d[i] = i + 7; break;
|
|
69 case 4: c[i] = i; d[i] = i; break;
|
|
70 case 5: c[i] = i + 16; d[i] = i + 3; break;
|
|
71 case 6: c[i] = - i - 5; d[i] = - i; break;
|
|
72 case 7: c[i] = - i; d[i] = - i; break;
|
|
73 case 8: c[i] = - i; d[i] = - i - 7; break;
|
|
74 }
|
|
75 }
|
|
76
|
|
77 bar (a, b, c, d, e, 2);
|
|
78 for (i = 0; i < N; i++)
|
|
79 if (e[i] != ((i % 3) == 0 ? 5 : i))
|
|
80 abort ();
|
|
81
|
|
82 return 0;
|
|
83 }
|
|
84
|
|
85 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
|