2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr82108.c
blob5b8faf1aefbd771ae83698bfb50a0f9308352a98
1 /* { dg-do run } */
2 /* { dg-require-effective-target vect_float } */
4 #include "tree-vect.h"
6 void __attribute__((noinline,noclone))
7 downscale_2 (const float* src, int src_n, float* dst)
9 int i;
11 for (i = 0; i < src_n; i += 2) {
12 const float* a = src;
13 const float* b = src + 4;
15 dst[0] = (a[0] + b[0]) / 2;
16 dst[1] = (a[1] + b[1]) / 2;
17 dst[2] = (a[2] + b[2]) / 2;
18 dst[3] = (a[3] + b[3]) / 2;
20 src += 2 * 4;
21 dst += 4;
25 int main ()
27 const float in[4 * 4] = {
28 1, 2, 3, 4,
29 5, 6, 7, 8,
31 1, 2, 3, 4,
32 5, 6, 7, 8
34 float out[2 * 4];
36 check_vect ();
38 downscale_2 (in, 4, out);
40 if (out[0] != 3 || out[1] != 4 || out[2] != 5 || out[3] != 6
41 || out[4] != 3 || out[5] != 4 || out[6] != 5 || out[7] != 6)
42 __builtin_abort ();
44 return 0;
47 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */