Commit ef0a4b67 by Paul Brook Committed by Paul Brook

longlong.h (__arm__): Define count_leading_zeros.

2008-06-12  Paul Brook  <paul@codesourcery.com>

	gcc/
	* longlong.h (__arm__): Define count_leading_zeros.
	* config/arm/lib1funcs.asm (xxh, xxl, yyh, yyl): Define.
	(clzsi2, clzdi2): New functions.
	* config/arm/bpabi-v6m.S (xxh, xxl, yyh, yyl): Remove.
	* config/arm/bpabi.S (xxh, xxl, yyh, yyl): Remove.
	* config/arm/t-strongarm-elf (LIB1ASMFUNCS): Ditto.
	* config/arm/t-vxworks (LIB1ASMFUNCS): Ditto.
	* config/arm/t-pe (LIB1ASMFUNCS): Ditto.
	* config/arm/t-arm-elf (LIB1ASMFUNCS): Ditto.
	* config/arm/t-arm-coff (LIB1ASMFUNCS): Ditto.
	* config/arm/t-linux (LIB1ASMFUNCS): Ditto.
	* config/arm/t-symbian (LIB1ASMFUNCS): Ditto.
	* config/arm/t-wince-pe (LIB1ASMFUNCS): Ditto.

From-SVN: r136718
parent 01b79d11
2008-06-12 Paul Brook <paul@codesourcery.com>
* longlong.h (__arm__): Define count_leading_zeros.
* config/arm/lib1funcs.asm (xxh, xxl, yyh, yyl): Define.
(clzsi2, clzdi2): New functions.
* config/arm/bpabi-v6m.S (xxh, xxl, yyh, yyl): Remove.
* config/arm/bpabi.S (xxh, xxl, yyh, yyl): Remove.
* config/arm/t-strongarm-elf (LIB1ASMFUNCS): Ditto.
* config/arm/t-vxworks (LIB1ASMFUNCS): Ditto.
* config/arm/t-pe (LIB1ASMFUNCS): Ditto.
* config/arm/t-arm-elf (LIB1ASMFUNCS): Ditto.
* config/arm/t-arm-coff (LIB1ASMFUNCS): Ditto.
* config/arm/t-linux (LIB1ASMFUNCS): Ditto.
* config/arm/t-symbian (LIB1ASMFUNCS): Ditto.
* config/arm/t-wince-pe (LIB1ASMFUNCS): Ditto.
2008-06-12 Kazu Hirata <kazu@codesourcery.com> 2008-06-12 Kazu Hirata <kazu@codesourcery.com>
* config/m68k/m68k.c (m68k_tune_flags): New. * config/m68k/m68k.c (m68k_tune_flags): New.
......
...@@ -27,18 +27,6 @@ ...@@ -27,18 +27,6 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor, the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */ Boston, MA 02110-1301, USA. */
#ifdef __ARMEB__
#define xxh r0
#define xxl r1
#define yyh r2
#define yyl r3
#else
#define xxh r1
#define xxl r0
#define yyh r3
#define yyl r2
#endif
#ifdef L_aeabi_lcmp #ifdef L_aeabi_lcmp
FUNC_START aeabi_lcmp FUNC_START aeabi_lcmp
......
...@@ -27,18 +27,6 @@ ...@@ -27,18 +27,6 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor, the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */ Boston, MA 02110-1301, USA. */
#ifdef __ARMEB__
#define xxh r0
#define xxl r1
#define yyh r2
#define yyl r3
#else
#define xxh r1
#define xxl r0
#define yyh r3
#define yyl r2
#endif
#ifdef L_aeabi_lcmp #ifdef L_aeabi_lcmp
ARM_FUNC_START aeabi_lcmp ARM_FUNC_START aeabi_lcmp
......
...@@ -406,6 +406,18 @@ SYM (__\name): ...@@ -406,6 +406,18 @@ SYM (__\name):
.endm .endm
#endif #endif
#ifdef __ARMEB__
#define xxh r0
#define xxl r1
#define yyh r2
#define yyl r3
#else
#define xxh r1
#define xxl r0
#define yyh r3
#define yyl r2
#endif
#ifdef __thumb__ #ifdef __thumb__
/* Register aliases. */ /* Register aliases. */
...@@ -1212,6 +1224,120 @@ LSYM(Lover12): ...@@ -1212,6 +1224,120 @@ LSYM(Lover12):
#endif /* __symbian__ */ #endif /* __symbian__ */
#if ((__ARM_ARCH__ > 5) && !defined(__ARM_ARCH_6M__)) \
|| defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
|| defined(__ARM_ARCH_5TEJ__)
#define HAVE_ARM_CLZ 1
#endif
#ifdef L_clzsi2
#if defined(__ARM_ARCH_6M__)
FUNC_START clzsi2
mov r1, #28
mov r3, #1
lsl r3, r3, #16
cmp r0, r3 /* 0x10000 */
bcc 2f
lsr r0, r0, #16
sub r1, r1, #16
2: lsr r3, r3, #8
cmp r0, r3 /* #0x100 */
bcc 2f
lsr r0, r0, #8
sub r1, r1, #8
2: lsr r3, r3, #4
cmp r0, r3 /* #0x10 */
bcc 2f
lsr r0, r0, #4
sub r1, r1, #4
2: adr r2, 1f
ldrb r0, [r2, r0]
add r0, r0, r1
bx lr
.align 2
1:
.byte 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
FUNC_END clzsi2
#else
ARM_FUNC_START clzsi2
# if defined(HAVE_ARM_CLZ)
clz r0, r0
RET
# else
mov r1, #28
cmp r0, #0x10000
do_it cs, t
movcs r0, r0, lsr #16
subcs r1, r1, #16
cmp r0, #0x100
do_it cs, t
movcs r0, r0, lsr #8
subcs r1, r1, #8
cmp r0, #0x10
do_it cs, t
movcs r0, r0, lsr #4
subcs r1, r1, #4
adr r2, 1f
ldrb r0, [r2, r0]
add r0, r0, r1
bx lr
.align 2
1:
.byte 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
# endif /* !HAVE_ARM_CLZ */
FUNC_END clzsi2
#endif
#endif /* L_clzsi2 */
#ifdef L_clzdi2
#if !defined(HAVE_ARM_CLZ)
# if defined(__ARM_ARCH_6M__)
FUNC_START clzdi2
push {r4, lr}
# else
ARM_FUNC_START clzdi2
do_push {r4, lr}
# endif
cmp xxh, #0
bne 1f
# ifdef __ARMEB__
mov r0, xxl
bl __clzsi2
add r0, r0, #32
b 2f
1:
bl __clzsi2
# else
bl __clzsi2
add r0, r0, #32
b 2f
1:
mov r0, xxh
bl __clzsi2
# endif
2:
# if defined(__ARM_ARCH_6M__)
pop {r4, pc}
# else
RETLDM r4
# endif
FUNC_END clzdi2
#else /* HAVE_ARM_CLZ */
ARM_FUNC_START clzdi2
cmp xxh, #0
do_it eq, et
clzeq r0, xxl
clzne r0, xxh
addeq r0, r0, #32
RET
FUNC_END clzdi2
#endif
#endif /* L_clzdi2 */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* These next two sections are here despite the fact that they contain Thumb /* These next two sections are here despite the fact that they contain Thumb
assembler because their presence allows interworked code to be linked even assembler because their presence allows interworked code to be linked even
......
LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the # We want fine grained libraries, so use the new code to build the
# floating point emulation libraries. # floating point emulation libraries.
......
...@@ -10,7 +10,8 @@ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \ ...@@ -10,7 +10,8 @@ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \
_arm_fixdfsi _arm_fixunsdfsi \ _arm_fixdfsi _arm_fixunsdfsi \
_arm_truncdfsf2 _arm_negsf2 _arm_addsubsf3 _arm_muldivsf3 \ _arm_truncdfsf2 _arm_negsf2 _arm_addsubsf3 _arm_muldivsf3 \
_arm_cmpsf2 _arm_unordsf2 _arm_fixsfsi _arm_fixunssfsi \ _arm_cmpsf2 _arm_unordsf2 _arm_fixsfsi _arm_fixunssfsi \
_arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf _arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf \
_clzsi2 _clzdi2
MULTILIB_OPTIONS = marm/mthumb MULTILIB_OPTIONS = marm/mthumb
MULTILIB_DIRNAMES = arm thumb MULTILIB_DIRNAMES = arm thumb
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx clzsi2 _clzdi2
# MULTILIB_OPTIONS = mhard-float/msoft-float # MULTILIB_OPTIONS = mhard-float/msoft-float
# MULTILIB_DIRNAMES = hard-float soft-float # MULTILIB_DIRNAMES = hard-float soft-float
......
LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the # We want fine grained libraries, so use the new code to build the
# floating point emulation libraries. # floating point emulation libraries.
...@@ -29,4 +29,4 @@ MULTILIB_DIRNAMES = fpu thumb ...@@ -29,4 +29,4 @@ MULTILIB_DIRNAMES = fpu thumb
LIBGCC = stmp-multilib LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib INSTALL_LIBGCC = install-multilib
TARGET_LIBGCC2_CFLAGS = TARGET_LIBGCC2_CFLAGS =
\ No newline at end of file
LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the # We want fine grained libraries, so use the new code to build the
# floating point emulation libraries. # floating point emulation libraries.
......
LIB1ASMFUNCS = _bb_init_func _call_via_rX _interwork_call_via_rX LIB1ASMFUNCS = _bb_init_func _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
# These functions have __aeabi equivalents and will never be called by GCC. # These functions have __aeabi equivalents and will never be called by GCC.
# By putting them in LIB1ASMFUNCS, we avoid the standard libgcc2.c code being # By putting them in LIB1ASMFUNCS, we avoid the standard libgcc2.c code being
......
LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the # We want fine grained libraries, so use the new code to build the
# floating point emulation libraries. # floating point emulation libraries.
......
LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the # We want fine grained libraries, so use the new code to build the
# floating point emulation libraries. # floating point emulation libraries.
......
...@@ -226,6 +226,12 @@ UDItype __umulsidi3 (USItype, USItype); ...@@ -226,6 +226,12 @@ UDItype __umulsidi3 (USItype, USItype);
#define UDIV_TIME 100 #define UDIV_TIME 100
#endif /* __arm__ */ #endif /* __arm__ */
#if defined(__arm__)
/* Let gcc decide how best to implement count_leading_zeros. */
#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
#define COUNT_LEADING_ZEROS_0 32
#endif
#if defined (__CRIS__) && __CRIS_arch_version >= 3 #if defined (__CRIS__) && __CRIS_arch_version >= 3
#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X)) #define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
#if __CRIS_arch_version >= 8 #if __CRIS_arch_version >= 8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment