OSDN Git Service

Add sparc VIS 2.0 builtins, intrinsics, and option to control them.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / s390 / frame-addr2.c
1 /* builtin_frame_address(n) with n>0 has always been troublesome.  */
2
3 /* { dg-do run } */
4 /* { dg-options "-O3 -fno-optimize-sibling-calls -mbackchain" } */
5
6 #ifdef __s390x__
7 #define SAVE_AREA_SIZE 160
8 #else
9 #define SAVE_AREA_SIZE 96
10 #endif
11 extern void abort(void);
12
13 #define EXPAND_CHECK(n)                                         \
14   void __attribute__((noinline))                                \
15     foo1_##n (void *p)                                          \
16   {                                                             \
17     if (p - __builtin_frame_address (n) != SAVE_AREA_SIZE)      \
18       abort ();                                                 \
19   }                                                             \
20   void __attribute__((noinline))                                \
21     foo2_##n (void *p)                                          \
22   {                                                             \
23     if (p - __builtin_frame_address (n) != SAVE_AREA_SIZE)      \
24       abort ();                                                 \
25     foo1_##n (__builtin_frame_address (n));                     \
26   }                                                             \
27   void __attribute__((noinline))                                \
28     foo3_##n ()                                                 \
29   {                                                             \
30     foo2_##n (__builtin_frame_address (n));                     \
31   }                                                             \
32   void __attribute__((noinline))                                \
33     foo4_##n ()                                                 \
34   {                                                             \
35     foo3_##n ();                                                \
36   }
37
38 EXPAND_CHECK (0)
39 EXPAND_CHECK (1)
40 EXPAND_CHECK (2)
41
42 int
43 main ()
44 {
45   foo4_0 ();
46   foo4_1 ();
47   foo4_2 ();
48
49   return 0;
50 }