OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [strlenopt-16g.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* This test needs runtime that provides stpcpy function.  */
2
/* { dg-do run { target *-*-linux* } } */
3
/* { dg-options "-O2 -fdump-tree-strlen" } */
4
 
5
#define USE_GNU
6
#include "strlenopt.h"
7
 
8
__attribute__((noinline, noclone)) char *
9
fn1 (char *p, const char *q)
10
{
11
  /* This strcpy can be optimized into stpcpy.  */
12
  strcpy (p, q);
13
  /* And this strchr into the return value from it.  */
14
  return strchr (p, '\0');
15
}
16
 
17
int
18
main ()
19
{
20
  char buf[64];
21
  const char *volatile q = "ABCDEFGH";
22
  if (fn1 (buf, q) != buf + 8 || memcmp (buf, "ABCDEFGH", 9) != 0)
23
    abort ();
24
  return 0;
25
}
26
 
27
/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */
28
/* { dg-final { scan-tree-dump-times "memcpy \\(" 0 "strlen" } } */
29
/* { dg-final { scan-tree-dump-times "mempcpy \\(" 0 "strlen" } } */
30
/* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */
31
/* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */
32
/* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */
33
/* { dg-final { scan-tree-dump-times "stpcpy \\(" 1 "strlen" } } */
34
/* { dg-final { cleanup-tree-dump "strlen" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.