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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [memops-asm.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 688 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
extern int inside_main;
26
 
27
void
28
main_test (void)
29
{
30
  struct A b = a;
31
  struct A c = { { 'x' } };
32
 
33
  inside_main = 1;
34
 
35
  if (memcmp (b.c, x, 32) || c.c[0] != 'x' || memcmp (c.c + 1, x + 32, 31))
36
    abort ();
37
  if (__builtin_memcpy (y, x, i) != y || memcmp (x, y, 64))
38
    abort ();
39
  if (memcpy (y + 6, x, j) != y + 6
40
      || memcmp (x, y, 6) || memcmp (x, y + 6, 58))
41
    abort ();
42
  if (__builtin_memset (y + 2, 'X', k) != y + 2
43
      || memcmp (y, "foXXXXfoobar", 13))
44
    abort ();
45
  bcopy (y + 1, y + 2, 6);
46
  if (memcmp (y, "fooXXXXfobar", 13))
47
    abort ();
48
  __builtin_bzero (y + 4, 2);
49
  if (memcmp (y, "fooX\0\0Xfobar", 13))
50
    abort ();
51
}

powered by: WebSVN 2.1.0

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