2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / fuse-caller-save.c
blob4b8e68d90f508ce000c4bf96f8d6a5d74a4002e0
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fipa-ra -fomit-frame-pointer" } */
3 /* { dg-additional-options "-mregparm=1" { target ia32 } } */
5 /* Testing -fipa-ra optimization option. */
7 static int __attribute__((noinline))
8 bar (int x)
10 return x + 3;
13 int __attribute__((noinline))
14 foo (int y)
16 return y + bar (y);
19 /* For !nonpic && ia32 xfails, see PR64895. */
21 /* Check that no registers are saved/restored. */
22 /* { dg-final { scan-assembler-not "push" { xfail { { ! nonpic } && ia32 } } } } */
23 /* { dg-final { scan-assembler-not "pop" { xfail { { ! nonpic } && ia32 } } } } */
25 /* PR61605. If the first argument register and the return register differ, then
26 bar leaves the first argument register intact. That means in foo that the
27 first argument register still contains y after bar has been called, and
28 there's no need to copy y to a different register before the call, to be able
29 to use it after the call.
30 Check that the copy is absent. */
31 /* { dg-final { scan-assembler-not "movl" { target { ! ia32 } } } } */
33 /* Check that addition uses di (in case of no copy) or dx (in case of copy). */
34 /* { dg-final { scan-assembler-times "addl\t%\[re\]?d\[ix\], %\[re\]?ax" 1 { xfail { { ! nonpic } && ia32 } } } } */