1 /* Miscellaneous BPABI functions. Thumb-1 implementation, suitable for ARMv4T,
2 ARMv6-M and ARMv8-M Baseline like ISA variants.
4 Copyright (C) 2006-2023 Free Software Foundation, Inc.
5 Contributed by CodeSourcery.
7 This file is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3, or (at your option) any
12 This file is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
27 /* Some attributes that are common to all routines in this file. */
28 /* Tag_ABI_align_needed: This code does not require 8-byte
29 alignment from the caller. */
30 /* .eabi_attribute 24, 0 -- default setting. */
31 /* Tag_ABI_align_preserved: This code preserves 8-byte
32 alignment in any callee. */
34 #endif /* __ARM_EABI__ */
61 #endif /* L_aeabi_lcmp */
65 FUNC_START aeabi_ulcmp
81 #endif /* L_aeabi_ulcmp */
83 .macro test_div_by_zero signed
89 .ifc \signed, unsigned
95 mvns xxh, xxh @ 0xffffffff
104 mvns xxl, xxl @ 0xffffffff
105 lsrs xxh, xxl, #1 @ 0x7fffffff
108 lsls xxh, xxh, #24 @ 0x80000000
112 @ tailcalls are tricky on v6-m.
118 @ We know we are not on armv4t, so pop pc is safe.
122 .word __aeabi_ldiv0 - 1b
126 #ifdef L_aeabi_ldivmod
128 FUNC_START aeabi_ldivmod
129 test_div_by_zero signed
135 bl SYM(__gnu_ldivmod_helper)
141 FUNC_END aeabi_ldivmod
143 #endif /* L_aeabi_ldivmod */
145 #ifdef L_aeabi_uldivmod
147 FUNC_START aeabi_uldivmod
148 test_div_by_zero unsigned
160 FUNC_END aeabi_uldivmod
162 #endif /* L_aeabi_uldivmod */
164 #ifdef L_arm_addsubsf3
166 FUNC_START aeabi_frsub
177 #endif /* L_arm_addsubsf3 */
181 FUNC_START aeabi_cfrcmple
188 FUNC_START aeabi_cfcmpeq
189 FUNC_ALIAS aeabi_cfcmple aeabi_cfcmpeq
191 @ The status-returning routines are required to preserve all
192 @ registers except ip, lr, and cpsr.
193 6: push {r0, r1, r2, r3, r4, lr}
195 @ Set the Z flag correctly, and the C flag unconditionally.
197 @ Clear the C flag if the return value was -1, indicating
198 @ that the first operand was smaller than the second.
203 pop {r0, r1, r2, r3, r4, pc}
205 FUNC_END aeabi_cfcmple
206 FUNC_END aeabi_cfcmpeq
207 FUNC_END aeabi_cfrcmple
209 FUNC_START aeabi_fcmpeq
217 FUNC_END aeabi_fcmpeq
219 .macro COMPARISON cond, helper, mode=sf2
220 FUNC_START aeabi_fcmp\cond
232 FUNC_END aeabi_fcmp\cond
240 #endif /* L_arm_cmpsf2 */
242 #ifdef L_arm_addsubdf3
244 FUNC_START aeabi_drsub
255 #endif /* L_arm_addsubdf3 */
259 FUNC_START aeabi_cdrcmple
269 FUNC_START aeabi_cdcmpeq
270 FUNC_ALIAS aeabi_cdcmple aeabi_cdcmpeq
272 @ The status-returning routines are required to preserve all
273 @ registers except ip, lr, and cpsr.
274 6: push {r0, r1, r2, r3, r4, lr}
276 @ Set the Z flag correctly, and the C flag unconditionally.
278 @ Clear the C flag if the return value was -1, indicating
279 @ that the first operand was smaller than the second.
284 pop {r0, r1, r2, r3, r4, pc}
286 FUNC_END aeabi_cdcmple
287 FUNC_END aeabi_cdcmpeq
288 FUNC_END aeabi_cdrcmple
290 FUNC_START aeabi_dcmpeq
298 FUNC_END aeabi_dcmpeq
300 .macro COMPARISON cond, helper, mode=df2
301 FUNC_START aeabi_dcmp\cond
313 FUNC_END aeabi_dcmp\cond
321 #endif /* L_arm_cmpdf2 */