libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr106081.c
blob8f97af2d642b78773524073856023ac53cad2b7c
1 /* { dg-do compile } */
2 /* { dg-additional-options "-ffast-math -fdump-tree-optimized" } */
3 /* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */
4 /* { dg-require-effective-target vect_double } */
5 /* { dg-require-effective-target vect_unpack } */
6 /* { dg-require-effective-target vect_intdouble_cvt } */
7 /* { dg-require-effective-target vect_perm } */
9 struct pixels
11 short a,b,c,d;
12 } *pixels;
13 struct dpixels
15 double a,b,c,d;
18 double
19 test(double *k)
21 struct dpixels results={};
22 for (int u=0; u<1000*16;u++,k--)
24 results.a += *k*pixels[u].a;
25 results.b += *k*pixels[u].b;
26 results.c += *k*pixels[u].c;
27 results.d += *k*pixels[u].d;
29 return results.a+results.b*2+results.c*3+results.d*4;
32 /* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */
33 /* { dg-final { scan-tree-dump-times "VEC_PERM" 4 "optimized" { target x86_64-*-* i?86-*-* } } } */