Annotation of kernel/machdep/ppc/libc/bcmp.s, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /* Copyright (c) 1998 Apple Computer, Inc.  All rights reserved.
                     26:  *
                     27:  *      File:  machdep/ppc/libc/bcmp.s
                     28:  *
                     29:  *     int bcmp(const void *b1, const void *b2, size_t len)
                     30:  *
                     31:  *     DESCRIPTION
                     32:  *             The bcmp() function compares byte string b1 against byte string
                     33:  *             b2, returning zero if they are identical, non-zero otherwise.
                     34:  *             Both strings are assumed to be len bytes long.
                     35:  *             Zero-length strings are always identical.
                     36:  *
                     37:  *             The strings may overlap.
                     38:  *
                     39:  * HISTORY
                     40:  *     23-Sep-1998     Umesh Vaishampayan      ([email protected])
                     41:  *             Created.
                     42:  */
                     43: 
                     44: .text
                     45: .align 4
                     46: .globl _bcmp
                     47: _bcmp:
                     48: /* Optimized the 6 byte case to improve the networking performance */
                     49:        cmpwi   r5, 6
                     50:        bne-    L_not_six
                     51:        lwz     r6, 0(r3)
                     52:        lwz     r7, 0(r4)
                     53:        lhz     r8, 4(r3)
                     54:        xor     r10, r6, r7
                     55:        lhz     r9, 4(r4)
                     56:        xor     r11, r8, r9
                     57:        or      r3, r10, r11
                     58:        blr
                     59:        nop                                             ; To align L_not_six on 4 word boundary
                     60:        nop                                             ; To align L_not_six on 4 word boundary
                     61: 
                     62: L_not_six:
                     63:        mr.     r5,r5
                     64:        beq-    L_len_zero
                     65: L_len_not_zero:
                     66:        lbz     r0,0(r3)
                     67:        lbz     r9,0(r4)
                     68:        addi    r4,r4,1
                     69:        cmpw    cr1,r0,r9
                     70:        bne-    cr1,L_done
                     71:        subi    r5, r5, 1               ; addic.  r5,r5,-1 touches xer
                     72:        addi    r3,r3,1
                     73:        mr.             r5, r5
                     74:        bne     L_len_not_zero
                     75: L_done:
                     76:        mr      r3,r5
                     77:        blr
                     78: 
                     79: L_len_zero:
                     80:        li      r3,0                    ; Zero-length strings are always identical.
                     81:        blr

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.