1 /* PR target/35907 */
2 /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
3 /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
4 /* { dg-require-effective-target powerpc_altivec_ok } */
5 /* { dg-options "-O2 -maltivec" } */
6
7 #define vector __attribute__((vector_size (16)))
8 union
9 {
10 vector int k;
11 int c[16];
12 } u, v, w;
13 vector int m;
14
15 void __attribute__((noinline))
bar(void * i,vector int j)16 bar (void *i, vector int j)
17 {
18 asm volatile ("" : : "r" (i), "r" (&j) : "memory");
19 }
20
21 int __attribute__((noinline))
foo(int i,vector int j)22 foo (int i, vector int j)
23 {
24 char *p = __builtin_alloca (64 + i);
25 m += u.k;
26 v.k = m;
27 w.k = j;
28 if (__builtin_memcmp (&v.c, &w.c, 16) != 0)
29 __builtin_abort ();
30 j += u.k;
31 bar (p, j);
32 j += u.k;
33 bar (p, j);
34 return 0;
35 }
36
37 void
test(void)38 test (void)
39 {
40 vector int l;
41 int i;
42 for (i = 0; i < 4; i++)
43 u.c[i] = i;
44 l = u.k;
45 if (foo (64, l))
46 __builtin_abort ();
47 l += u.k;
48 if (foo (64, l))
49 __builtin_abort ();
50 }
51
52 int
main()53 main ()
54 {
55 test ();
56 return 0;
57 }
58