Update intrinsics for code sourcery gcc

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10262 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
andrewfish 2010-03-17 02:29:12 +00:00
parent bff4e9ea4f
commit 4e471bfd4d
21 changed files with 178 additions and 94 deletions

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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);
}

View File

@ -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}

View File

@ -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

View File

@ -87,6 +87,8 @@
Arm/switch16.S | GCC
Arm/switch32.S | GCC
Arm/sourcery.S | GCC
Arm/uldivmod.c | GCC
[Packages]
MdePkg/MdePkg.dec