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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [memmove-2.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* Copyright (C) 2004  Free Software Foundation.
2
 
3
   Check builtin memmove and bcopy optimization when length is 1.
4
 
5
   Written by Jakub Jelinek, 9/14/2004.  */
6
 
7
extern void abort (void);
8
typedef __SIZE_TYPE__ size_t;
9
extern void *memmove (void *, const void *, size_t);
10
extern void bcopy (const void *, void *, size_t);
11
extern int memcmp (const void *, const void *, size_t);
12
 
13
char p[32] = "abcdefg";
14
char *q = p + 4;
15
 
16
void
17
main_test (void)
18
{
19
  /* memmove with length 1 can be optimized into memcpy if it can be
20
     expanded inline.  */
21
  if (memmove (p + 2, p + 3, 1) != p + 2 || memcmp (p, "abddefg", 8))
22
    abort ();
23
  if (memmove (p + 1, p + 1, 1) != p + 1 || memcmp (p, "abddefg", 8))
24
    abort ();
25
  if (memmove (q, p + 4, 1) != p + 4 || memcmp (p, "abddefg", 8))
26
    abort ();
27
  bcopy (p + 5, p + 6, 1);
28
  if (memcmp (p, "abddeff", 8))
29
    abort ();
30
  bcopy (p + 1, p + 1, 1);
31
  if (memcmp (p, "abddeff", 8))
32
    abort ();
33
  bcopy (q, p + 4, 1);
34
  if (memcmp (p, "abddeff", 8))
35
    abort ();
36
}

powered by: WebSVN 2.1.0

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