1 #------------------------------------------------------------------------------
3 # Replacement for Math64.c that is coded to use older GCC intrinsics.
4 # Doing this reduces the number of intrinsics that are required when
5 # you port to a new version of gcc.
7 # Need to split this into multple files to size optimize the image.
9 # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
10 # SPDX-License-Identifier: BSD-2-Clause-Patent
12 #------------------------------------------------------------------------------
16 GCC_ASM_EXPORT(InternalMathLShiftU64)
18 ASM_PFX(InternalMathLShiftU64):
19 stmfd sp!, {r4, r5, r6}
24 orr r4, r4, r0, lsr ip
30 ldmfd sp!, {r4, r5, r6}
34 GCC_ASM_EXPORT(InternalMathRShiftU64)
36 ASM_PFX(InternalMathRShiftU64):
37 stmfd sp!, {r4, r5, r6}
42 orr r3, r3, r1, asl ip
48 ldmfd sp!, {r4, r5, r6}
52 GCC_ASM_EXPORT(InternalMathARShiftU64)
54 ASM_PFX(InternalMathARShiftU64):
55 stmfd sp!, {r4, r5, r6}
60 orr r3, r3, r1, asl ip
66 ldmfd sp!, {r4, r5, r6}
70 GCC_ASM_EXPORT(InternalMathLRotU64)
72 ASM_PFX(InternalMathLRotU64):
73 stmfd sp!, {r4, r5, r6, r7, lr}
80 orr r4, r4, r0, lsr ip
87 orr r0, r0, r6, asl ip
92 ldmfd sp!, {r4, r5, r6, r7, pc}
96 GCC_ASM_EXPORT(InternalMathRRotU64)
98 ASM_PFX(InternalMathRRotU64):
99 stmfd sp!, {r4, r5, r6, r7, lr}
106 orr r3, r3, r1, asl ip
113 orr r1, r1, r5, lsr ip
118 ldmfd sp!, {r4, r5, r6, r7, pc}
121 GCC_ASM_EXPORT(InternalMathMultU64x32)
123 ASM_PFX(InternalMathMultU64x32):
135 GCC_ASM_EXPORT(InternalMathMultU64x64)
137 ASM_PFX(InternalMathMultU64x64):
148 GCC_ASM_EXPORT(InternalMathDivU64x32)
150 ASM_PFX(InternalMathDivU64x32):
154 bl ASM_PFX(__udivdi3)
159 GCC_ASM_EXPORT(InternalMathModU64x32)
161 ASM_PFX(InternalMathModU64x32):
165 bl ASM_PFX(__umoddi3)
170 GCC_ASM_EXPORT(InternalMathDivRemU64x32)
172 ASM_PFX(InternalMathDivRemU64x32):
173 stmfd sp!, {r4, r5, r6, r7, lr}
175 stmfd sp!, {r10, r11}
185 bl ASM_PFX(__umoddi3)
192 bl ASM_PFX(__udivdi3)
193 ldmfd sp!, {r10, r11}
194 ldmfd sp!, {r4, r5, r6, r7, pc}
198 GCC_ASM_EXPORT(InternalMathDivRemU64x64)
200 ASM_PFX(InternalMathDivRemU64x64):
201 stmfd sp!, {r4, r5, r6, r7, lr}
203 stmfd sp!, {r10, r11}
211 bl ASM_PFX(__umoddi3)
218 bl ASM_PFX(__udivdi3)
219 ldmfd sp!, {r10, r11}
220 ldmfd sp!, {r4, r5, r6, r7, pc}
224 GCC_ASM_EXPORT(InternalMathDivRemS64x64)
226 ASM_PFX(InternalMathDivRemS64x64):
227 stmfd sp!, {r4, r5, r6, r7, lr}
229 stmfd sp!, {r10, r11}
245 ldmfd sp!, {r10, r11}
246 ldmfd sp!, {r4, r5, r6, r7, pc}
250 GCC_ASM_EXPORT(InternalMathSwapBytes64)
252 ASM_PFX(InternalMathSwapBytes64):
253 stmfd sp!, {r4, r5, r7, lr}
255 bl ASM_PFX(SwapBytes32)
258 bl ASM_PFX(SwapBytes32)
260 ldmfd sp!, {r4, r5, r7, pc}
263 ASM_FUNCTION_REMOVE_IF_UNREFERENCED