Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr35907.c
blob7d5465ea1514b9bce6066b34e12a5479900d67f7
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" } */
7 #define vector __attribute__((vector_size (16)))
8 union
10 vector int k;
11 int c[16];
12 } u, v, w;
13 vector int m;
15 void __attribute__((noinline))
16 bar (void *i, vector int j)
18 asm volatile ("" : : "r" (i), "r" (&j) : "memory");
21 int __attribute__((noinline))
22 foo (int i, vector int j)
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;
37 void
38 test (void)
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 ();
52 int
53 main ()
55 test ();
56 return 0;