mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Ebbert <76306.1226@compuserve.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: [patch 2.6.17-rc5 2/2] i386 memcpy: minor optimization
Date: Tue, 30 May 2006 20:59:51 -0400	[thread overview]
Message-ID: <200605302103_MC3-1-BF0E-59C@compuserve.com> (raw)

Skip an additional instruction if memcpy size is divisible by four.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

--- 2.6.17-rc5-32.orig/include/asm-i386/string.h
+++ 2.6.17-rc5-32/include/asm-i386/string.h
@@ -203,20 +203,20 @@ return __res;
 
 static __always_inline void * __memcpy(void * to, const void * from, size_t n)
 {
-int d0, d1, d2;
+int d0, d1, d2, d3;
 __asm__ __volatile__(
 	"rep ; movsl\n\t"
-	"movl %4,%%ecx\n\t"
-	"andl $3,%%ecx\n\t"
-#if 1	/* want to pay 2 byte penalty for a chance to skip microcoded rep? */
+	"andl $3,%3\n\t"
+#if 1	/* want to pay 2 byte penalty for a chance to skip a mov and a microcoded rep? */
 	"jz 1f\n\t"
 #endif
+	"movl %3,%%ecx\n\t"
 	"rep ; movsb\n\t"
 	"1:"
-	: "=&c" (d0), "=&D" (d1), "=&S" (d2)
-	: "0" (n/4), "g" (n), "1" ((long) to), "2" ((long) from)
+	: "=&c" (d0), "=&D" (d1), "=&S" (d2), "=&g" (d3)
+	: "0" (n/4), "1" ((long) to), "2" ((long) from), "3" (n)
 	: "memory");
-return (to);
+return to;
 }
 
 /*
-- 
Chuck

                 reply	other threads:[~2006-05-31  1:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200605302103_MC3-1-BF0E-59C@compuserve.com \
    --to=76306.1226@compuserve.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®