libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr82108.c
blob074c416b7d9db026914d6bbbedab505ff7ef7d0e
1 /* { dg-require-effective-target vect_float } */
3 #include "tree-vect.h"
5 void __attribute__((noinline,noclone))
6 downscale_2 (const float* src, int src_n, float* dst)
8 int i;
10 for (i = 0; i < src_n; i += 2) {
11 const float* a = src;
12 const float* b = src + 4;
14 dst[0] = (a[0] + b[0]) / 2;
15 dst[1] = (a[1] + b[1]) / 2;
16 dst[2] = (a[2] + b[2]) / 2;
17 dst[3] = (a[3] + b[3]) / 2;
19 src += 2 * 4;
20 dst += 4;
24 int main ()
26 const float in[4 * 4] = {
27 1, 2, 3, 4,
28 5, 6, 7, 8,
30 1, 2, 3, 4,
31 5, 6, 7, 8
33 float out[2 * 4];
35 check_vect ();
37 downscale_2 (in, 4, out);
39 if (out[0] != 3 || out[1] != 4 || out[2] != 5 || out[3] != 6
40 || out[4] != 3 || out[5] != 4 || out[6] != 5 || out[7] != 6)
41 __builtin_abort ();
43 return 0;
46 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */