| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
/* On MIPS, disable generating hints (R_MIPS_JALR) for PIC calls. In addition |
| 5 |
to the load from the GOT this also contains the name of the function so for |
| 6 |
each call the function name would appear twice. */ |
| 7 |
/* { dg-options "-O2 -mno-relax-pic-calls" { target mips*-*-* } } */ |
| 8 |
/* For epiphany, use -mshort-calls to avoid loading the address in two |
| 9 |
steps using lowpart and highpart. */ |
| 10 |
/* { dg-options "-O2 -mshort-calls" { target epiphany-*-* } } */ |
| 11 |
|
| 12 |
extern void *memset (void *, int, __SIZE_TYPE__); |
| 13 |
extern __SIZE_TYPE__ strlen (const char *); |
| 14 |
|
| 15 |
int |
| 16 |
main (int argc, char **argv) |
| 17 |
{ |
| 18 |
char x[8] = "abc"; |
| 19 |
memset (x, argc, strlen (x)); |
| 20 |
return 0; |
| 21 |
} |
| 22 |
/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen" { target { ! { powerpc*-*-darwin* hppa*-*-hpux* ia64-*-hpux* alpha*-*-* tic6x-*-* } } } } } */ |
| 23 |
/* hppa*-*-hpux* has an IMPORT statement for strlen (plus the branch). */ |
| 24 |
/* *-*-darwin* has something similar. */ |
| 25 |
/* tic6x emits a comment at the point where the delayed branch happens. */ |
| 26 |
/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen" { target hppa*-*-hpux* tic6x-*-* } } } */ |
| 27 |
/* { dg-final { scan-assembler-not "(?n)bl L_strlen\(.*\n\)+.*bl L_strlen" { target powerpc*-*-darwin* } } } */ |
| 28 |
/* ia64-*-hpux* has a global statement, a type statement, and the branch. */ |
| 29 |
/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen" { target ia64-*-hpux* } } } */ |
| 30 |
/* alpha-*-* has a GOT load and the call. */ |
| 31 |
/* { dg-final { scan-assembler-not "(?n)jsr .*,strlen\(.*\n\)+.*jsr .*,strlen" { target alpha*-*-* } } } */ |