Merge from mainline (160224:163495).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / vect / bb-slp-15.c
blobb927348c810e09da5e4e954edb32ed10f83a06d5
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include <stdio.h>
5 #include "tree-vect.h"
7 #define N 16
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};
12 __attribute__ ((noinline)) int
13 main1 (unsigned int x, unsigned int y)
15 int i;
16 unsigned int a0, a1, a2, a3;
18 if (x > y)
19 x = x + y;
20 else
21 y = x;
23 a0 = in[0] + 23;
24 a1 = in[1] + 142;
25 a2 = in[2] + 2;
26 a3 = in[3] + 31;
28 out[0] = a0 * x;
29 out[1] = a1 * y;
30 out[2] = a2 * x;
31 out[3] = a3 * y;
33 if (x)
34 __asm__ volatile ("" : : : "memory");
36 /* Check results. */
37 if (out[0] != (in[0] + 23) * x
38 || out[1] != (in[1] + 142) * y
39 || out[2] != (in[2] + 2) * x
40 || out[3] != (in[3] + 31) * y)
41 abort();
43 return 0;
46 int main (void)
48 check_vect ();
50 main1 (2, 3);
52 return 0;
55 /* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_int_mult } } } */
56 /* { dg-final { cleanup-tree-dump "slp" } } */