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

Configure Feed

Select the types of activity you want to include in your feed.

MIPS: Fix the GCC version check for `__multi3' workaround

It was only GCC 10 that fixed a MIPS64r6 code generation issue with a
`__multi3' libcall inefficiently produced to perform 64-bit widening
multiplication while suitable machine instructions exist to do such a
calculation. The fix went in with GCC commit 48b2123f6336 ("re PR
target/82981 (unnecessary __multi3 call for mips64r6 linux kernel)").

Adjust our code accordingly, removing build failures such as:

mips64-linux-ld: lib/math/div64.o: in function `mul_u64_add_u64_div_u64':
div64.c:(.text+0x84): undefined reference to `__multi3'

with the GCC versions affected.

Fixes: ebabcf17bcd7 ("MIPS: Implement __multi3 for GCC7 MIPS64r6 builds")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601140146.hMLODc6v-lkp@intel.com/
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Cc: stable@vger.kernel.org # v4.15+
Reviewed-by: David Laight <david.laight.linux@gmail.com.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Maciej W. Rozycki and committed by
Thomas Bogendoerfer
ec8bf188 d62cf151

+3 -3
+3 -3
arch/mips/lib/multi3.c
··· 4 4 #include "libgcc.h" 5 5 6 6 /* 7 - * GCC 7 & older can suboptimally generate __multi3 calls for mips64r6, so for 7 + * GCC 9 & older can suboptimally generate __multi3 calls for mips64r6, so for 8 8 * that specific case only we implement that intrinsic here. 9 9 * 10 10 * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981 11 11 */ 12 - #if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ < 8) 12 + #if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ < 10) 13 13 14 14 /* multiply 64-bit values, low 64-bits returned */ 15 15 static inline long long notrace dmulu(long long a, long long b) ··· 51 51 } 52 52 EXPORT_SYMBOL(__multi3); 53 53 54 - #endif /* 64BIT && CPU_MIPSR6 && GCC7 */ 54 + #endif /* 64BIT && CPU_MIPSR6 && GCC9 */