1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7
8 unsigned int b[N];
9 unsigned int out[N];
10 unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
11
12 __attribute__ ((noinline)) int
13 main1 (unsigned int x, unsigned int y)
14 {
15 int i;
16 unsigned int a0, a1, a2, a3;
17
18 if (x > y)
19 x = x + y;
20 else
21 y = x;
22
23 a0 = in[0] + 23;
24 a1 = in[1] + 142;
25 a2 = in[2] + 2;
26 a3 = in[3] + 31;
27
28 b[0] = a0;
29 b[1] = a1;
30
31 out[0] = a0 * x;
32 out[1] = a1 * y;
33 out[2] = a2 * x;
34 out[3] = a3 * y;
35
36 if (x)
37 __asm__ volatile ("" : : : "memory");
38
39 /* Check results. */
40 if (out[0] != (in[0] + 23) * x
41 || out[1] != (in[1] + 142) * y
42 || out[2] != (in[2] + 2) * x
43 || out[3] != (in[3] + 31) * y
44 || b[0] != in[0] + 23
45 || b[1] != in[1] + 142)
46 abort();
47
48 return 0;
49 }
50
51 int main (void)
52 {
53 check_vect ();
54
55 main1 (2, 3);
56
57 return 0;
58 }
59
60 /* We need V2SI vector add support for the b[] vectorization, if we don't
61 have that we might only see the store vectorized and thus 2 subgraphs. */
62 /* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target { vect_int_mult && vect64 } } } } */