2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / sibcall-5.c
blob424908dba5a3d1c881ebb8ccd34450edd506f3ed
1 /* Check that indirect sibcalls understand regparm. */
2 /* { dg-do run { target i?86-*-* } } */
3 /* { dg-options "-O2" } */
5 int (*f)(int, int) __attribute__((regparm(2)));
6 int (*g)(int, int, int) __attribute__((regparm(3)));
8 int __attribute__((noinline))
9 foo(void)
11 return f(1, 2);
14 int __attribute__((noinline))
15 bar(void)
17 return g(1, 2, 3);
20 int __attribute__((regparm(2)))
21 f1(int x, int y)
23 return x*3 + y;
26 int __attribute__((regparm(3)))
27 g1(int x, int y, int z)
29 return x*9 + y*3 + z;
32 int main()
34 f = f1;
35 g = g1;
36 if (foo() != 1*3 + 2)
37 abort ();
38 if (bar() != 1*9 + 2*3 + 3)
39 abort ();
40 return 0;