1 /* { dg-additional-options "-mavx2" { target avx_runtime } } */
2
3 #include "tree-vect.h"
4
5 #define N 16
6 struct C { int r, i; };
7 struct C a[N], b[N], c[N], d[N], e[N];
8
9 __attribute__((noipa)) static void
10 foo (struct C *__restrict x, struct C *__restrict y, struct C *__restrict z, int w)
11 {
12 int i;
13 for (int i = 0; i < w; i++)
14 {
15 z[i].r = x[i].r * y[-1 - i].r - x[i].i * y[-1 - i].i;
16 z[i].i = x[i].i * y[-1 - i].r + x[i].r * y[-1 - i].i;
17 }
18 }
19
20 __attribute__((noipa)) static void
21 bar (struct C *__restrict x, struct C *__restrict y, struct C *__restrict z, int w)
22 {
23 int i;
24 for (int i = 0; i < w; i++)
25 {
26 z[i].r = x[i].r * y[i].r - x[i].i * y[i].i;
27 z[i].i = x[i].i * y[i].r + x[i].r * y[i].i;
28 }
29 }
30
31 int
32 main ()
33 {
34 check_vect ();
35 int i;
36 for (i = 0; i < N; ++i)
37 {
38 a[i].r = N - i; a[i].i = i - N;
39 b[i].r = i - N; b[i].i = i + N;
40 c[i].r = -1 - i; c[i].i = 2 * N - 1 - i;
41 }
42 foo (a, b + N, d, N);
43 bar (a, c, e, N);
44 for (i = 0; i < N; ++i)
45 if (d[i].r != e[i].r || d[i].i != e[i].i)
46 __builtin_abort ();
47 return 0;
48 }