[PATCH] x86_64/__iowrite32_copy: don't use string move for PIO writes

From: John Gregor
Date: Mon Jul 06 2009 - 15:20:58 EST


From: John Gregor <johng@xxxxxxxxxxxxxxxxxxxxx>

Some processors can write the same word more than once if the movs
instruction is used. This version uses normal memory move instructions
and gets the same performance since the speed is limited by PCIe and
write combining.

Signed-off-by: Ralph Campbell <ralph.campbell@xxxxxxxxxx>
Signed-off-by: John Gregor <john.gregor@xxxxxxxxxx>
---
arch/x86/lib/iomap_copy_64.S | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/iomap_copy_64.S b/arch/x86/lib/iomap_copy_64.S
index 05a95e7..344b00e 100644
--- a/arch/x86/lib/iomap_copy_64.S
+++ b/arch/x86/lib/iomap_copy_64.S
@@ -1,4 +1,5 @@
/*
+ * Copyright 2009 QLogic Corporation. All rights reserved.
* Copyright 2006 PathScale, Inc. All Rights Reserved.
*
* This file is free software; you can redistribute it and/or modify
@@ -23,8 +24,23 @@
*/
ENTRY(__iowrite32_copy)
CFI_STARTPROC
- movl %edx,%ecx
- rep movsd
+ movl %edx, %ecx
+ andl $-2, %edx
+ je .L2
+ leaq (%rsi,%rdx,4), %rdx
+.L1:
+ movq (%rsi), %rax
+ addq $8, %rsi
+ movq %rax, (%rdi)
+ addq $8, %rdi
+ cmpq %rsi, %rdx
+ ja .L1
+.L2:
+ bt $0, %ecx
+ jae .L4
+ movl (%rsi), %eax
+ movl %eax, (%rdi)
+.L4:
ret
CFI_ENDPROC
ENDPROC(__iowrite32_copy)
--
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/