[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pcrel-sibcall-1.c
blob1b6dffd60731252e4f035bc9de16fbed072fd843
1 /* { dg-do compile } */
2 /* { dg-options "-mdejagnu-cpu=power10 -O2" } */
3 /* { dg-require-effective-target powerpc_elfv2 } */
4 /* { dg-require-effective-target power10_ok } */
6 /* Test that potential sibcalls are generated when the caller does not
7 preserve the TOC, even for external calls; and that sibcalls are not
8 generated when the caller preserves the TOC but the callee does not. */
10 #pragma GCC target ("cpu=power10,pcrel")
11 int x (void) __attribute__((noipa));
12 int y (void) __attribute__((noipa));
13 int xx (void) __attribute__((noipa));
15 int x (void)
17 return 1;
20 int y (void)
22 return 2;
25 int sib_call (void)
27 return x ();
30 #pragma GCC target ("cpu=power9,no-pcrel")
31 int normal_call (void)
33 return y ();
36 int xx (void)
38 return 1;
41 extern int yy (void);
43 #pragma GCC target ("cpu=power10,pcrel")
44 int notoc_sibcall (void)
46 return xx ();
49 int extern_sibcall (void)
51 return yy ();
54 /* { dg-final { scan-assembler {\mb x@notoc\M} } } */
55 /* { dg-final { scan-assembler {\mbl y\M} } } */
56 /* { dg-final { scan-assembler {\mb xx@notoc\M} } } */
57 /* { dg-final { scan-assembler {\mb yy@notoc\M} } } */