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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [frv/] [lib1funcs.asm] - Blame information for rev 827

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Library functions.
2
   Copyright (C) 2000, 2003 Free Software Foundation, Inc.
3
   Contributed by Red Hat, Inc.
4
 
5
   This file is part of GCC.
6
 
7
   GCC is free software ; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation * either version 2, or (at your option)
10
   any later version.
11
 
12
   GCC is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY ; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with GCC; see the file COPYING.  If not, write to
19
   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20
   Boston, MA 02110-1301, USA.  */
21
 
22
/* As a special exception, if you link this library with other files,
23
   some of which are compiled with GCC, to produce an executable,
24
   this library does not by itself cause the resulting executable
25
   to be covered by the GNU General Public License.
26
   This exception does not however invalidate any other reasons why
27
   the executable file might be covered by the GNU General Public License.  */
28
 
29
#include 
30
 
31
 
32
#ifdef L_cmpll
33
/* icc0 = __cmpll (long long a, long long b)  */
34
 
35
        .file   "_cmpll.s"
36
        .globl  EXT(__cmpll)
37
        .type   EXT(__cmpll),@function
38
        .text
39
        .p2align 4
40
EXT(__cmpll):
41
        cmp     gr8, gr10, icc0
42
        ckeq    icc0, cc4
43
        P(ccmp) gr9, gr11, cc4, 1
44
        ret
45
.Lend:
46
        .size   EXT(__cmpll),.Lend-EXT(__cmpll)
47
#endif /* L_cmpll */
48
 
49
#ifdef L_cmpf
50
/* icc0 = __cmpf (float a, float b) */
51
/* Note, because this function returns the result in ICC0, it means it can't
52
   handle NaNs.  */
53
 
54
        .file   "_cmpf.s"
55
        .globl  EXT(__cmpf)
56
        .type   EXT(__cmpf),@function
57
        .text
58
        .p2align 4
59
EXT(__cmpf):
60
#ifdef __FRV_HARD_FLOAT__       /* floating point instructions available */
61
        movgf   gr8, fr0
62
        P(movgf) gr9, fr1
63
        setlos  #1, gr8
64
        fcmps   fr0, fr1, fcc0
65
        P(fcklt) fcc0, cc0
66
        fckeq   fcc0, cc1
67
        csub    gr0, gr8, gr8, cc0, 1
68
        cmov    gr0, gr8, cc1, 1
69
        cmpi    gr8, 0, icc0
70
        ret
71
#else                           /* no floating point instructions available */
72
        movsg   lr, gr4
73
        addi    sp, #-16, sp
74
        sti     gr4, @(sp, 8)
75
        st      fp, @(sp, gr0)
76
        mov     sp, fp
77
        call    EXT(__cmpsf2)
78
        cmpi    gr8, #0, icc0
79
        ldi     @(sp, 8), gr4
80
        movgs   gr4, lr
81
        ld      @(sp,gr0), fp
82
        addi    sp, #16, sp
83
        ret
84
#endif
85
.Lend:
86
        .size   EXT(__cmpf),.Lend-EXT(__cmpf)
87
#endif
88
 
89
#ifdef L_cmpd
90
/* icc0 = __cmpd (double a, double b) */
91
/* Note, because this function returns the result in ICC0, it means it can't
92
   handle NaNs.  */
93
 
94
        .file   "_cmpd.s"
95
        .globl  EXT(__cmpd)
96
        .type   EXT(__cmpd),@function
97
        .text
98
        .p2align 4
99
EXT(__cmpd):
100
        movsg   lr, gr4
101
        addi    sp, #-16, sp
102
        sti     gr4, @(sp, 8)
103
        st      fp, @(sp, gr0)
104
        mov     sp, fp
105
        call    EXT(__cmpdf2)
106
        cmpi    gr8, #0, icc0
107
        ldi     @(sp, 8), gr4
108
        movgs   gr4, lr
109
        ld      @(sp,gr0), fp
110
        addi    sp, #16, sp
111
        ret
112
.Lend:
113
        .size   EXT(__cmpd),.Lend-EXT(__cmpd)
114
#endif
115
 
116
#ifdef L_addll
117
/* gr8,gr9 = __addll (long long a, long long b) */
118
/* Note, gcc will never call this function, but it is present in case an
119
   ABI program calls it.  */
120
 
121
        .file   "_addll.s"
122
        .globl  EXT(__addll)
123
        .type   EXT(__addll),@function
124
        .text
125
        .p2align
126
EXT(__addll):
127
        addcc   gr9, gr11, gr9, icc0
128
        addx    gr8, gr10, gr8, icc0
129
        ret
130
.Lend:
131
        .size   EXT(__addll),.Lend-EXT(__addll)
132
#endif
133
 
134
#ifdef L_subll
135
/* gr8,gr9 = __subll (long long a, long long b) */
136
/* Note, gcc will never call this function, but it is present in case an
137
   ABI program calls it.  */
138
 
139
        .file   "_subll.s"
140
        .globl  EXT(__subll)
