PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr50725.c
blobc9ca7d9475a7bab12bcbcecbb1049db0627a4bc3
1 /* PR target/50725 */
2 /* { dg-do run { target avx_runtime } } */
3 /* { dg-options "-O2 -mavx" } */
5 extern void abort (void);
7 typedef int __attribute__((vector_size (32))) m256i;
9 __attribute__((noinline, noclone)) void
10 foo (int *x, m256i *y)
12 asm volatile ("" : : "r" (x), "r" (y) : "memory");
15 __attribute__((noinline, noclone)) int
16 bar (int x)
18 if (x > 20)
19 return 24;
20 m256i i;
21 foo (__builtin_alloca (x), &i);
22 return 128;
25 __attribute__((noinline, noclone)) int
26 baz (int d0, int d1, int d2, int d3, int d4, int d5, int x)
28 if (x > 20)
29 return 24;
30 m256i i;
31 d0 += d1 + d2 + d3 + d4 + d5; d1 += d0;
32 foo (__builtin_alloca (x), &i);
33 return 128;
36 int
37 main ()
39 if (bar (22) != 24 || bar (20) != 128)
40 abort ();
41 #ifdef __x86_64__
42 register long long r10 __asm__ ("r10") = 0xdeadbeefdeadbeefULL;
43 asm volatile ("" : "+r" (r10));
44 #endif
45 if (baz (0, 0, 0, 0, 0, 0, 22) != 24 || baz (0, 0, 0, 0, 0, 0, 20) != 128)
46 abort ();
47 return 0;