OSDN Git Service

* gcc.dg/stack-usage-1.c (SIZE): Provide proper values for __PPC64__
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / stack-usage-1.c
1 /* { dg-do compile } */
2 /* { dg-options "-fstack-usage" } */
3
4 /* This is aimed at testing basic support for -fstack-usage in the back-ends.
5    See the SPARC back-end for an example (grep flag_stack_usage in sparc.c).
6    Once it is implemented, adjust SIZE below so that the stack usage for the
7    function FOO is reported as 256 or 264 in the stack usage (.su) file.
8    Then check that this is the actual stack usage in the assembly file.  */
9
10 #if defined(__i386__)
11 #  define SIZE 248
12 #elif defined(__x86_64__)
13 #  define SIZE 356
14 #elif defined (__sparc__)
15 #  if defined (__arch64__)
16 #    define SIZE 76
17 #  else
18 #    define SIZE 160
19 #  endif
20 #elif defined(__hppa__)
21 #  define SIZE 192
22 #elif defined (__alpha__)
23 #  define SIZE 240
24 #elif defined (__ia64__)
25 #  define SIZE 272
26 #elif defined(__mips__)
27 #  if defined (__mips_abicalls) \
28       || (defined _MIPS_SIM && (_MIPS_SIM ==_ABIN32 || _MIPS_SIM==_ABI64))
29 #    define SIZE 240
30 #  else
31 #    define SIZE 248
32 #  endif
33 #elif defined (__powerpc64__) || defined (__PPC64__)
34 #  define SIZE 180
35 #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
36       || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
37 #  if defined (__ALTIVEC__)
38 #    define SIZE 220
39 #  else
40 #    define SIZE 240
41 #  endif
42 #elif defined (__AVR__)
43 #  define SIZE 254
44 #elif defined (__s390x__)
45 #  define SIZE 96  /* 256 - 160 bytes for register save area */
46 #elif defined (__s390__)
47 #  define SIZE 160 /* 256 -  96 bytes for register save area */
48 #elif defined (__SPU__)
49 #  define SIZE 224
50 #else
51 #  define SIZE 256
52 #endif
53
54 int foo (void)
55 {
56   char arr[SIZE];
57   arr[0] = 1;
58   return 0;
59 }
60
61 /* { dg-final { scan-stack-usage "foo\t\(256|264\)\tstatic" } } */
62 /* { dg-final { cleanup-stack-usage } } */