summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2005-04-10 18:12:07 +0000
committeralc <alc@FreeBSD.org>2005-04-10 18:12:07 +0000
commit420be8df92533bfbd56861dada670045720ba633 (patch)
tree42943daf777a27a748439ed3aa93f02cca498624 /lib
parent91d6fda379eabbbbfdb059bb61f80193ae316749 (diff)
downloadFreeBSD-src-420be8df92533bfbd56861dada670045720ba633.zip
FreeBSD-src-420be8df92533bfbd56861dada670045720ba633.tar.gz
Eliminate a conditional branch and as a side-effect eliminate a branch to
a return instruction. (The latter is discouraged by the Opteron optimization manual because it disables branch prediction for the return instruction.) Reviewed by: bde
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/amd64/string/bcmp.S9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libc/amd64/string/bcmp.S b/lib/libc/amd64/string/bcmp.S
index bb72035..36a0c7e 100644
--- a/lib/libc/amd64/string/bcmp.S
+++ b/lib/libc/amd64/string/bcmp.S
@@ -6,7 +6,6 @@ __FBSDID("$FreeBSD$");
#endif
ENTRY(bcmp)
- xorl %eax,%eax /* clear return value */
cld /* set compare direction forward */
movq %rdx,%rcx /* compare by words */
@@ -19,7 +18,7 @@ ENTRY(bcmp)
andq $7,%rcx
repe
cmpsb
- je L2
-
-L1: incl %eax
-L2: ret
+L1:
+ setne %al
+ movsbl %al,%eax
+ ret
OpenPOWER on IntegriCloud