From dc4917425181e331c20a26437d46c79c3cb9885b Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Sat, 15 May 2004 17:31:51 +0000 Subject: [PATCH] lib1funcs.asm (_lshrdi3, [...]): Add ASM implementations for ARM and Thumb. * arm/lib1funcs.asm (_lshrdi3, _ashrdi3, _ashldi3): Add ASM implementations for ARM and Thumb. * arm/t-arm-elf (LIB1ASMFUNCS): Use them. From-SVN: r81889 --- gcc/ChangeLog | 6 ++ gcc/config/arm/lib1funcs.asm | 110 +++++++++++++++++++++++++++++++++++ gcc/config/arm/t-arm-elf | 1 + 3 files changed, 117 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index abf444b834e..1a23cf1b356 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-05-15 Richard Earnshaw + + * arm/lib1funcs.asm (_lshrdi3, _ashrdi3, _ashldi3): Add ASM + implementations for ARM and Thumb. + * arm/t-arm-elf (LIB1ASMFUNCS): Use them. + 2004-05-15 Thomas Quinot * prefix.c (update_path): Replace PREFIX with KEY only diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm index c36ce4b9d4d..9f8b4673702 100644 --- a/gcc/config/arm/lib1funcs.asm +++ b/gcc/config/arm/lib1funcs.asm @@ -864,6 +864,116 @@ LSYM(Lover12): FUNC_END div0 #endif /* L_dvmd_lnx */ +/* ------------------------------------------------------------------------ */ +/* Dword shift operations. */ +/* All the following Dword shift variants rely on the fact that + shft xxx, Reg + is in fact done as + shft xxx, (Reg & 255) + so for Reg value in (32...63) and (-1...-31) we will get zero (in the + case of logical shifts) or the sign (for asr). */ + +#ifdef __ARMEB__ +#define al r1 +#define ah r0 +#else +#define al r0 +#define ah r1 +#endif + +#ifdef L_lshrdi3 + + FUNC_START lshrdi3 + +#ifdef __thumb__ + lsr al, r2 + mov r3, ah + lsr ah, r2 + mov ip, r3 + sub r2, #32 + lsr r3, r2 + orr al, r3 + neg r2, r2 + mov r3, ip + lsl r3, r2 + orr al, r3 + RET +#else + subs r3, r2, #32 + rsb ip, r2, #32 + movmi al, al, lsr r2 + movpl al, ah, lsr r3 + orrmi al, al, ah, lsl ip + mov ah, ah, lsr r2 + RET +#endif + FUNC_END lshrdi3 + +#endif + +#ifdef L_ashrdi3 + + FUNC_START ashrdi3 +#ifdef __thumb__ + lsr al, r2 + mov r3, ah + asr ah, r2 + sub r2, #32 + @ If r2 is negative at this point the following step would OR + @ the sign bit into all of AL. That's not what we want... + bmi 1f + mov ip, r3 + asr r3, r2 + orr al, r3 + mov r3, ip +1: + neg r2, r2 + lsl r3, r2 + orr al, r3 + RET +#else + subs r3, r2, #32 + rsb ip, r2, #32 + movmi al, al, lsr r2 + movpl al, ah, asr r3 + orrmi al, al, ah, lsl ip + mov ah, ah, asr r2 + RET +#endif + + FUNC_END ashrdi3 + +#endif + +#ifdef L_ashldi3 + + FUNC_START ashldi3 +#ifdef __thumb__ + lsl ah, r2 + mov r3, al + lsl al, r2 + mov ip, r3 + sub r2, #32 + lsl r3, r2 + orr ah, r3 + neg r2, r2 + mov r3, ip + lsr r3, r2 + orr ah, r3 + RET +#else + subs r3, r2, #32 + rsb ip, r2, #32 + movmi ah, ah, lsl r2 + movpl ah, al, lsl r3 + orrmi ah, ah, al, lsr ip + mov al, al, lsl r2 + RET +#endif + FUNC_END ashldi3 + +#endif + /* ------------------------------------------------------------------------ */ /* These next two sections are here despite the fact that they contain Thumb assembler because their presence allows interworked code to be linked even diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf index c834220b7fe..ecc24e5cc26 100644 --- a/gcc/config/arm/t-arm-elf +++ b/gcc/config/arm/t-arm-elf @@ -1,6 +1,7 @@ LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \ _call_via_rX _interwork_call_via_rX \ + _lshrdi3 _ashrdi3 _ashldi3 \ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ _fixsfsi _fixunssfsi -- 2.30.2