[PATCH 03/13] ARM: div64: fix building with gcc-4.5 and lower

Arnd Bergmann
2016-12-16T10:55:41Z

drivers/media/dvb-frontends/s921.c: In function 's921_pll_tune':
arch/arm/include/asm/div64.h:109: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
arch/arm/include/asm/div64.h:127: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
arch/arm/include/asm/div64.h:109: error: 'asm' operand has impossible constraints
arch/arm/include/asm/div64.h:127: error: 'asm' operand has impossible constraints
scripts/Makefile.build:299: recipe for target 'drivers/media/dvb-frontends/s921.o' failed

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/include/asm/div64.h | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h
index 7ca0c613c33b..e1c8d4a58797 100644
--- a/arch/arm/include/asm/div64.h
+++ b/arch/arm/include/asm/div64.h
@@ -66,27 +66,16 @@ static inline uint32_t __div64_32(uint64_t *n, uint32_t base)
*/
#define do_div(n, base) __div64_32(&(n), base)

-#elif defined(CONFIG_CPU_32v3)
+#elif GCC_VERSION < 40600

/*
- * modern compiler versions (>= gcc-4.9) tend to misoptimize
- * the code for ARMv3, and this is not getting fixed any more.
+ * gcc-4.4 and gcc-4.5 tend to run out of registers in their
+ * register allocation in some functions
*/
#define do_div(n, base) __div64_32(&(n), base)

#else

-/*
- * gcc versions earlier than 4.0 are simply too problematic for the
- * __div64_const32() code in asm-generic/div64.h. First there is
- * gcc PR 15089 that tend to trig on more complex constructs, spurious
- * .global __udivsi3 are inserted even if none of those symbols are
- * referenced in the generated code, and those gcc versions are not able
- * to do constant propagation on long long values anyway.
- */
-
-#define __div64_const32_is_OK (__GNUC__ >= 4)
-
static inline uint64_t __arch_xprod_64(uint64_t m, uint64_t n, bool bias)
{
unsigned long long res;
--
2.9.0