Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245519
b: refs/heads/master
c: 057e05c
h: refs/heads/master
i:
  245517: fa9c3c7
  245515: 78df506
  245511: c43269d
  245503: 0ddf95c
v: v3
  • Loading branch information
Fenghua Yu authored and H. Peter Anvin committed May 17, 2011
1 parent 251fbaf commit ea8f3b0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 101068c1f4a947ffa08f2782c78e40097300754d
refs/heads/master: 057e05c1d6440117875f455e59da8691e08f65d5
29 changes: 28 additions & 1 deletion trunk/arch/x86/lib/memmove_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define _STRING_C
#include <linux/linkage.h>
#include <asm/dwarf2.h>
#include <asm/cpufeature.h>

#undef memmove

Expand All @@ -24,15 +25,21 @@
*/
ENTRY(memmove)
CFI_STARTPROC

/* Handle more 32bytes in loop */
mov %rdi, %rax
cmp $0x20, %rdx
jb 1f

/* Decide forward/backward copy mode */
cmp %rdi, %rsi
jb 2f
jge .Lmemmove_begin_forward
mov %rsi, %r8
add %rdx, %r8
cmp %rdi, %r8
jg 2f

.Lmemmove_begin_forward:
/*
* movsq instruction have many startup latency
* so we handle small size by general register.
Expand Down Expand Up @@ -78,6 +85,8 @@ ENTRY(memmove)
rep movsq
movq %r11, (%r10)
jmp 13f
.Lmemmove_end_forward:

/*
* Handle data backward by movsq.
*/
Expand Down Expand Up @@ -194,4 +203,22 @@ ENTRY(memmove)
13:
retq
CFI_ENDPROC

.section .altinstr_replacement,"ax"
.Lmemmove_begin_forward_efs:
/* Forward moving data. */
movq %rdx, %rcx
rep movsb
retq
.Lmemmove_end_forward_efs:
.previous

.section .altinstructions,"a"
.align 8
.quad .Lmemmove_begin_forward
.quad .Lmemmove_begin_forward_efs
.word X86_FEATURE_ERMS
.byte .Lmemmove_end_forward-.Lmemmove_begin_forward
.byte .Lmemmove_end_forward_efs-.Lmemmove_begin_forward_efs
.previous
ENDPROC(memmove)

0 comments on commit ea8f3b0

Please sign in to comment.