From: Nicolas Pitre <nico@fluxnic.net>
To: Arnd Bergmann <arnd@arndb.de>, Russell King <linux@armlinux.org.uk>
Cc: Nicolas Pitre <npitre@baylibre.com>,
linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] ARM: div64: remove custom __arch_xprod_64()
Date: Thu, 4 Jul 2024 22:20:28 -0400 [thread overview]
Message-ID: <20240705022334.1378363-2-nico@fluxnic.net> (raw)
In-Reply-To: <20240705022334.1378363-1-nico@fluxnic.net>
From: Nicolas Pitre <npitre@baylibre.com>
Turns out that the compiler does a better job with the generic C version
these days. In any case, an even better generic implementation is
coming next, making this code doubly obsolete.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
---
arch/arm/include/asm/div64.h | 52 ------------------------------------
1 file changed, 52 deletions(-)
diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h
index 4b69cf8504..99b80db595 100644
--- a/arch/arm/include/asm/div64.h
+++ b/arch/arm/include/asm/div64.h
@@ -52,58 +52,6 @@ static inline uint32_t __div64_32(uint64_t *n, uint32_t base)
#else
-static inline uint64_t __arch_xprod_64(uint64_t m, uint64_t n, bool bias)
-{
- unsigned long long res;
- register unsigned int tmp asm("ip") = 0;
-
- if (!bias) {
- asm ( "umull %Q0, %R0, %Q1, %Q2\n\t"
- "mov %Q0, #0"
- : "=&r" (res)
- : "r" (m), "r" (n)
- : "cc");
- } else if (!(m & ((1ULL << 63) | (1ULL << 31)))) {
- res = m;
- asm ( "umlal %Q0, %R0, %Q1, %Q2\n\t"
- "mov %Q0, #0"
- : "+&r" (res)
- : "r" (m), "r" (n)
- : "cc");
- } else {
- asm ( "umull %Q0, %R0, %Q2, %Q3\n\t"
- "cmn %Q0, %Q2\n\t"
- "adcs %R0, %R0, %R2\n\t"
- "adc %Q0, %1, #0"
- : "=&r" (res), "+&r" (tmp)
- : "r" (m), "r" (n)
- : "cc");
- }
-
- if (!(m & ((1ULL << 63) | (1ULL << 31)))) {
- asm ( "umlal %R0, %Q0, %R1, %Q2\n\t"
- "umlal %R0, %Q0, %Q1, %R2\n\t"
- "mov %R0, #0\n\t"
- "umlal %Q0, %R0, %R1, %R2"
- : "+&r" (res)
- : "r" (m), "r" (n)
- : "cc");
- } else {
- asm ( "umlal %R0, %Q0, %R2, %Q3\n\t"
- "umlal %R0, %1, %Q2, %R3\n\t"
- "mov %R0, #0\n\t"
- "adds %Q0, %1, %Q0\n\t"
- "adc %R0, %R0, #0\n\t"
- "umlal %Q0, %R0, %R2, %R3"
- : "+&r" (res), "+&r" (tmp)
- : "r" (m), "r" (n)
- : "cc");
- }
-
- return res;
-}
-#define __arch_xprod_64 __arch_xprod_64
-
#include <asm-generic/div64.h>
#endif
--
2.45.2
next prev parent reply other threads:[~2024-07-05 2:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 2:20 [PATCH 0/2] do_div() with constant divisor simplification Nicolas Pitre
2024-07-05 2:20 ` Nicolas Pitre [this message]
2024-07-05 2:20 ` [PATCH 2/2] asm-generic/div64: reimplement __arch_xprod64() Nicolas Pitre
2024-07-05 8:17 ` Arnd Bergmann
2024-07-07 16:53 ` Nicolas Pitre
2024-07-06 11:13 ` kernel test robot
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=20240705022334.1378363-2-nico@fluxnic.net \
--to=nico@fluxnic.net \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=npitre@baylibre.com \
/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
all inboxes | Powered by JetHome®