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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [config/] [arm/] [bpabi-v6m.S] - Blame information for rev 311

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

Line No. Rev Author Line
1 282 jeremybenn
/* Miscellaneous BPABI functions.  ARMv6M implementation
2
 
3
   Copyright (C) 2006, 2008, 2009  Free Software Foundation, Inc.
4
   Contributed by CodeSourcery.
5
 
6
   This file is free software; you can redistribute it and/or modify it
7
   under the terms of the GNU General Public License as published by the
8
   Free Software Foundation; either version 3, or (at your option) any
9
   later version.
10
 
11
   This file is distributed in the hope that it will be useful, but
12
   WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
   General Public License for more details.
15
 
16
   Under Section 7 of GPL version 3, you are granted additional
17
   permissions described in the GCC Runtime Library Exception, version
18
   3.1, as published by the Free Software Foundation.
19
 
20
   You should have received a copy of the GNU General Public License and
21
   a copy of the GCC Runtime Library Exception along with this program;
22
   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23
   .  */
24
 
25
#ifdef L_aeabi_lcmp
26
 
27
FUNC_START aeabi_lcmp
28
        cmp     xxh, yyh
29
        beq     1f
30
        bgt     2f
31
        mov     r0, #1
32
        neg     r0, r0
33
        RET
34
2:
35
        mov     r0, #1
36
        RET
37
1:
38
        sub     r0, xxl, yyl
39
        beq     1f
40
        bhi     2f
41
        mov     r0, #1
42
        neg     r0, r0
43
        RET
44
2:
45
        mov     r0, #1
46
1:
47
        RET
48
        FUNC_END aeabi_lcmp
49
 
50
#endif /* L_aeabi_lcmp */
51
 
52
#ifdef L_aeabi_ulcmp
53
 
54
FUNC_START aeabi_ulcmp
55
        cmp     xxh, yyh
56
        bne     1f
57
        sub     r0, xxl, yyl
58
        beq     2f
59
1:
60
        bcs     1f
61
        mov     r0, #1
62
        neg     r0, r0
63
        RET
64
1:
65
        mov     r0, #1
66
2:
67
        RET
68
        FUNC_END aeabi_ulcmp
69
 
70
#endif /* L_aeabi_ulcmp */
71
 
72
.macro test_div_by_zero signed
73
        cmp     yyh, #0
74
        bne     7f
75
        cmp     yyl, #0
76
        bne     7f
77
        cmp     xxh, #0
78
        bne     2f
79
        cmp     xxl, #0
80
2:
81
        .ifc    \signed, unsigned
82
        beq     3f
83
        mov     xxh, #0
84
        mvn     xxh, xxh                @ 0xffffffff
85
        mov     xxl, xxh
86
3:
87
        .else
88
        beq     5f
89
        blt     6f
90
        mov     xxl, #0
91
        mvn     xxl, xxl                @ 0xffffffff
92
        lsr     xxh, xxl, #1            @ 0x7fffffff
93
        b       5f
94
6:      mov     xxh, #0x80
95
        lsl     xxh, xxh, #24           @ 0x80000000
96
        mov     xxl, #0
97
5:
98
        .endif
99
        @ tailcalls are tricky on v6-m.
100
        push    {r0, r1, r2}
101
        ldr     r0, 1f
102
        adr     r1, 1f
103
        add     r0, r1
