PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-cond-5.c
blob5ade7d1fbad9eee7861d1b0d12ac98e42d453422
1 /* { dg-require-effective-target vect_condition } */
3 #include "tree-vect.h"
5 #define N 128
7 static inline int
8 foo (int x, int y, int a, int b)
10 if (x >= y && a > b)
11 return a;
12 else
13 return b;
16 __attribute__((noinline, noclone)) void
17 bar (int * __restrict__ a, int * __restrict__ b,
18 int * __restrict__ c, int * __restrict__ d,
19 int * __restrict__ e, int w)
21 int i;
22 for (i = 0; i < N/16; i++, a += 16, b += 16, c += 16, d += 16, e += 16)
24 e[0] = foo (c[0], d[0], a[0] * w, b[0] * w);
25 e[1] = foo (c[1], d[1], a[1] * w, b[1] * w);
26 e[2] = foo (c[2], d[2], a[2] * w, b[2] * w);
27 e[3] = foo (c[3], d[3], a[3] * w, b[3] * w);
28 e[4] = foo (c[4], d[4], a[4] * w, b[4] * w);
29 e[5] = foo (c[5], d[5], a[5] * w, b[5] * w);
30 e[6] = foo (c[6], d[6], a[6] * w, b[6] * w);
31 e[7] = foo (c[7], d[7], a[7] * w, b[7] * w);
32 e[8] = foo (c[8], d[8], a[8] * w, b[8] * w);
33 e[9] = foo (c[9], d[9], a[9] * w, b[9] * w);
34 e[10] = foo (c[10], d[10], a[10] * w, b[10] * w);
35 e[11] = foo (c[11], d[11], a[11] * w, b[11] * w);
36 e[12] = foo (c[12], d[12], a[12] * w, b[12] * w);
37 e[13] = foo (c[13], d[13], a[13] * w, b[13] * w);
38 e[14] = foo (c[14], d[14], a[14] * w, b[14] * w);
39 e[15] = foo (c[15], d[15], a[15] * w, b[15] * w);
44 int a[N], b[N], c[N], d[N], e[N];
46 int main ()
48 int i;
50 check_vect ();
52 for (i = 0; i < N; i++)
54 a[i] = i;
55 b[i] = 5;
56 e[i] = 0;
58 switch (i % 9)
60 case 0: asm (""); c[i] = i; d[i] = i + 1; break;
61 case 1: c[i] = 0; d[i] = 0; break;
62 case 2: c[i] = i + 1; d[i] = i - 1; break;
63 case 3: c[i] = i; d[i] = i + 7; break;
64 case 4: c[i] = i; d[i] = i; break;
65 case 5: c[i] = i + 16; d[i] = i + 3; break;
66 case 6: c[i] = i - 5; d[i] = i; break;
67 case 7: c[i] = i; d[i] = i; break;
68 case 8: c[i] = i; d[i] = i - 7; break;
72 bar (a, b, c, d, e, 2);
73 for (i = 0; i < N; i++)
74 if (e[i] != ((i % 3) == 0 || i <= 5 ? 10 : 2 * i))
75 abort ();
77 return 0;
80 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { i?86-*-* x86_64-*-* } } } } */