Subject: port-i386/8452: memchr micro-optimization for i386
To: None <>
From: None <>
List: netbsd-bugs
Date: 09/20/1999 11:05:51
>Number:         8452
>Category:       port-i386
>Synopsis:       memchr micro-optimization for i386
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-i386-maintainer (NetBSD/i386 Portmaster)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 20 11:05:00 1999
>Originator:     Robert Byrnes
Curl Corporation
>Release:        NetBSD-1.4.1

In  lib/libc/arch/i386/string/memchr.S
and sys/lib/libkern/arch/i386/memchr.S,
the instructions ...

        testl   %ecx,%ecx               /* test for len == 0 */
        jz      L1

can be replaced with ...

        jecxz   L1                      /* test for len == 0 */

The only difference is the side effect of setting the condition codes,
but those aren't used, as far as I can tell.

Use jecxz.