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 # This program and the accompanying materials
11 # are licensed and made available under the terms and conditions of the BSD License
12 # which accompanies this distribution. The full text of the license may be found at
13 # http://opensource.org/licenses/bsd-license.php.
15 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #------------------------------------------------------------------------------
22 GCC_ASM_EXPORT(InternalMathLShiftU64)
24 ASM_PFX(InternalMathLShiftU64):
25 stmfd sp!, {r4, r5, r6}
30 orr r4, r4, r0, lsr ip
36 ldmfd sp!, {r4, r5, r6}
40 GCC_ASM_EXPORT(InternalMathRShiftU64)
42 ASM_PFX(InternalMathRShiftU64):
43 stmfd sp!, {r4, r5, r6}
48 orr r3, r3, r1, asl ip
54 ldmfd sp!, {r4, r5, r6}
58 GCC_ASM_EXPORT(InternalMathARShiftU64)
60 ASM_PFX(InternalMathARShiftU64):
61 stmfd sp!, {r4, r5, r6}
66 orr r3, r3, r1, asl ip
72 ldmfd sp!, {r4, r5, r6}
76 GCC_ASM_EXPORT(InternalMathLRotU64)
78 ASM_PFX(InternalMathLRotU64):
79 stmfd sp!, {r4, r5, r6, r7, lr}
86 orr r4, r4, r0, lsr ip
93 orr r0, r0, r6, asl ip
98 ldmfd sp!, {r4, r5, r6, r7, pc}
102 GCC_ASM_EXPORT(InternalMathRRotU64)
104 ASM_PFX(InternalMathRRotU64):
105 stmfd sp!, {r4, r5, r6, r7, lr}
112 orr r3, r3, r1, asl ip
119 orr r1, r1, r5, lsr ip
124 ldmfd sp!, {r4, r5, r6, r7, pc}
127 GCC_ASM_EXPORT(InternalMathMultU64x32)
129 ASM_PFX(InternalMathMultU64x32):
141 GCC_ASM_EXPORT(InternalMathMultU64x64)
143 ASM_PFX(InternalMathMultU64x64):
154 GCC_ASM_EXPORT(InternalMathDivU64x32)
156 ASM_PFX(InternalMathDivU64x32):
160 bl ASM_PFX(__udivdi3)
165 GCC_ASM_EXPORT(InternalMathModU64x32)
167 ASM_PFX(InternalMathModU64x32):
171 bl ASM_PFX(__umoddi3)
176 GCC_ASM_EXPORT(InternalMathDivRemU64x32)
178 ASM_PFX(InternalMathDivRemU64x32):
179 stmfd sp!, {r4, r5, r6, r7, lr}
181 stmfd sp!, {r10, r11}
191 bl ASM_PFX(__umoddi3)
198 bl ASM_PFX(__udivdi3)
199 ldmfd sp!, {r10, r11}
200 ldmfd sp!, {r4, r5, r6, r7, pc}
204 GCC_ASM_EXPORT(InternalMathDivRemU64x64)
206 ASM_PFX(InternalMathDivRemU64x64):
207 stmfd sp!, {r4, r5, r6, r7, lr}
209 stmfd sp!, {r10, r11}
217 bl ASM_PFX(__umoddi3)
224 bl ASM_PFX(__udivdi3)
225 ldmfd sp!, {r10, r11}
226 ldmfd sp!, {r4, r5, r6, r7, pc}
230 GCC_ASM_EXPORT(InternalMathDivRemS64x64)
232 ASM_PFX(InternalMathDivRemS64x64):
233 stmfd sp!, {r4, r5, r6, r7, lr}
235 stmfd sp!, {r10, r11}
251 ldmfd sp!, {r10, r11}
252 ldmfd sp!, {r4, r5, r6, r7, pc}
256 GCC_ASM_EXPORT(InternalMathSwapBytes64)
258 ASM_PFX(InternalMathSwapBytes64):
259 @ args = 0, pretend = 0, frame = 0
260 @ frame_needed = 1, uses_anonymous_args = 0
261 stmfd sp!, {r4, r5, r6, r7, lr}
264 bl ASM_PFX(SwapBytes32)
267 bl ASM_PFX(SwapBytes32)
274 ldmfd sp!, {r4, r5, r6, r7, pc}
277 ASM_FUNCTION_REMOVE_IF_UNREFERENCED