2 * Written by J.T. Conklin <jtc@acorntoolworks.com>
6 #include <machine/asm.h>
10 RCSID("$NetBSD: strcat.S,v 1.4 2004/07/26 18:51:21 drochner Exp $")
15 movabsq $0x0101010101010101,%r8
16 movabsq $0x8080808080808080,%r9
19 * Align destination to word boundary.
20 * Consider unrolling loop?
41 * In rare cases, the above loop may exit prematurely. We must
42 * return to the loop if none of the bytes in the word equal 0.
45 cmpb $0,-8(%rdi) /* 1st byte == 0? */
50 1: cmpb $0,-7(%rdi) /* 2nd byte == 0? */
55 1: cmpb $0,-6(%rdi) /* 3rd byte == 0? */
60 1: cmpb $0,-5(%rdi) /* 4th byte == 0? */
65 1: cmpb $0,-4(%rdi) /* 5th byte == 0? */
70 1: cmpb $0,-3(%rdi) /* 6th byte == 0? */
75 1: cmpb $0,-2(%rdi) /* 7th byte == 0? */
80 1: cmpb $0,-1(%rdi) /* 8th byte == 0? */
85 * Align source to a word boundary.
86 * Consider unrolling loop?
113 * In rare cases, the above loop may exit prematurely. We must
114 * return to the loop if none of the bytes in the word equal 0.
119 testb %dl,%dl /* 1st byte == 0? */
125 testb %dl,%dl /* 2nd byte == 0? */
131 testb %dl,%dl /* 3rd byte == 0? */
137 testb %dl,%dl /* 4th byte == 0? */
143 testb %dl,%dl /* 5th byte == 0? */
149 testb %dl,%dl /* 6th byte == 0? */
155 testb %dl,%dl /* 7th byte == 0? */
161 testb %dl,%dl /* 8th byte == 0? */