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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [i960/] [strcspn.S] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*******************************************************************************
2
 *
3
 * Copyright (c) 1993 Intel Corporation
4
 *
5
 * Intel hereby grants you permission to copy, modify, and distribute this
6
 * software and its documentation.  Intel grants this permission provided
7
 * that the above copyright notice appears in all copies and that both the
8
 * copyright notice and this permission notice appear in supporting
9
 * documentation.  In addition, Intel grants this permission provided that
10
 * you prominently mark as "not part of the original" any modifications
11
 * made to this software or documentation, and that the name of Intel
12
 * Corporation not be used in advertising or publicity pertaining to
13
 * distribution of the software or the documentation without specific,
14
 * written prior permission.
15
 *
16
 * Intel Corporation provides this AS IS, WITHOUT ANY WARRANTY, EXPRESS OR
17
 * IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY
18
 * OR FITNESS FOR A PARTICULAR PURPOSE.  Intel makes no guarantee or
19
 * representations regarding the use of, or the results of the use of,
20
 * the software and documentation in terms of correctness, accuracy,
21
 * reliability, currentness, or otherwise; and you rely on the software,
22
 * documentation and results solely at your own risk.
23
 *
24
 * IN NO EVENT SHALL INTEL BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
25
 * LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
26
 * OF ANY KIND.  IN NO EVENT SHALL INTEL'S TOTAL LIABILITY EXCEED THE SUM
27
 * PAID TO INTEL FOR THE PRODUCT LICENSED HEREUNDER.
28
 *
29
 ******************************************************************************/
30
 
31
        .file "strcspn.s"
32
#ifdef  __PIC
33
        .pic
34
#endif
35
#ifdef  __PID
36
        .pid
37
#endif
38
/*
39
 * (c) copyright 1989,1993 Intel Corp., all rights reserved
40
 */
41
 
42
/*
43
        procedure strcspn  (optimized assembler version: 80960K series, 80960CA)
44
 
45
        len = strcspn (string, charset)
46
 
47
        Return the number of characters in the maximum leading segment
48
        of string which consists solely of characters NOT from charset.
49
 
50
        At the time of this writing, only g0 thru g7 and g13 are available
51
        for use in this leafproc;  other registers would have to be saved and
52
        restored.  These nine registers, plus tricky use of g14 are sufficient
53
        to implement the routine.
54
*/
55
 
56
        .globl  _strcspn
57
        .globl  __strcspn
58
        .leafproc       _strcspn, __strcspn
59
        .align  2
60
 
61
_strcspn:
62
#ifndef __PIC
63
        lda     Lrett,g14
64
#else
65
        lda     Lrett-(.+8)(ip),g14
66
#endif
67
__strcspn:
68
        mov     g14,g13         # save return address
69
         lda    (g0),g3         # copy string pointer
70
        mov     0,g14           # conform to register conventions
71
 
72
Lnext_char:
73
        ldob    (g3),g7         # fetch next character of string
74
        addo    1,g1,g2         # g2 will be the charset ptr
75
        ldob    (g1),g6         # fetch first character of charset
76
        cmpobe.f 0,g7,Lexit     # quit if at end of string
77
Lscan_set:
78
        cmpo    g6,g7           # is charset char same as string char?
79
        ldob    (g2),g5         # fetch next charset char
80
        addo    1,g2,g2         # bump charset ptr
81
        be.f    Lexit
82
        cmpo    g6,0            # is charset exhausted?
83
        lda     (g5),g6
84
        bne.t   Lscan_set       # check next character of charset
85
        addo    1,g3,g3         # check next character of string
86
        b       Lnext_char
87
 
88
Lexit:
89
        subo    g0,g3,g0        # compute string length
90
        bx      (g13)
91
Lrett:
92
        ret
93
 
94
/* end of strcspn */

powered by: WebSVN 2.1.0

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