+2010-02-18 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config/arm/lib1funcs.asm (__prefer_thumb__): New define.
+ (udivsi3, aeabi_uidivmod, divsi3, aeabi_idivmod): Use Thumb-1 variant
+ if __prefer_thumb__ is defined.
+
2010-02-18 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/43066
#error Unable to determine architecture.
#endif
+/* There are times when we might prefer Thumb1 code even if ARM code is
+ permitted, for example, the code might be smaller, or there might be
+ interworking problems with switching to ARM state if interworking is
+ disabled. */
+#if (defined(__thumb__) \
+ && !defined(__thumb2__) \
+ && (!defined(__THUMB_INTERWORK__) \
+ || defined (__OPTIMIZE_SIZE__) \
+ || defined(__ARM_ARCH_6M__)))
+# define __prefer_thumb__
+#endif
+
/* How to return from a function call depends on the architecture variant. */
#if (__ARM_ARCH__ > 4) || defined(__ARM_ARCH_4T__)
/* ------------------------------------------------------------------------ */
#ifdef L_udivsi3
-#if defined(__ARM_ARCH_6M__)
+#if defined(__prefer_thumb__)
FUNC_START udivsi3
FUNC_ALIAS aeabi_uidiv udivsi3
DIV_FUNC_END udivsi3 unsigned
-#if defined(__ARM_ARCH_6M__)
+#if defined(__prefer_thumb__)
FUNC_START aeabi_uidivmod
cmp r1, #0
beq LSYM(Ldiv0)
/* ------------------------------------------------------------------------ */
#ifdef L_divsi3
-#if defined(__ARM_ARCH_6M__)
+#if defined(__prefer_thumb__)
FUNC_START divsi3
FUNC_ALIAS aeabi_idiv divsi3
DIV_FUNC_END divsi3 signed
-#if defined(__ARM_ARCH_6M__)
+#if defined(__prefer_thumb__)
FUNC_START aeabi_idivmod
cmp r1, #0
beq LSYM(Ldiv0)