104
        str     r0, [sp, #8]
105
        @ We know we are not on armv4t, so pop pc is safe.
106
        pop     {r0, r1, pc}
107
        .align  2
108
1:
109
        .word   __aeabi_ldiv0 - 1b
110
7:
111
.endm
112
 
113
#ifdef L_aeabi_ldivmod
114
 
115
FUNC_START aeabi_ldivmod
116
        test_div_by_zero signed
117
 
118
        push {r0, r1}
119
        mov r0, sp
120
        push {r0, lr}
121
        ldr r0, [sp, #8]
122
        bl SYM(__gnu_ldivmod_helper)
123
        ldr r3, [sp, #4]
124
        mov lr, r3
125
        add sp, sp, #8
126
        pop {r2, r3}
127
        RET
128
        FUNC_END aeabi_ldivmod
129
 
130
#endif /* L_aeabi_ldivmod */
131
 
132
#ifdef L_aeabi_uldivmod
133
 
134
FUNC_START aeabi_uldivmod
135
        test_div_by_zero unsigned
136
 
137
        push {r0, r1}
138
        mov r0, sp
139
        push {r0, lr}
140
        ldr r0, [sp, #8]
141
        bl SYM(__gnu_uldivmod_helper)
142
        ldr r3, [sp, #4]
143
        mov lr, r3
144
        add sp, sp, #8
145
        pop {r2, r3}
146
        RET
147
        FUNC_END aeabi_uldivmod
148
 
149
#endif /* L_aeabi_uldivmod */
150
 
151
#ifdef L_arm_addsubsf3
152
 
153
FUNC_START aeabi_frsub
154
 
155
      push      {r4, lr}
156
      mov       r4, #1
157
      lsl       r4, #31
158
      eor       r0, r0, r4
159
      bl        __aeabi_fadd
160
      pop       {r4, pc}
161
 
162
      FUNC_END aeabi_frsub
163
 
164
#endif /* L_arm_addsubsf3 */
165
 
166
#ifdef L_arm_cmpsf2
167
 
168
FUNC_START aeabi_cfrcmple
169
 
170
        mov     ip, r0
171
        mov     r0, r1
172
        mov     r1, ip
173
        b       6f
174
 
175
FUNC_START aeabi_cfcmpeq
176
FUNC_ALIAS aeabi_cfcmple aeabi_cfcmpeq
177
 
178
        @ The status-returning routines are required to preserve all
179
        @ registers except ip, lr, and cpsr.
180
6:      push    {r0, r1, r2, r3, r4, lr}
181
        bl      __lesf2
182
        @ Set the Z flag correctly, and the C flag unconditionally.
183
        cmp     r0, #0
184
        @ Clear the C flag if the return value was -1, indicating
185
        @ that the first operand was smaller than the second.
186
        bmi 1f
187
        mov     r1, #0
188
        cmn     r0, r1
189
1:
190
        pop     {r0, r1, r2, r3, r4, pc}
191
 
192
        FUNC_END aeabi_cfcmple
193
        FUNC_END aeabi_cfcmpeq
194
        FUNC_END aeabi_cfrcmple
195
 
196
FUNC_START      aeabi_fcmpeq
197
 
198
        push    {r4, lr}
199
        bl      __eqsf2
200
        neg     r0, r0
201
        add     r0, r0, #1
202
        pop     {r4, pc}
203
 
204
        FUNC_END aeabi_fcmpeq
205
 
206
.macro COMPARISON cond, helper, mode=sf2
207
FUNC_START      aeabi_fcmp\cond
208
 
209
        push    {r4, lr}
210
        bl      __\helper\mode
211
        cmp     r0, #0
212
        b\cond  1f
213
        mov     r0, #0
214
        pop     {r4, pc}
215
1:
216
        mov     r0, #1
217
        pop     {r4, pc}
218
 
219
        FUNC_END aeabi_fcmp\cond
220
.endm
221
 
222
COMPARISON lt, le
223
COMPARISON le, le
224
COMPARISON gt, ge
225
COMPARISON ge, ge
226
 
227
#endif /* L_arm_cmpsf2 */
228
 
229
#ifdef L_arm_addsubdf3
230
 
231
FUNC_START aeabi_drsub
232
 
233
      push      {r4, lr}
234
      mov       r4, #1
235
      lsl       r4, #31
236
      eor       xxh, xxh, r4
237
      bl        __aeabi_dadd
238
      pop       {r4, pc}
239
 
240
      FUNC_END aeabi_drsub
241
 
242
#endif /* L_arm_addsubdf3 */
243
 
244
#ifdef L_arm_cmpdf2
245
 
246
FUNC_START aeabi_cdrcmple
247
 
248
        mov     ip, r0
249
        mov     r0, r2
250
        mov     r2, ip
251
        mov     ip, r1
252
        mov     r1, r3
253
        mov     r3, ip
254
        b       6f
255
 
256
FUNC_START aeabi_cdcmpeq
257
FUNC_ALIAS aeabi_cdcmple aeabi_cdcmpeq
258
 
259
        @ The status-returning routines are required to preserve all
260
        @ registers except ip, lr, and cpsr.
261
6:      push    {r0, r1, r2, r3, r4, lr}
262
        bl      __ledf2
263
        @ Set the Z flag correctly, and the C flag unconditionally.
264
        cmp     r0, #0
265
        @ Clear the C flag if the return value was -1, indicating
266
        @ that the first operand was smaller than the second.
267
        bmi 1f
268
        mov     r1, #0
269
        cmn     r0, r1
270
1:
271
        pop     {r0, r1, r2, r3, r4, pc}
272
 
273
        FUNC_END aeabi_cdcmple
274
        FUNC_END aeabi_cdcmpeq
275
        FUNC_END aeabi_cdrcmple
276
 
277
FUNC_START      aeabi_dcmpeq
278
 
279
        push    {r4, lr}
280
        bl      __eqdf2
281
        neg     r0, r0
282
        add     r0, r0, #1
283
        pop     {r4, pc}
284
 
285
        FUNC_END aeabi_dcmpeq
286
 
287
.macro COMPARISON cond, helper, mode=df2
288
FUNC_START      aeabi_dcmp\cond
289
 
290
        push    {r4, lr}
291
        bl      __\helper\mode
292
        cmp     r0, #0
293
        b\cond  1f
294
        mov     r0, #0
295
        pop     {r4, pc}
296
1:
297
        mov     r0, #1
298
        pop     {r4, pc}
299
 
300
        FUNC_END aeabi_dcmp\cond
301
.endm
302
 
303
COMPARISON lt, le
304
COMPARISON le, le
305
COMPARISON gt, ge
306
COMPARISON ge, ge
307
 
308
#endif /* L_arm_cmpdf2 */

powered by: WebSVN 2.1.0

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