PR target/83368
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / stack-check-17.c
blobd2ef83b348af7a94361a73b1170d603069ff4f21
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fomit-frame-pointer" } */
3 /* { dg-require-effective-target supports_stack_clash_protection } */
6 int x0, x1;
7 void f1 (void);
8 void f2 (int, int);
10 __attribute__ ((noreturn))
11 void
12 f3 (void)
14 int y0 = x0;
15 int y1 = x1;
16 f1 ();
17 f2 (y0, y1);
18 while (1);
21 /* Verify no explicit probes. */
22 /* { dg-final { scan-assembler-not "or\[ql\]" } } */
24 /* We also want to verify we did not use a push/pop sequence
25 to probe *sp as the callee register saves are sufficient
26 to probe *sp.
28 y0/y1 are live across the call and thus must be allocated
29 into either a stack slot or callee saved register. The former
30 would be rather dumb. So assume it does not happen.
32 So search for two/four pushes for the callee register saves/argument
33 pushes and no pops (since the function has no reachable epilogue). */
34 /* { dg-final { scan-assembler-times "push\[ql\]" 2 { target { ! ia32 } } } } */
35 /* { dg-final { scan-assembler-times "push\[ql\]" 4 { target { ia32 } } } } */
36 /* { dg-final { scan-assembler-not "pop" } } */