OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [machine/] [i960/] [strpbrk.S] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
/*******************************************************************************
/*******************************************************************************
 *
 *
 * Copyright (c) 1993 Intel Corporation
 * Copyright (c) 1993 Intel Corporation
 *
 *
 * Intel hereby grants you permission to copy, modify, and distribute this
 * Intel hereby grants you permission to copy, modify, and distribute this
 * software and its documentation.  Intel grants this permission provided
 * software and its documentation.  Intel grants this permission provided
 * that the above copyright notice appears in all copies and that both the
 * that the above copyright notice appears in all copies and that both the
 * copyright notice and this permission notice appear in supporting
 * copyright notice and this permission notice appear in supporting
 * documentation.  In addition, Intel grants this permission provided that
 * documentation.  In addition, Intel grants this permission provided that
 * you prominently mark as "not part of the original" any modifications
 * you prominently mark as "not part of the original" any modifications
 * made to this software or documentation, and that the name of Intel
 * made to this software or documentation, and that the name of Intel
 * Corporation not be used in advertising or publicity pertaining to
 * Corporation not be used in advertising or publicity pertaining to
 * distribution of the software or the documentation without specific,
 * distribution of the software or the documentation without specific,
 * written prior permission.
 * written prior permission.
 *
 *
 * Intel Corporation provides this AS IS, WITHOUT ANY WARRANTY, EXPRESS OR
 * Intel Corporation provides this AS IS, WITHOUT ANY WARRANTY, EXPRESS OR
 * IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY
 * IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY
 * OR FITNESS FOR A PARTICULAR PURPOSE.  Intel makes no guarantee or
 * OR FITNESS FOR A PARTICULAR PURPOSE.  Intel makes no guarantee or
 * representations regarding the use of, or the results of the use of,
 * representations regarding the use of, or the results of the use of,
 * the software and documentation in terms of correctness, accuracy,
 * the software and documentation in terms of correctness, accuracy,
 * reliability, currentness, or otherwise; and you rely on the software,
 * reliability, currentness, or otherwise; and you rely on the software,
 * documentation and results solely at your own risk.
 * documentation and results solely at your own risk.
 *
 *
 * IN NO EVENT SHALL INTEL BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
 * IN NO EVENT SHALL INTEL BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
 * LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
 * LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
 * OF ANY KIND.  IN NO EVENT SHALL INTEL'S TOTAL LIABILITY EXCEED THE SUM
 * OF ANY KIND.  IN NO EVENT SHALL INTEL'S TOTAL LIABILITY EXCEED THE SUM
 * PAID TO INTEL FOR THE PRODUCT LICENSED HEREUNDER.
 * PAID TO INTEL FOR THE PRODUCT LICENSED HEREUNDER.
 *
 *
 ******************************************************************************/
 ******************************************************************************/
/*
/*
 * (c) copyright 1989,1993 Intel Corp., all rights reserved
 * (c) copyright 1989,1993 Intel Corp., all rights reserved
 */
 */
/*
/*
        procedure strpbrk  (optimized assembler version: 80960K series, 80960CA)
        procedure strpbrk  (optimized assembler version: 80960K series, 80960CA)
        char_addr = strpbrk (string, brkset_string)
        char_addr = strpbrk (string, brkset_string)
        Return the address of the first character in string that is NOT
        Return the address of the first character in string that is NOT
        in the brkset_string.  Return NULL if none exists.
        in the brkset_string.  Return NULL if none exists.
        At the time of this writing, only g0 thru g7 and g13 are available
        At the time of this writing, only g0 thru g7 and g13 are available
        for use in this leafproc;  other registers would have to be saved and
        for use in this leafproc;  other registers would have to be saved and
        restored.  These nine registers, plus tricky use of g14 are sufficient
        restored.  These nine registers, plus tricky use of g14 are sufficient
        to implement the routine.
        to implement the routine.
        This routine stays out of g3 and g4 altogether.  They may be used by
        This routine stays out of g3 and g4 altogether.  They may be used by
        the strtok routine, which calls this routine in an incestuous way.
        the strtok routine, which calls this routine in an incestuous way.
*/
*/
#ifdef  __PIC
#ifdef  __PIC
        .pic
        .pic
#endif
#endif
#ifdef  __PID
#ifdef  __PID
        .pid
        .pid
#endif
#endif
        .file "strprk.s"
        .file "strprk.s"
        .globl  _strpbrk
        .globl  _strpbrk
        .globl  __strpbrk
        .globl  __strpbrk
        .leafproc       _strpbrk, __strpbrk
        .leafproc       _strpbrk, __strpbrk
        .align  2
        .align  2
_strpbrk:
_strpbrk:
#ifdef __PIC
#ifdef __PIC
        lda     Lrett-(.+8)(ip),g14
        lda     Lrett-(.+8)(ip),g14
        b       __strpbrk
        b       __strpbrk
#else
#else
        lda     Lrett,g14
        lda     Lrett,g14
        b       __strpbrk
        b       __strpbrk
#endif
#endif
Lrett:  ret
Lrett:  ret
__strpbrk:
__strpbrk:
Lnext_char_strpbrk:
Lnext_char_strpbrk:
        addo    1,g1,g2         # g2 will be the brkset ptr
        addo    1,g1,g2         # g2 will be the brkset ptr
        ldob    (g0),g7         # fetch next character of string
        ldob    (g0),g7         # fetch next character of string
        ldob    (g1),g6         # fetch first character of brkset
        ldob    (g1),g6         # fetch first character of brkset
        cmpobe.f 0,g7,Lexit_char_not_found      # quit if at end of string
        cmpobe.f 0,g7,Lexit_char_not_found      # quit if at end of string
Lscan_set_strpbrk:
Lscan_set_strpbrk:
        cmpo    g6,g7           # is brkset char equal to string char?
        cmpo    g6,g7           # is brkset char equal to string char?
        ldob    (g2),g5         # fetch next brkset char
        ldob    (g2),g5         # fetch next brkset char
        addo    1,g2,g2         # bump brkset ptr
        addo    1,g2,g2         # bump brkset ptr
        be.f    Lexit_char_found
        be.f    Lexit_char_found
        cmpo    g6,0            # is brkset_string exhausted?
        cmpo    g6,0            # is brkset_string exhausted?
        lda     (g5),g6
        lda     (g5),g6
        bne.t   Lscan_set_strpbrk # check next character of brkset
        bne.t   Lscan_set_strpbrk # check next character of brkset
        addo    1,g0,g0         # check next character of string
        addo    1,g0,g0         # check next character of string
        b       Lnext_char_strpbrk
        b       Lnext_char_strpbrk
Lexit_char_not_found:
Lexit_char_not_found:
        mov     0,g0            # return null if brkset char not found in string
        mov     0,g0            # return null if brkset char not found in string
Lexit_char_found:
Lexit_char_found:
        mov     g14,g13         # save return address
        mov     g14,g13         # save return address
        lda     0,g14           # conform to register conventions
        lda     0,g14           # conform to register conventions
        bx      (g13)
        bx      (g13)
/* end of strpbrk */
/* end of strpbrk */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.