Skip to content

Commit

Permalink
powerpc: Remove assembly versions of strcpy, strcat, strlen and strcmp
Browse files Browse the repository at this point in the history
A number of our assembly implementations of string functions do not
align their hot loops. I was going to align them manually, but I
realised that they are are almost instruction for instruction
identical to what gcc produces, with the advantage that gcc does
align them.

In light of that, let's just remove the assembly versions.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Anton Blanchard authored and Michael Ellerman committed Jun 14, 2016
1 parent d96f234 commit 3ece166
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 49 deletions.
4 changes: 0 additions & 4 deletions arch/powerpc/include/asm/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@

#ifdef __KERNEL__

#define __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRNCPY
#define __HAVE_ARCH_STRLEN
#define __HAVE_ARCH_STRCMP
#define __HAVE_ARCH_STRNCMP
#define __HAVE_ARCH_STRCAT
#define __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMMOVE
Expand Down
4 changes: 0 additions & 4 deletions arch/powerpc/lib/ppc_ksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ EXPORT_SYMBOL(memmove);
EXPORT_SYMBOL(memcmp);
EXPORT_SYMBOL(memchr);

EXPORT_SYMBOL(strcpy);
EXPORT_SYMBOL(strncpy);
EXPORT_SYMBOL(strcat);
EXPORT_SYMBOL(strlen);
EXPORT_SYMBOL(strcmp);
EXPORT_SYMBOL(strncmp);

#ifndef CONFIG_GENERIC_CSUM
Expand Down
41 changes: 0 additions & 41 deletions arch/powerpc/lib/string.S
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@
PPC_LONG_ALIGN
.text

_GLOBAL(strcpy)
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r0,1(r4)
cmpwi 0,r0,0
stbu r0,1(r5)
bne 1b
blr

/* This clears out any unused part of the destination buffer,
just as the libc version does. -- paulus */
_GLOBAL(strncpy)
Expand All @@ -45,30 +36,6 @@ _GLOBAL(strncpy)
bdnz 2b
blr

_GLOBAL(strcat)
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r0,1(r5)
cmpwi 0,r0,0
bne 1b
addi r5,r5,-1
1: lbzu r0,1(r4)
cmpwi 0,r0,0
stbu r0,1(r5)
bne 1b
blr

_GLOBAL(strcmp)
addi r5,r3,-1
addi r4,r4,-1
1: lbzu r3,1(r5)
cmpwi 1,r3,0
lbzu r0,1(r4)
subf. r3,r0,r3
beqlr 1
beq 1b
blr

_GLOBAL(strncmp)
PPC_LCMPI 0,r5,0
beq- 2f
Expand All @@ -85,14 +52,6 @@ _GLOBAL(strncmp)
2: li r3,0
blr

_GLOBAL(strlen)
addi r4,r3,-1
1: lbzu r0,1(r4)
cmpwi 0,r0,0
bne 1b
subf r3,r3,r4
blr

#ifdef CONFIG_PPC32
_GLOBAL(memcmp)
PPC_LCMPI 0,r5,0
Expand Down

0 comments on commit 3ece166

Please sign in to comment.