Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / fuse-caller-save-rec.c
bloba0fcf9c85d7e25bbeeed119b3f53d9de85f2bfdc
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fuse-caller-save -fomit-frame-pointer -fno-optimize-sibling-calls" } */
3 /* { dg-additional-options "-mregparm=1" { target ia32 } } */
5 /* Test -fuse-caller-save optimization on self-recursive function. */
7 static int __attribute__((noinline))
8 bar (int x)
10 if (x > 4)
11 return bar (x - 3);
12 return 0;
15 int __attribute__((noinline))
16 foo (int y)
18 return y + bar (y);
21 /* Check that no registers are saved/restored. */
22 /* { dg-final { scan-assembler-not "push" } } */
23 /* { dg-final { scan-assembler-not "pop" } } */
25 /* Check that addition uses dx. */
26 /* { dg-final { scan-assembler-times "addl\t%\[re\]?dx, %\[re\]?ax" 1 } } */
28 /* Verify that bar is self-recursive. */
29 /* { dg-final { scan-assembler-times "call\t_?bar" 2 } } */