1 /* Miscellaneous BPABI functions. ARMv6M implementation
3 Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
4 Contributed by CodeSourcery.
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
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.
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.
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 <http://www.gnu.org/licenses/>. */
26 /* Some attributes that are common to all routines in this file. */
27 /* Tag_ABI_align_needed: This code does not require 8-byte
28 alignment from the caller. */
29 /* .eabi_attribute 24, 0 -- default setting. */
30 /* Tag_ABI_align_preserved: This code preserves 8-byte
31 alignment in any callee. */
33 #endif /* __ARM_EABI__ */
60 #endif /* L_aeabi_lcmp */
64 FUNC_START aeabi_ulcmp
80 #endif /* L_aeabi_ulcmp */
82 .macro test_div_by_zero signed
91 .ifc \signed, unsigned
94 mvn xxh, xxh @ 0xffffffff
101 mvn xxl, xxl @ 0xffffffff
102 lsr xxh, xxl, #1 @ 0x7fffffff
105 lsl xxh, xxh, #24 @ 0x80000000
109 @ tailcalls are tricky on v6-m.
115 @ We know we are not on armv4t, so pop pc is safe.
119 .word __aeabi_ldiv0 - 1b
123 #ifdef L_aeabi_ldivmod
125 FUNC_START aeabi_ldivmod
126 test_div_by_zero signed
132 bl SYM(__gnu_ldivmod_helper)
138 FUNC_END aeabi_ldivmod
140 #endif /* L_aeabi_ldivmod */
142 #ifdef L_aeabi_uldivmod
144 FUNC_START aeabi_uldivmod
145 test_div_by_zero unsigned
151 bl SYM(__gnu_uldivmod_helper)
157 FUNC_END aeabi_uldivmod
159 #endif /* L_aeabi_uldivmod */
161 #ifdef L_arm_addsubsf3
163 FUNC_START aeabi_frsub
174 #endif /* L_arm_addsubsf3 */
178 FUNC_START aeabi_cfrcmple
185 FUNC_START aeabi_cfcmpeq
186 FUNC_ALIAS aeabi_cfcmple aeabi_cfcmpeq
188 @ The status-returning routines are required to preserve all
189 @ registers except ip, lr, and cpsr.
190 6: push {r0, r1, r2, r3, r4, lr}
192 @ Set the Z flag correctly, and the C flag unconditionally.
194 @ Clear the C flag if the return value was -1, indicating
195 @ that the first operand was smaller than the second.
200 pop {r0, r1, r2, r3, r4, pc}
202 FUNC_END aeabi_cfcmple
203 FUNC_END aeabi_cfcmpeq
204 FUNC_END aeabi_cfrcmple
206 FUNC_START aeabi_fcmpeq
214 FUNC_END aeabi_fcmpeq
216 .macro COMPARISON cond, helper, mode=sf2
217 FUNC_START aeabi_fcmp\cond
229 FUNC_END aeabi_fcmp\cond
237 #endif /* L_arm_cmpsf2 */
239 #ifdef L_arm_addsubdf3
241 FUNC_START aeabi_drsub
252 #endif /* L_arm_addsubdf3 */
256 FUNC_START aeabi_cdrcmple
266 FUNC_START aeabi_cdcmpeq
267 FUNC_ALIAS aeabi_cdcmple aeabi_cdcmpeq
269 @ The status-returning routines are required to preserve all
270 @ registers except ip, lr, and cpsr.
271 6: push {r0, r1, r2, r3, r4, lr}
273 @ Set the Z flag correctly, and the C flag unconditionally.
275 @ Clear the C flag if the return value was -1, indicating
276 @ that the first operand was smaller than the second.
281 pop {r0, r1, r2, r3, r4, pc}
283 FUNC_END aeabi_cdcmple
284 FUNC_END aeabi_cdcmpeq
285 FUNC_END aeabi_cdrcmple
287 FUNC_START aeabi_dcmpeq
295 FUNC_END aeabi_dcmpeq
297 .macro COMPARISON cond, helper, mode=df2
298 FUNC_START aeabi_dcmp\cond
310 FUNC_END aeabi_dcmp\cond
318 #endif /* L_arm_cmpdf2 */