tree-vectorizer.c: Fix documentation.
[gcc.git] / gcc / testsuite / gcc.dg / vect / bb-slp-8b.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include <stdio.h>
5 #include "tree-vect.h"
6
7 #define N 16
8
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 unsigned int *pin = &in[0];
18 unsigned int *pout = &out[0];
19
20 /* pin and pout are different, so despite the fact that loads and stores
21 are mixed the basic block is vectorizable. */
22 a0 = *pin++ + 23;
23 *pout++ = a0 * x;
24 a1 = *pin++ + 142;
25 *pout++ = a1 * y;
26 a2 = *pin++ + 2;
27 *pout++ = a2 * x;
28 a3 = *pin++ + 31;
29 *pout++ = a3 * y;
30
31 if (i)
32 __asm__ volatile ("" : : : "memory");
33
34 /* Check results. */
35 if (out[0] != (in[0] + 23) * x
36 || out[1] != (in[1] + 142) * y
37 || out[2] != (in[2] + 2) * x
38 || out[3] != (in[3] + 31) * y)
39 abort ();
40
41 return 0;
42 }
43
44 int main (void)
45 {
46 check_vect ();
47
48 main1 (2, 3);
49
50 return 0;
51 }
52
53 /* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_hw_misalign } } } */
54 /* { dg-final { cleanup-tree-dump "slp" } } */
55