From: David Laight <david.laight.linux@gmail.com>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: Fix the GCC version check for `__multi3' workaround
Date: Mon, 30 Mar 2026 12:52:00 +0100 [thread overview]
Message-ID: <20260330125200.1cdd9994@pumpkin> (raw)
In-Reply-To: <alpine.DEB.2.21.2603301108170.60268@angie.orcam.me.uk>
On Mon, 30 Mar 2026 11:09:43 +0100 (BST)
"Maciej W. Rozycki" <macro@orcam.me.uk> wrote:
> On Mon, 30 Mar 2026, David Laight wrote:
>
> > Although it might be worth just deleting the version check.
> > __multi3 is unconditionally defined for sparc64 and that is a much
> > more complex function rather than the pretty trivial mips64 version.
>
> We want to catch invalid usage or we could just link with libgcc.a.
That would pull in all sorts of expensive functions - like divides.
One option would be have a 'u128 mul_u64_u64_u128(u64, u64)' function
that architectures could define, defaulting to (u128)a * b.
Similar definitions exist for mixed u64/u32 arithmetic on 32bit because
gcc tends to make a proverbial 'pig's breakfast' of compiling it.
(I've seen explicit multiplies by constant zeros that have been spilled
to stack!)
I recently improved/optimised the nolibc snprintf() code; that fell over
the same problem (on both mips64 and sparc64) doing the div/rem by 10
using multiply by reciprocal. I'm not sure how the kernel snprintf()
does the conversion - the entire function needs some TLC.
(That would probably speed up things like 'cat /proc/interrupts'.)
David
>
> Maciej
>
prev parent reply other threads:[~2026-03-30 11:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 1:54 [PATCH] MIPS: Fix the GCC version check for `__multi3' workaround Maciej W. Rozycki
2026-03-30 9:46 ` David Laight
2026-03-30 10:09 ` Maciej W. Rozycki
2026-03-30 11:52 ` David Laight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260330125200.1cdd9994@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox