Commit 4d14a459 authored by David S. Miller's avatar David S. Miller

sparc: Stop trying to be so fancy and use __builtin_{memcpy,memset}()

This mirrors commit ff60fab7
(x86: Use __builtin_memset and __builtin_memcpy for memset/memcpy)
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fb34035e
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
extern void __memmove(void *,const void *,__kernel_size_t); extern void __memmove(void *,const void *,__kernel_size_t);
extern __kernel_size_t __memcpy(void *,const void *,__kernel_size_t);
extern __kernel_size_t __memset(void *,int,__kernel_size_t);
#ifndef EXPORT_SYMTAB_STROPS #ifndef EXPORT_SYMTAB_STROPS
...@@ -32,82 +30,10 @@ extern __kernel_size_t __memset(void *,int,__kernel_size_t); ...@@ -32,82 +30,10 @@ extern __kernel_size_t __memset(void *,int,__kernel_size_t);
}) })
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
static inline void *__constant_memcpy(void *to, const void *from, __kernel_size_t n)
{
extern void __copy_1page(void *, const void *);
if(n <= 32) {
__builtin_memcpy(to, from, n);
} else if (((unsigned int) to & 7) != 0) {
/* Destination is not aligned on the double-word boundary */
__memcpy(to, from, n);
} else {
switch(n) {
case PAGE_SIZE:
__copy_1page(to, from);
break;
default:
__memcpy(to, from, n);
break;
}
}
return to;
}
static inline void *__nonconstant_memcpy(void *to, const void *from, __kernel_size_t n)
{
__memcpy(to, from, n);
return to;
}
#undef memcpy
#define memcpy(t, f, n) \
(__builtin_constant_p(n) ? \
__constant_memcpy((t),(f),(n)) : \
__nonconstant_memcpy((t),(f),(n)))
#define __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET
#define memset(s, c, count) __builtin_memset(s, c, count)
static inline void *__constant_c_and_count_memset(void *s, char c, __kernel_size_t count)
{
extern void bzero_1page(void *);
extern __kernel_size_t __bzero(void *, __kernel_size_t);
if(!c) {
if(count == PAGE_SIZE)
bzero_1page(s);
else
__bzero(s, count);
} else {
__memset(s, c, count);
}
return s;
}
static inline void *__constant_c_memset(void *s, char c, __kernel_size_t count)
{
extern __kernel_size_t __bzero(void *, __kernel_size_t);
if(!c)
__bzero(s, count);
else
__memset(s, c, count);
return s;
}
static inline void *__nonconstant_memset(void *s, char c, __kernel_size_t count)
{
__memset(s, c, count);
return s;
}
#undef memset
#define memset(s, c, count) \
(__builtin_constant_p(c) ? (__builtin_constant_p(count) ? \
__constant_c_and_count_memset((s), (c), (count)) : \
__constant_c_memset((s), (c), (count))) \
: __nonconstant_memset((s), (c), (count)))
#define __HAVE_ARCH_MEMSCAN #define __HAVE_ARCH_MEMSCAN
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include <asm/asi.h> #include <asm/asi.h>
extern void *__memset(void *,int,__kernel_size_t);
#ifndef EXPORT_SYMTAB_STROPS #ifndef EXPORT_SYMTAB_STROPS
/* First the mem*() things. */ /* First the mem*() things. */
...@@ -24,29 +22,10 @@ extern void *__memset(void *,int,__kernel_size_t); ...@@ -24,29 +22,10 @@ extern void *__memset(void *,int,__kernel_size_t);
extern void *memmove(void *, const void *, __kernel_size_t); extern void *memmove(void *, const void *, __kernel_size_t);
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
extern void *memcpy(void *, const void *, __kernel_size_t); #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
#define __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET
extern void *__builtin_memset(void *,int,__kernel_size_t); #define memset(s, c, count) __builtin_memset(s, c, count)
static inline void *__constant_memset(void *s, int c, __kernel_size_t count)
{
extern __kernel_size_t __bzero(void *, __kernel_size_t);
if (!c) {
__bzero(s, count);
return s;
} else
return __memset(s, c, count);
}
#undef memset
#define memset(s, c, count) \
((__builtin_constant_p(count) && (count) <= 32) ? \
__builtin_memset((s), (c), (count)) : \
(__builtin_constant_p(c) ? \
__constant_memset((s), (c), (count)) : \
__memset((s), (c), (count))))
#define __HAVE_ARCH_MEMSCAN #define __HAVE_ARCH_MEMSCAN
......
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
.text .text
.globl __memset
.type __memset, #function
__memset: /* %o0=buf, %o1=pat, %o2=len */
.globl memset .globl memset
.type memset, #function .type memset, #function
memset: /* %o0=buf, %o1=pat, %o2=len */ memset: /* %o0=buf, %o1=pat, %o2=len */
...@@ -83,7 +79,6 @@ __bzero_done: ...@@ -83,7 +79,6 @@ __bzero_done:
retl retl
mov %o3, %o0 mov %o3, %o0
.size __bzero, .-__bzero .size __bzero, .-__bzero
.size __memset, .-__memset
.size memset, .-memset .size memset, .-memset
#define EX_ST(x,y) \ #define EX_ST(x,y) \
......
...@@ -560,7 +560,7 @@ __csum_partial_copy_end: ...@@ -560,7 +560,7 @@ __csum_partial_copy_end:
mov %i0, %o1 mov %i0, %o1
mov %i1, %o0 mov %i1, %o0
5: 5:
call __memcpy call memcpy
mov %i2, %o2 mov %i2, %o2
tst %o0 tst %o0
bne,a 2f bne,a 2f
......
...@@ -30,7 +30,6 @@ EXPORT_SYMBOL(__memscan_generic); ...@@ -30,7 +30,6 @@ EXPORT_SYMBOL(__memscan_generic);
EXPORT_SYMBOL(memcmp); EXPORT_SYMBOL(memcmp);
EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memset); EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(__memset);
EXPORT_SYMBOL(memmove); EXPORT_SYMBOL(memmove);
EXPORT_SYMBOL(__bzero); EXPORT_SYMBOL(__bzero);
...@@ -81,7 +80,6 @@ EXPORT_SYMBOL(__csum_partial_copy_sparc_generic); ...@@ -81,7 +80,6 @@ EXPORT_SYMBOL(__csum_partial_copy_sparc_generic);
/* Special internal versions of library functions. */ /* Special internal versions of library functions. */
EXPORT_SYMBOL(__copy_1page); EXPORT_SYMBOL(__copy_1page);
EXPORT_SYMBOL(__memcpy);
EXPORT_SYMBOL(__memmove); EXPORT_SYMBOL(__memmove);
EXPORT_SYMBOL(bzero_1page); EXPORT_SYMBOL(bzero_1page);
......
...@@ -543,9 +543,6 @@ FUNC(memmove) ...@@ -543,9 +543,6 @@ FUNC(memmove)
b 3f b 3f
add %o0, 2, %o0 add %o0, 2, %o0
#ifdef __KERNEL__
FUNC(__memcpy)
#endif
FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ FUNC(memcpy) /* %o0=dst %o1=src %o2=len */
sub %o0, %o1, %o4 sub %o0, %o1, %o4
......
...@@ -60,11 +60,10 @@ ...@@ -60,11 +60,10 @@
.globl __bzero_begin .globl __bzero_begin
__bzero_begin: __bzero_begin:
.globl __bzero, __memset, .globl __bzero
.globl memset .globl memset
.globl __memset_start, __memset_end .globl __memset_start, __memset_end
__memset_start: __memset_start:
__memset:
memset: memset:
and %o1, 0xff, %g3 and %o1, 0xff, %g3
sll %g3, 8, %g2 sll %g3, 8, %g2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment