diff options
author | Bruce Evans <bde@FreeBSD.org> | 1994-12-27 13:12:34 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 1994-12-27 13:12:34 +0000 |
commit | be0264b94536ea22c4350714554b3a1029b7c4be (patch) | |
tree | 74ea09775616dbc2ca0c3dc767edcb400f31c20e /lib/libc/i386 | |
parent | 0c4fe20e8a6963e7e1c505ac9c608ef9b9dc4f0b (diff) | |
download | src-be0264b94536ea22c4350714554b3a1029b7c4be.tar.gz src-be0264b94536ea22c4350714554b3a1029b7c4be.zip |
Fix a spelling error and add a comment about possible improvements.
Notes
Notes:
svn path=/head/; revision=5243
Diffstat (limited to 'lib/libc/i386')
-rw-r--r-- | lib/libc/i386/string/strncmp.S | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/libc/i386/string/strncmp.S b/lib/libc/i386/string/strncmp.S index a4df8025bfb5..be6319a45486 100644 --- a/lib/libc/i386/string/strncmp.S +++ b/lib/libc/i386/string/strncmp.S @@ -27,11 +27,11 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: strncmp.S,v 1.3 1994/03/31 14:11:02 davidg Exp $ + * $Id: strncmp.S,v 1.1 1994/08/05 01:18:36 wollman Exp $ */ #if defined(LIBC_RCS) && !defined(lint) - .asciz "$Id: strncmp.S,v 1.3 1994/03/31 14:11:02 davidg Exp $" + .asciz "$Id: strncmp.S,v 1.1 1994/08/05 01:18:36 wollman Exp $" #endif /* LIBC_RCS and not lint */ #include "DEFS.h" @@ -54,6 +54,8 @@ * I've unrolled the loop eight times: large enough to make a * significant difference, and small enough not to totally trash the * cache. + * + * TODO: change all the jz's back to je for consistency. */ ENTRY(strncmp) @@ -75,6 +77,18 @@ L2: jz L4 /* strings are equal */ cmpb %bl,(%ecx) jne L3 +/* + * XXX it might be best to move the next 4 instructions to the end of the + * unrolled part of the loop. The unrolled part would then be + * movb n(%eax),%bl; testb %bl, %bl; je L3; cmpb n(%ecx); jne L3 + * or maybe better + * movb n(%eax),%bl; cmpb n(%ecx); jne L3; testb %bl,%bl; je return_0 + * for n = 0, 1, ..., 8. The end of the loop would be + * L1: addl $8,%eax; addl $8,%ecx; subl $8,%edx; cmpl $8,%edx; jae Lx + * where residual counts of 0 to 7 are handled at Lx. However, this would + * be slower for short strings. Cache effects are probably not so + * important because we are only handling a byte at a time. + */ incl %eax incl %ecx decl %edx @@ -146,7 +160,7 @@ L2: jz L4 /* strings are equal */ je L1 .align 2,0x90 -L3: movzbl (%eax),%eax /* unsigned comparision */ +L3: movzbl (%eax),%eax /* unsigned comparison */ movzbl (%ecx),%ecx subl %ecx,%eax popl %ebx |