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-lib.c] - Blame information for rev 849

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

Line No. Rev Author Line
1 688 jeremybenn
extern void abort (void);
2
extern int inside_main;
3
typedef __SIZE_TYPE__ size_t;
4
 
5
#define TEST_ABORT if (inside_main) abort()
6
 
7
/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
8
   actually refers to this function.  See PR47181. */
9
__attribute__ ((used))
10
void *
11
my_memcpy (void *d, const void *s, size_t n)
12
{
13
  char *dst = (char *) d;
14
  const char *src = (const char *) s;
15
  while (n--)
16
    *dst++ = *src++;
17
  return (char *) d;
18
}
19
 
20
/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
21
   actually refers to this function.  See PR47181. */
22
__attribute__ ((used))
23
void
24
my_bcopy (const void *s, void *d, size_t n)
25
{
26
  char *dst = (char *) d;
27
  const char *src = (const char *) s;
28
  if (src >= dst)
29
    while (n--)
30
      *dst++ = *src++;
31
  else
32
    {
33
      dst += n;
34
      src += n;
35
      while (n--)
36
        *--dst = *--src;
37
    }
38
}
39
 
40
/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
41
   actually refers to this function.  See PR47181. */
42
__attribute__ ((used))
43
void *
44
my_memset (void *d, int c, size_t n)
45
{
46
  char *dst = (char *) d;
47
  while (n--)
48
    *dst++ = c;
49
  return (char *) d;
50
}
51
 
52
/* LTO code is at the present to able to track that asm alias my_bcopy on builtin
53
   actually refers to this function.  See PR47181. */
54
__attribute__ ((used))
55
void
56
my_bzero (void *d, size_t n)
57
{
58
  char *dst = (char *) d;
59
  while (n--)
60
    *dst++ = '\0';
61
}
62
 
63
void *
64
memcpy (void *d, const void *s, size_t n)
65
{
66
  void *result = my_memcpy (d, s, n);
67
  TEST_ABORT;
68
  return result;
69
}
70
 
71
void
72
bcopy (const void *s, void *d, size_t n)
73
{
74
  my_bcopy (s, d, n);
75
  TEST_ABORT;
76
}
77
 
78
void *
79
memset (void *d, int c, size_t n)
80
{
81
  void *result = my_memset (d, c, n);
82
  TEST_ABORT;
83
  return result;
84
}
85
 
86
void
87
bzero (void *d, size_t n)
88
{
89
  my_bzero (d, n);
90
  TEST_ABORT;
91
}
92
 
93
#ifdef __vxworks
94
/* The RTP C library uses bfill, which is defined in the same file as
95
   bzero and bcopy.  */
96
#include "lib/bfill.c"
97
#endif

powered by: WebSVN 2.1.0

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