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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [memops-asm.c] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2003 Free Software Foundation.
2
 
3
   Test memcpy and memset in presence of redirect.  */
4
 
5
#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
6
#define ASMNAME2(prefix, cname) STRING (prefix) cname
7
#define STRING(x)    #x
8
 
9
typedef __SIZE_TYPE__ size_t;
10
extern void abort (void);
11
extern void *memcpy (void *, const void *, size_t)
12
  __asm (ASMNAME ("my_memcpy"));
13
extern void bcopy (const void *, void *, size_t)
14
  __asm (ASMNAME ("my_bcopy"));
15
extern void *memset (void *, int, size_t)
16
  __asm (ASMNAME ("my_memset"));
17
extern void bzero (void *, size_t)
18
  __asm (ASMNAME ("my_bzero"));
19
extern int memcmp (const void *, const void *, size_t);
20
 
21
struct A { char c[32]; } a = { "foobar" };
22
char x[64] = "foobar", y[64];
23
int i = 39, j = 6, k = 4;
24
 
25
void
26
main_test (void)
27
{
28
  struct A b = a;
29
  struct A c = { { 'x' } };
30
 
31
  if (memcmp (b.c, x, 32) || c.c[0] != 'x' || memcmp (c.c + 1, x + 32, 31))
32
    abort ();
33
  if (__builtin_memcpy (y, x, i) != y || memcmp (x, y, 64))
34
    abort ();
35
  if (memcpy (y + 6, x, j) != y + 6
36
      || memcmp (x, y, 6) || memcmp (x, y + 6, 58))
37
    abort ();
38
  if (__builtin_memset (y + 2, 'X', k) != y + 2
39
      || memcmp (y, "foXXXXfoobar", 13))
40
    abort ();
41
  bcopy (y + 1, y + 2, 6);
42
  if (memcmp (y, "fooXXXXfobar", 13))
43
    abort ();
44
  __builtin_bzero (y + 4, 2);
45
  if (memcmp (y, "fooX\0\0Xfobar", 13))
46
    abort ();
47
}

powered by: WebSVN 2.1.0

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