Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: div64: improve __arch_xprod_64()

Let's use the same criteria for overflow handling necessity as the
generic code.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

authored by

Nicolas Pitre and committed by
Arnd Bergmann
06508533 00a31dd3

+4 -2
+4 -2
arch/arm/include/asm/div64.h
··· 56 56 { 57 57 unsigned long long res; 58 58 register unsigned int tmp asm("ip") = 0; 59 + bool no_ovf = __builtin_constant_p(m) && 60 + ((m >> 32) + (m & 0xffffffff) < 0x100000000); 59 61 60 62 if (!bias) { 61 63 asm ( "umull %Q0, %R0, %Q1, %Q2\n\t" ··· 65 63 : "=&r" (res) 66 64 : "r" (m), "r" (n) 67 65 : "cc"); 68 - } else if (!(m & ((1ULL << 63) | (1ULL << 31)))) { 66 + } else if (no_ovf) { 69 67 res = m; 70 68 asm ( "umlal %Q0, %R0, %Q1, %Q2\n\t" 71 69 "mov %Q0, #0" ··· 82 80 : "cc"); 83 81 } 84 82 85 - if (!(m & ((1ULL << 63) | (1ULL << 31)))) { 83 + if (no_ovf) { 86 84 asm ( "umlal %R0, %Q0, %R1, %Q2\n\t" 87 85 "umlal %R0, %Q0, %Q1, %R2\n\t" 88 86 "mov %R0, #0\n\t"