Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/pr96787-2.c

raw
1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-require-effective-target power10_ok } */
4 /* { dg-options "-O2 -mdejagnu-cpu=power10" } */
5
6 /* Verify that we generate an indirect sibcall for ELFv2 on P10 and
7 later, with r12 and CTR containing the function address. PR96787. */
8
9 extern void abort (void);
10 extern int f (int);
11
12 int main ()
13 {
14 if (f (3) != 6)
15 abort ();
16 return 0;
17 }
18
19
20 int g (int a)
21 {
22 return a * 2;
23 }
24
25
26 int h (int a)
27 {
28 return a + 2;
29 }
30
31 int __attribute__((__noinline__)) f (int a)
32 {
33 int (*x) (int) = a % 2 ? &g : &h;
34 (*x) (a);
35 }
36