Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr35907.c
blobe1749dea8c90f384e9c4badc26db6b719f2dc0bc
1 /* PR target/35907 */
2 /* { dg-do run { target powerpc*-*-* } } */
3 /* { dg-require-effective-target powerpc_altivec_ok } */
4 /* { dg-options "-O2 -maltivec" } */
6 #include "altivec_check.h"
8 #define vector __attribute__((vector_size (16)))
9 union
11 vector int k;
12 int c[16];
13 } u, v, w;
14 vector int m;
16 void __attribute__((noinline))
17 bar (void *i, vector int j)
19 asm volatile ("" : : "r" (i), "r" (&j) : "memory");
22 int __attribute__((noinline))
23 foo (int i, vector int j)
25 char *p = __builtin_alloca (64 + i);
26 m += u.k;
27 v.k = m;
28 w.k = j;
29 if (__builtin_memcmp (&v.c, &w.c, 16) != 0)
30 __builtin_abort ();
31 j += u.k;
32 bar (p, j);
33 j += u.k;
34 bar (p, j);
35 return 0;
38 void
39 test (void)
41 vector int l;
42 int i;
43 for (i = 0; i < 4; i++)
44 u.c[i] = i;
45 l = u.k;
46 if (foo (64, l))
47 __builtin_abort ();
48 l += u.k;
49 if (foo (64, l))
50 __builtin_abort ();
53 int
54 main ()
56 altivec_check ();
57 test ();
58 return 0;