This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/82981] [7/8 Regression] unnecessary __multi3 call for mips64r6 linux kernel


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981

--- Comment #9 from Jim Wilson <wilson at gcc dot gnu.org> ---
Jakub's patch fixes the optimization problem with the testcase.

I tried a linux kernel build with the patched compiler and the provided .config
file.  I still see some __multi3 calls.  However, looking at the code, I see in
lib/mpi/ several files with calls to umul_ppmm from a longlong.h file similar
to the one in gcc, that has

#if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64
#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#define umul_ppmm(w1, w0, u, v) \
do {                                                                    \
        typedef unsigned int __ll_UTItype __attribute__((mode(TI)));    \
        __ll_UTItype __ll = (__ll_UTItype)(u) * (v);                    \
        w1 = __ll >> 64;                                                \
        w0 = __ll;                                                      \
} while (0)
#elif ...

So this is self inflicted damage, as this is an explicit TImode multiply for
gcc 5 and later.

This requires either a linux kernel longlong.h fix to use an alternate macro
definition for mips targets that don't directly support TImode multiply.  Or
else it requires a gcc mips maintainer to fix the mips backend to add multi3
support for mips64r6.  Either one should be possible by emitting two multiply
instructions, one for the high part and one for the low part.

Or it requires adding a mips assembly __multi3 function to the linux kernel. 
Or maybe the config file can be modified to drop the mpi support?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]