aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/pr66251.c
blob: 355590e69a98687084fee2c5486d14c2a20f3fcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_double } */
/* { dg-require-effective-target vect_doubleint_cvt } */
/* { dg-require-effective-target vect_intdouble_cvt } */
/* { dg-require-effective-target vect_pack_trunc } */
/* { dg-require-effective-target vect_unpack } */
/* { dg-require-effective-target vect_hw_misalign } */

#include "tree-vect.h"

void __attribute__((noinline,noclone))
test1(_Complex double *a, _Complex int *b, int stride, int n)
{
  int i;
  for (i = 0; i < n; i++)
    {
      a[i*stride] = b[i*stride];
    }
}

void __attribute__((noinline,noclone))
test2(_Complex int *a, _Complex double *b, int stride, int n)
{
  int i;
  for (i = 0; i < n; i++)
    {
      a[i*stride] = b[i*stride];
    }
}

_Complex int ia[256];
_Complex double da[256];

extern void abort (void);

int main ()
{
  int i;
  int stride;

  check_vect ();

  for (stride = 1; stride < 15; stride++)
    {
      for (i = 0; i < 256; i++)
	{
	  __real__ ia[i] = (i + stride) % 19;
	  __imag__ ia[i] = (i + stride) % 23;
	  __asm__ volatile ("");
	}

      test1(da, ia, stride, 256/stride);

#pragma GCC novector
      for (i = 0; i < 256/stride; i++)
	{
	  if (da[i*stride] != ia[i*stride])
	    abort ();
	}

      for (i = 0; i < 256; i++)
	{
	  __real__ da[i] = (i + stride + 1) % 29;
	  __imag__ da[i] = (i + stride + 1) % 31;
	  __asm__ volatile ("");
	}

      test2(ia, da, stride, 256/stride);

#pragma GCC novector
      for (i = 0; i < 256/stride; i++)
	{
	  if (da[i*stride] != ia[i*stride])
	    abort ();
	}
    }
  return 0;
}

/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */