2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr46685.c
blob6277bcc2f0a86d4093c34a88fcdbc6f894eb27c7
1 /* { dg-do compile } */
2 /* { dg-require-effective-target freorder } */
3 /* { dg-require-effective-target fpic } */
4 /* { dg-options "-O2 -freorder-blocks-and-partition -fpic" } */
6 __attribute__((noinline, noclone))
7 void bar (void *x)
9 asm volatile ("" : : "r" (x) : "memory");
12 __attribute__((noinline, noclone))
13 void baz (void)
15 asm volatile ("" : : : "memory");
18 __attribute__((noinline, noclone))
19 int foo (int x)
21 __label__ lab;
22 if (__builtin_expect (x, 0))
24 lab:
25 baz ();
26 return 2;
28 bar (&&lab);
29 return 1;
32 int
33 main (void)
35 int x, i;
36 asm volatile ("" : "=r" (x) : "0" (0));
37 for (i = 0; i < 1000000; i++)
38 foo (x);
39 return 0;