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