2 * Written by J.T. Conklin <jtc@acorntoolworks.com>
6 #include <machine/asm.h>
9 RCSID("$NetBSD: strcat.S,v 1.1 2005/12/20 19:28:51 christos Exp $")
14 movabsq $0x0101010101010101,%r8
15 movabsq $0x8080808080808080,%r9
18 * Align destination to word boundary.
19 * Consider unrolling loop?
40 * In rare cases, the above loop may exit prematurely. We must
41 * return to the loop if none of the bytes in the word equal 0.
44 cmpb $0,-8(%rdi) /* 1st byte == 0? */
49 1: cmpb $0,-7(%rdi) /* 2nd byte == 0? */
54 1: cmpb $0,-6(%rdi) /* 3rd byte == 0? */
59 1: cmpb $0,-5(%rdi) /* 4th byte == 0? */
64 1: cmpb $0,-4(%rdi) /* 5th byte == 0? */
69 1: cmpb $0,-3(%rdi) /* 6th byte == 0? */
74 1: cmpb $0,-2(%rdi) /* 7th byte == 0? */
79 1: cmpb $0,-1(%rdi) /* 8th byte == 0? */
84 * Align source to a word boundary.
85 * Consider unrolling loop?
112 * In rare cases, the above loop may exit prematurely. We must
113 * return to the loop if none of the bytes in the word equal 0.
118 testb %dl,%dl /* 1st byte == 0? */
124 testb %dl,%dl /* 2nd byte == 0? */
130 testb %dl,%dl /* 3rd byte == 0? */
136 testb %dl,%dl /* 4th byte == 0? */
142 testb %dl,%dl /* 5th byte == 0? */
148 testb %dl,%dl /* 6th byte == 0? */
154 testb %dl,%dl /* 7th byte == 0? */
160 testb %dl,%dl /* 8th byte == 0? */