1 /* { dg-do assemble { target { avx512bw && avx512vl } } } */
2 /* { dg-options "-O1 -mavx512bw -mavx512vl -mtune=skylake-avx512" } */
3 
4 extern void abort (void);
5 extern void exit (int);
6 struct s { unsigned char a[256]; };
7 union u { struct { struct s b; int c; } d; struct { int c; struct s b; } e; };
8 static union u v;
9 static union u v0;
10 static struct s *p = &v.d.b;
11 static struct s *q = &v.e.b;
12 
rp(void)13 static inline struct s rp (void) { return *p; }
rq(void)14 static inline struct s rq (void) { return *q; }
pq(void)15 static void pq (void) { *p = rq(); }
qp(void)16 static void qp (void) { *q = rp(); }
17 
18 static void
init(struct s * sp)19 init (struct s *sp)
20 {
21   int i;
22   for (i = 0; i < 256; i++)
23     sp->a[i] = i;
24 }
25 
26 static void
check(struct s * sp)27 check (struct s *sp)
28 {
29   int i;
30   for (i = 0; i < 256; i++)
31     if (sp->a[i] != i)
32       abort ();
33 }
34 
35 void
main_test(void)36 main_test (void)
37 {
38   v = v0;
39   init (p);
40   qp ();
41   check (q);
42   v = v0;
43   init (q);
44   pq ();
45   check (p);
46   exit (0);
47 }
48