141
        .type   EXT(__subll),@function
142
        .text
143
        .p2align 4
144
EXT(__subll):
145
        subcc   gr9, gr11, gr9, icc0
146
        subx    gr8, gr10, gr8, icc0
147
        ret
148
.Lend:
149
        .size   EXT(__subll),.Lend-EXT(__subll)
150
#endif
151
 
152
#ifdef L_andll
153
/* gr8,gr9 = __andll (long long a, long long b) */
154
/* Note, gcc will never call this function, but it is present in case an
155
   ABI program calls it.  */
156
 
157
        .file   "_andll.s"
158
        .globl  EXT(__andll)
159
        .type   EXT(__andll),@function
160
        .text
161
        .p2align 4
162
EXT(__andll):
163
        P(and)  gr9, gr11, gr9
164
        P2(and) gr8, gr10, gr8
165
        ret
166
.Lend:
167
        .size   EXT(__andll),.Lend-EXT(__andll)
168
#endif
169
 
170
#ifdef L_orll
171
/* gr8,gr9 = __orll (long long a, long long b) */
172
/* Note, gcc will never call this function, but it is present in case an
173
   ABI program calls it.  */
174
 
175
        .file   "_orll.s"
176
        .globl  EXT(__orll)
177
        .type   EXT(__orll),@function
178
        .text
179
        .p2align 4
180
EXT(__orll):
181
        P(or)   gr9, gr11, gr9
182
        P2(or)  gr8, gr10, gr8
183
        ret
184
.Lend:
185
        .size   EXT(__orll),.Lend-EXT(__orll)
186
#endif
187
 
188
#ifdef L_xorll
189
/* gr8,gr9 = __xorll (long long a, long long b) */
190
/* Note, gcc will never call this function, but it is present in case an
191
   ABI program calls it.  */
192
 
193
        .file   "_xorll.s"
194
        .globl  EXT(__xorll)
195
        .type   EXT(__xorll),@function
196
        .text
197
        .p2align 4
198
EXT(__xorll):
199
        P(xor)  gr9, gr11, gr9
200
        P2(xor) gr8, gr10, gr8
201
        ret
202
.Lend:
203
        .size   EXT(__xorll),.Lend-EXT(__xorll)
204
#endif
205
 
206
#ifdef L_notll
207
/* gr8,gr9 = __notll (long long a) */
208
/* Note, gcc will never call this function, but it is present in case an
209
   ABI program calls it.  */
210
 
211
        .file   "_notll.s"
212
        .globl  EXT(__notll)
213
        .type   EXT(__notll),@function
214
        .text
215
        .p2align 4
216
EXT(__notll):
217
        P(not)  gr9, gr9
218
        P2(not) gr8, gr8
219
        ret
220
.Lend:
221
        .size   EXT(__notll),.Lend-EXT(__notll)
222
#endif
223
 
224
#ifdef L_cmov
225
/* (void) __cmov (char *dest, const char *src, size_t len) */
226
/*
227
 * void __cmov (char *dest, const char *src, size_t len)
228
 * {
229
 *   size_t i;
230
 *
231
 *   if (dest < src || dest > src+len)
232
 *     {
233
 *       for (i = 0; i < len; i++)
234
 *       dest[i] = src[i];
235
 *     }
236
 *   else
237
 *     {
238
 *       while (len-- > 0)
239
 *       dest[len] = src[len];
240
 *     }
241
 * }
242
 */
243
 
244
        .file   "_cmov.s"
245
        .globl  EXT(__cmov)
246
        .type   EXT(__cmov),@function
247
        .text
248
        .p2align 4
249
EXT(__cmov):
250
        P(cmp)  gr8, gr9, icc0
251
        add     gr9, gr10, gr4
252
        P(cmp)  gr8, gr4, icc1
253
        bc      icc0, 0, .Lfwd
254
        bls     icc1, 0, .Lback
255
.Lfwd:
256
        /* move bytes in a forward direction */
257
        P(setlos) #0, gr5
258
        cmp     gr0, gr10, icc0
259
        P(subi) gr9, #1, gr9
260
        P2(subi) gr8, #1, gr8
261
        bnc     icc0, 0, .Lret
262
.Lfloop:
263
        /* forward byte move loop */
264
        addi    gr5, #1, gr5
265
        P(ldsb) @(gr9, gr5), gr4
266
        cmp     gr5, gr10, icc0
267
        P(stb)  gr4, @(gr8, gr5)
268
        bc      icc0, 0, .Lfloop
269
        ret
270
.Lbloop:
271
        /* backward byte move loop body */
272
        ldsb    @(gr9,gr10),gr4
273
        stb     gr4,@(gr8,gr10)
274
.Lback:
275
        P(cmpi) gr10, #0, icc0
276
        addi    gr10, #-1, gr10
277
        bne     icc0, 0, .Lbloop
278
.Lret:
279
        ret
280
.Lend:
281
        .size    EXT(__cmov),.Lend-EXT(__cmov)
282
#endif

powered by: WebSVN 2.1.0

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