2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / bb-slp-24.c
blobd5b6bfbc4de180cb942275c5f1dbe24f45374eb6
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define A 3
7 #define N 256
9 short src[N], dst[N];
11 void foo (short * __restrict__ dst, short * __restrict__ src, int h,
12 int stride)
14 int i;
15 h /= 8;
16 for (i = 0; i < h; i++)
18 dst[0] += A*src[0];
19 dst[1] += A*src[1];
20 dst[2] += A*src[2];
21 dst[3] += A*src[3];
22 dst[4] += A*src[4];
23 dst[5] += A*src[5];
24 dst[6] += A*src[6];
25 dst[7] += A*src[7];
26 dst += stride;
27 src += stride;
28 asm volatile ("" ::: "memory");
33 int main (void)
35 int i;
37 check_vect ();
39 for (i = 0; i < N; i++)
41 dst[i] = 0;
42 src[i] = i;
45 foo (dst, src, N, 8);
47 for (i = 0; i < N; i++)
49 if (dst[i] != A * i)
50 abort ();
53 return 0;
56 /* Exclude POWER8 (only POWER cpu for which vect_element_align is true)
57 because loops have vectorized before SLP gets a shot. */
58 /* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" { target { vect_element_align && { ! powerpc*-*-* } } } } } */