| 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" } */ |
| 8 |
/* Using -mshort-calls avoids loading the function addresses in |
| 9 |
registers and thus getting the counts wrong. */ |
| 10 |
/* { dg-additional-options "-mshort-calls" { target epiphany-*-* } } */ |
| 11 |
|
| 12 |
extern int foo1 (int x) __asm ("baz1"); |
| 13 |
int bar1 (int x) { return x; } |
| 14 |
extern __typeof (bar1) foo1 __attribute ((weak, alias ("bar1"))); |
| 15 |
|
| 16 |
extern int foo2 (int x) __attribute__ ((const)); |
| 17 |
extern __typeof (foo2) foo2 __asm ("baz2"); |
| 18 |
int bar2 (int x) |
| 19 |
{ |
| 20 |
return foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x) + foo2 (x); |
| 21 |
} |
| 22 |
|
| 23 |
extern int foo3 (int x); |
| 24 |
extern __typeof (foo3) foo3 __asm ("baz3"); |
| 25 |
int bar3 (int x) |
| 26 |
{ |
| 27 |
return foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x) + foo3 (x); |
| 28 |
} |
| 29 |
|
| 30 |
// { dg-final { scan-assembler-not "foo1" } } |
| 31 |
// { dg-final { scan-assembler "baz1" } } |
| 32 |
// { dg-final { scan-assembler-not "foo2" } } |
| 33 |
// { dg-final { scan-assembler "baz2" } } |
| 34 |
// { dg-final { scan-assembler-not "baz2.*baz2.*baz2.*baz2.*baz2.*baz2" } } |
| 35 |
// { dg-final { scan-assembler-not "foo3" } } |
| 36 |
// SH targets put the function address into a constant pool and / or register, |
| 37 |
// so it does not appear repeated (as much as expected) in the assembler. |
| 38 |
// { dg-final { global target_triplet } } |
| 39 |
// { dg-final { if [string match sh-*-* $target_triplet ] {return} } } |
| 40 |
// { dg-final { if [string match {sh[elb1-9]*-*-*} $target_triplet ] {return} } } |
| 41 |
// Likewise for S/390 targets |
| 42 |
// { dg-final { if [string match s390*-*-* $target_triplet ] {return} } } |
| 43 |
// Likewise for ARM targets |
| 44 |
// { dg-final { if [string match arm*-*-* $target_triplet ] {return} } } |
| 45 |
// Likewise for CRIS targets. |
| 46 |
// { dg-final { if [string match cris-*-* $target_triplet ] {return} } } |
| 47 |
// Likewise for m68k targets. |
| 48 |
// { dg-final { if [string match fido-*-* $target_triplet ] {return} } } |
| 49 |
// { dg-final { if [string match m68k-*-* $target_triplet ] {return} } } |
| 50 |
// Likewise for moxie targets. |
| 51 |
// { dg-final { if [string match moxie-*-* $target_triplet ] {return} } } |
| 52 |
// Likewise for msp430 targets. |
| 53 |
// { dg-final { if [string match msp430-*-* $target_triplet ] {return} } } |
| 54 |
// Likewise for Visium targets. |
| 55 |
// { dg-final { if [string match visium-*-* $target_triplet ] {return} } } |
| 56 |
// { dg-final { scan-assembler "baz3.*baz3.*baz3.*baz3.*baz3.*baz3" } } |