1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_double } */
3 /* { dg-require-effective-target vect_floatint_cvt } */
4 /* { dg-require-effective-target vect_intfloat_cvt } */
5 /* { dg-require-effective-target vect_pack_trunc } */
6 /* { dg-require-effective-target vect_unpack } */
7 /* { dg-require-effective-target vect_hw_misalign } */
8 
9 #include "tree-vect.h"
10 
11 void __attribute__((noinline,noclone))
test1(_Complex double * a,_Complex int * b,int stride,int n)12 test1(_Complex double *a, _Complex int *b, int stride, int n)
13 {
14   int i;
15   for (i = 0; i < n; i++)
16     {
17       a[i*stride] = b[i*stride];
18     }
19 }
20 
21 void __attribute__((noinline,noclone))
test2(_Complex int * a,_Complex double * b,int stride,int n)22 test2(_Complex int *a, _Complex double *b, int stride, int n)
23 {
24   int i;
25   for (i = 0; i < n; i++)
26     {
27       a[i*stride] = b[i*stride];
28     }
29 }
30 
31 _Complex int ia[256];
32 _Complex double da[256];
33 
34 extern void abort (void);
35 
main()36 int main ()
37 {
38   int i;
39   int stride;
40 
41   check_vect ();
42 
43   for (stride = 1; stride < 15; stride++)
44     {
45       for (i = 0; i < 256; i++)
46 	{
47 	  __real__ ia[i] = (i + stride) % 19;
48 	  __imag__ ia[i] = (i + stride) % 23;
49 	  __asm__ volatile ("");
50 	}
51 
52       test1(da, ia, stride, 256/stride);
53 
54       for (i = 0; i < 256/stride; i++)
55 	{
56 	  if (da[i*stride] != ia[i*stride])
57 	    abort ();
58 	}
59 
60       for (i = 0; i < 256; i++)
61 	{
62 	  __real__ da[i] = (i + stride + 1) % 29;
63 	  __imag__ da[i] = (i + stride + 1) % 31;
64 	  __asm__ volatile ("");
65 	}
66 
67       test2(ia, da, stride, 256/stride);
68 
69       for (i = 0; i < 256/stride; i++)
70 	{
71 	  if (da[i*stride] != ia[i*stride])
72 	    abort ();
73 	}
74     }
75   return 0;
76 }
77 
78 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
79