Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gcc.dg / weak / typeof-2.c
blob31d577fcc4e4f26aeece601c447b8b298d5f8f32
1 /* Test typeof with __asm redirection. */
2 /* { dg-do compile } */
3 /* -mlongcall will cause us to place &baz3 in the CTR register. */
4 /* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
5 /* { dg-require-weak "" } */
6 /* { dg-require-alias "" } */
7 /* { dg-options "-O2" } */
9 extern int foo1 (int x) __asm ("baz1");
10 int bar1 (int x) { return x; }
11 extern __typeof (bar1) foo1 __attribute ((weak, alias ("bar1")));
13 extern int foo2 (int x) __attribute__ ((const));
14 extern __typeof (foo2) foo2 __asm ("baz2");
15 int bar2 (int x)
17 return foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x);
20 extern int foo3 (int x);
21 extern __typeof (foo3) foo3 __asm ("baz3");
22 int bar3 (int x)
24 return foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x);
27 // { dg-final { scan-assembler-not "foo1" } }
28 // { dg-final { scan-assembler "baz1" } }
29 // { dg-final { scan-assembler-not "foo2" } }
30 // { dg-final { scan-assembler "baz2" } }
31 // { dg-final { scan-assembler-not "baz2.*baz2.*baz2.*baz2.*baz2.*baz2" } }
32 // { dg-final { scan-assembler-not "foo3" } }
33 // SH targets put the funtion address into a constant pool and / or register,
34 // so it does not appear repeated (as much as expected) in the assembler.
35 // { dg-final { global target_triplet } }
36 // { dg-final { if [string match sh-*-* $target_triplet ] {return} } }
37 // { dg-final { if [string match {sh[elb1-9]*-*-*} $target_triplet ] {return} } }
38 // Likewise for S/390 targets
39 // { dg-final { if [string match s390*-*-* $target_triplet ] {return} } }
40 // Likewise for CRIS targets.
41 // { dg-final { if [string match cris-*-* $target_triplet ] {return} } }
42 // Likewise for m68k targets.
43 // { dg-final { if [string match fido-*-* $target_triplet ] {return} } }
44 // { dg-final { if [string match m68k-*-* $target_triplet ] {return} } }
45 // { dg-final { scan-assembler "baz3.*baz3.*baz3.*baz3.*baz3.*baz3" } }