diff options
author | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-03-17 02:29:12 +0000 |
---|---|---|
committer | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-03-17 02:29:12 +0000 |
commit | 4e471bfd4de222ee74b45e1261b0796cc8441619 (patch) | |
tree | 1335dcb4f05f4ba0e8a55b0b78204562c1e1f895 /ArmPkg/Library/CompilerIntrinsicsLib/Arm | |
parent | bff4e9ea4f2acbca0ba03d501b55ac733cc9a8bb (diff) | |
download | edk2-platforms-4e471bfd4de222ee74b45e1261b0796cc8441619.tar.xz |
Update intrinsics for code sourcery gcc
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10262 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Library/CompilerIntrinsicsLib/Arm')
20 files changed, 176 insertions, 94 deletions
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h index e2c00a2033..70e23e448a 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/Llvm_int_lib.h @@ -75,6 +75,22 @@ typedef union { }; } udwords; +// __aeabi_ return values +typedef struct { + UINT64 Quotent; + UINT64 Remainder; +} ulldiv_t; + +typedef struct { + INT64 Quotent; + INT64 Remainder; +} lldiv_t; + +typedef struct { + UINT32 Quotent; + UINT32 Remainder; +} uidiv_return; + #if __GNUC__ #define COUNT_LEADING_ZEROS(_a) __builtin_clz((_a)) #define COUNT_TRAILING_ZEROS(_a) __builtin_ctz((_a)) diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S index ac2bdbafd0..6eca3fc6c0 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.S @@ -14,13 +14,10 @@ .text .align 2 - .globl ___ashldi3 -___ashldi3: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 0, uses_anonymous_args = 0 - @ link register save eliminated. + .globl ASM_PFX(__ashldi3) + +ASM_PFX(__ashldi3): cmp r2, #31 - @ lr needed for prologue bls L2 cmp r2, #63 subls r2, r2, #32 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S index fb87c88a09..0bc765ba38 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashrdi3.S @@ -14,13 +14,10 @@ .text .align 2 - .globl ___ashrdi3 -___ashrdi3: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 0, uses_anonymous_args = 0 - @ link register save eliminated. + .globl ASM_PFX(__ashrdi3) + +ASM_PFX(__ashrdi3): cmp r2, #31 - @ lr needed for prologue bls L2 cmp r2, #63 subls r2, r2, #32 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S index 9b12731613..7fcdbbd9fd 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/clzsi2.S @@ -14,9 +14,9 @@ .text .align 2 - .globl ___clzsi2 -___clzsi2: - @ args = 0, pretend = 0, frame = 0 + .globl ASM_PFX(__clzsi2) + +ASM_PFX(__clzsi2): @ frame_needed = 1, uses_anonymous_args = 0 stmfd sp!, {r7, lr} add r7, sp, #0 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S index 78f29ec607..9ad94684b4 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ctzsi2.S @@ -14,11 +14,9 @@ .text .align 2 - .globl ___ctzsi2 -___ctzsi2: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 0, uses_anonymous_args = 0 - @ link register save eliminated. + .globl ASM_PFX(__ctzsi2) + +ASM_PFX(__ctzsi2): uxth r3, r0 cmp r3, #0 moveq ip, #16 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S index b7d946ecc7..f5213d87cd 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divdi3.S @@ -14,8 +14,9 @@ .text .align 2 - .globl ___divdi3 -___divdi3: + .globl ASM_PFX(__divdi3) + +ASM_PFX(__divdi3): @ args = 0, pretend = 0, frame = 0 @ frame_needed = 1, uses_anonymous_args = 0 stmfd sp!, {r4, r5, r7, lr} @@ -36,7 +37,7 @@ ___divdi3: subs r0, r0, r10 sbc r1, r1, r11 str ip, [sp, #0] - bl ___udivmoddi4 + bl ASM_PFX(__udivmoddi4) eor r2, r10, r4 eor r3, r10, r4 eor r0, r0, r2 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S index 2651572222..9c9bdc031d 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/divsi3.S @@ -14,10 +14,9 @@ .text .align 2 - .globl ___divsi3 -___divsi3: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__divsi3) + +ASM_PFX(__divsi3): eor r3, r0, r0, asr #31 eor r2, r1, r1, asr #31 stmfd sp!, {r4, r5, r7, lr} @@ -26,7 +25,7 @@ ___divsi3: mov r4, r1, asr #31 sub r0, r3, r0, asr #31 sub r1, r2, r1, asr #31 - bl ___udivsi3 + bl ASM_PFX(__udivsi3) eor r1, r5, r4 eor r0, r0, r1 rsb r0, r1, r0 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S index 2257deef97..f9ed40e1a2 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/lshrdi3.S @@ -14,13 +14,10 @@ .text .align 2 - .globl ___lshrdi3 -___lshrdi3: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 0, uses_anonymous_args = 0 - @ link register save eliminated. + .globl ASM_PFX(__lshrdi3) + +ASM_PFX(__lshrdi3): cmp r2, #31 - @ lr needed for prologue bls L2 cmp r2, #63 subls r2, r2, #32 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S index 2582a81f90..606741f4a1 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memcpy.S @@ -14,10 +14,9 @@ .text .align 2 - .globl _memcpy -_memcpy: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(memcpy) + +ASM_PFX(memcpy): stmfd sp!, {r7, lr} mov ip, #0 add r7, sp, #0 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S index 7af8d21683..6a3cb48802 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/moddi3.S @@ -14,10 +14,9 @@ .text .align 2 - .globl ___moddi3 -___moddi3: - @ args = 0, pretend = 0, frame = 8 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__moddi3) + +ASM_PFX(__moddi3): stmfd sp!, {r4, r5, r7, lr} mov r4, r1, asr #31 add r7, sp, #8 @@ -36,7 +35,7 @@ ___moddi3: subs r2, r2, r10 sbc r3, r3, r11 str ip, [sp, #0] - bl ___udivmoddi4 + bl ASM_PFX(__udivmoddi4) ldrd r0, [sp, #8] eor r0, r0, r4 eor r1, r1, r4 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S index 14d8542198..d34da4f06c 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/modsi3.S @@ -14,10 +14,9 @@ .text .align 2 - .globl ___modsi3 -___modsi3: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__modsi3) + +ASM_PFX(__modsi3): stmfd sp!, {r4, r5, r7, lr} add r7, sp, #8 mov r5, r0 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S index a36dbff8c3..a28f0d67b8 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/muldi3.S @@ -14,10 +14,9 @@ .text .align 2 - .globl ___muldi3 -___muldi3: - @ args = 0, pretend = 0, frame = 8 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__muldi3) + +ASM_PFX(__muldi3): stmfd sp!, {r4, r5, r6, r7, lr} add r7, sp, #12 stmfd sp!, {r8, r10, r11} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S new file mode 100755 index 0000000000..7521057637 --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/sourcery.S @@ -0,0 +1,54 @@ +#------s------------------------------------------------------------------------ +# +# Copyright (c) 2008-2010 Apple Inc. All rights reserved. +# +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#------------------------------------------------------------------------------ + + + .text
+ .align 2
+ .globl ASM_PFX(__aeabi_ulcmp)
+ASM_PFX(__aeabi_ulcmp):
+ stmfd sp!, {r4, r5, r8}
+ cmp r3, r1
+ mov r8, r0
+ mov r9, r1
+ mov r4, r2
+ mov r5, r3
+ bls L16
+L2:
+ mvn r0, #0
+L1:
+ ldmfd sp!, {r4, r5, r8}
+ bx lr
+L16:
+ beq L17
+L4:
+ cmp r9, r5
+ bhi L7
+ beq L18
+ cmp r8, r4
+L14:
+ cmpeq r9, r5
+ moveq r0, #0
+ beq L1
+ b L1
+L18:
+ cmp r8, r4
+ bls L14
+L7:
+ mov r0, #1
+ b L1
+L17:
+ cmp r2, r0
+ bhi L2
+ b L4
+
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S index a6ecc73349..dadec3c156 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/ucmpdi2.S @@ -14,10 +14,9 @@ .text .align 2 - .globl ___ucmpdi2 -___ucmpdi2: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 0, uses_anonymous_args = 0 + .globl ASM_PFX(__ucmpdi2) + +ASM_PFX(__ucmpdi2): stmfd sp!, {r4, r5, r8, lr} cmp r1, r3 mov r8, r0 diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S index fd7715da66..0b1cf63367 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivdi3.S @@ -14,15 +14,14 @@ .text .align 2 - .globl ___udivdi3 -___udivdi3: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__udivdi3) + +ASM_PFX(__udivdi3): stmfd sp!, {r7, lr} add r7, sp, #0 sub sp, sp, #8 mov ip, #0 str ip, [sp, #0] - bl ___udivmoddi4 + bl ASM_PFX(__udivmoddi4) sub sp, r7, #0 ldmfd sp!, {r7, pc} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S index 1e54baec24..03959d6c49 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S @@ -14,10 +14,9 @@ .text .align 2 - .globl ___udivmoddi4 -___udivmoddi4: - @ args = 8, pretend = 0, frame = 16 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__udivmoddi4) + +ASM_PFX(__udivmoddi4): stmfd sp!, {r4, r5, r6, r7, lr} add r7, sp, #12 stmfd sp!, {r10, r11} @@ -35,7 +34,7 @@ ___udivmoddi4: cmp r6, #0 beq L8 mov r1, r2 - bl ___umodsi3 + bl ASM_PFX(__umodsi3) mov r1, #0 stmia r6, {r0-r1} L8: @@ -58,14 +57,14 @@ L4: beq L16 mov r1, r2 mov r0, r11 - bl ___umodsi3 + bl ASM_PFX(__umodsi3) mov r1, #0 stmia r6, {r0-r1} L16: ldr r1, [sp, #4] mov r0, r11 L45: - bl ___udivsi3 + bl ASM_PFX(__udivsi3) L46: mov r10, r0 mov r11, #0 @@ -77,7 +76,7 @@ L14: beq L16 ldr r1, [sp, #4] mov r0, r11 - bl ___umodsi3 + bl ASM_PFX(__umodsi3) mov r4, r10 mov r5, r0 stmia r6, {r4-r5} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S index e5a0afa053..bfe2006151 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivsi3.S @@ -14,10 +14,9 @@ .text .align 2 - .globl ___udivsi3 -___udivsi3: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__udivsi3) + +ASM_PFX(__udivsi3): cmp r1, #0 cmpne r0, #0 stmfd sp!, {r4, r5, r7, lr} @@ -55,3 +54,4 @@ L8: L2: mov r0, #0 ldmfd sp!, {r4, r5, r7, pc} + diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c new file mode 100755 index 0000000000..c28de785a6 --- /dev/null +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/uldivmod.c @@ -0,0 +1,43 @@ +/** @file + + Copyright (c) 2008-2010, Apple Inc. All rights reserved. + + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "Llvm_int_lib.h" +#include <Library/BaseLib.h> + + +UINT32 __udivsi3(UINT32 n, UINT32 d); +UINT32 __umodsi3(UINT32 a, UINT32 b); + + +UINT64 +__aeabi_uidivmod(unsigned numerator, unsigned denominator) +{ + UINT64 Return; + + Return = __udivsi3 (numerator, denominator); + Return |= LShiftU64 (__umodsi3 (numerator, denominator), 32); + + return Return; +} + +unsigned +__aeabi_uidiv (unsigned n, unsigned d) +{ + return __udivsi3 (n, d); +} + + + + + diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S index 6396036c04..f987943bea 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umoddi3.S @@ -14,16 +14,15 @@ .text .align 2 - .globl ___umoddi3 -___umoddi3: - @ args = 0, pretend = 0, frame = 8 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__umoddi3) + +ASM_PFX(__umoddi3): stmfd sp!, {r7, lr} add r7, sp, #0 sub sp, sp, #16 add ip, sp, #8 str ip, [sp, #0] - bl ___udivmoddi4 + bl ASM_PFX(__udivmoddi4) ldrd r0, [sp, #8] sub sp, r7, #0 ldmfd sp!, {r7, pc} diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S index 4cde76beb5..129cedff95 100644 --- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S +++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/umodsi3.S @@ -14,27 +14,15 @@ .text .align 2 - .globl ___umodsi3 -___umodsi3: - @ args = 0, pretend = 0, frame = 0 - @ frame_needed = 1, uses_anonymous_args = 0 + .globl ASM_PFX(__umodsi3) + +ASM_PFX(__umodsi3): stmfd sp!, {r4, r5, r7, lr} add r7, sp, #8 mov r5, r0 mov r4, r1 - bl L___udivsi3$stub + bl ASM_PFX(__udivsi3) mul r0, r4, r0 rsb r0, r0, r5 ldmfd sp!, {r4, r5, r7, pc} - .section __TEXT,__symbol_stub4,symbol_stubs,none,12 - .align 2 -L___udivsi3$stub: - .indirect_symbol ___udivsi3 - ldr ip, L___udivsi3$slp - ldr pc, [ip, #0] -L___udivsi3$slp: - .long L___udivsi3$lazy_ptr - .lazy_symbol_pointer -L___udivsi3$lazy_ptr: - .indirect_symbol ___udivsi3 - .long dyld_stub_binding_helper + |