OSDN Git Service

* gcc.dg/weak/weak.exp: Simplify.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / weak / typeof-2.c
1 /* Test typeof with __asm redirection. */
2 /* { dg-do compile } */
3 /* { dg-require-weak "" } */
4 /* { dg-options "-O2" } */
5
6 extern int foo1 (int x) __asm ("baz1");
7 int bar1 (int x) { return x; }
8 extern __typeof (bar1) foo1 __attribute ((weak, alias ("bar1")));
9
10 extern int foo2 (int x) __attribute__ ((const));
11 extern __typeof (foo2) foo2 __asm ("baz2");
12 int bar2 (int x)
13 {
14   return foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x);
15 }
16
17 extern int foo3 (int x);
18 extern __typeof (foo3) foo3 __asm ("baz3");
19 int bar3 (int x)
20 {
21   return foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x);
22 }
23
24 // { dg-final { scan-assembler-not "foo1" } }
25 // { dg-final { scan-assembler "baz1" } }
26 // { dg-final { scan-assembler-not "foo2" } }
27 // { dg-final { scan-assembler "baz2" } }
28 // { dg-final { scan-assembler-not "baz2.*baz2.*baz2.*baz2.*baz2.*baz2" } }
29 // { dg-final { scan-assembler-not "foo3" } }
30 // SH targets put the funtion address into a constant pool and / or register,
31 // so it does not appear repeated (as much as expected) in the assembler.
32 // { dg-final { global target_triplet } }
33 // { dg-final { if [string match sh-*-* $target_triplet ] {return} } }
34 // { dg-final { if [string match {sh[elb1-9]*-*-*} $target_triplet ] {return} } }
35 // Likewise for S/390 targets
36 // { dg-final { if [string match s390*-*-* $target_triplet ] {return} } }
37 // { dg-final { scan-assembler "baz3.*baz3.*baz3.*baz3.*baz3.*baz3" } }