public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] do_div() with constant divisor simplification
@ 2024-07-07 17:17 Nicolas Pitre
  2024-07-07 17:17 ` [PATCH v2 1/4] lib/math/test_div64: add some edge cases relevant to __div64_const32() Nicolas Pitre
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Nicolas Pitre @ 2024-07-07 17:17 UTC (permalink / raw)
  To: Arnd Bergmann, Russell King; +Cc: Nicolas Pitre, linux-arch, linux-kernel

While working on mul_u64_u64_div_u64() improvements I realized that there
is a better way to perform a 64x64->128 bits multiplication with overflow
handling. This is not as lean as v1 of the series but still much better
than the existing code IMHO.

Changes from v1:

- Formalize condition for when overflow handling can be skipped.
- Make this condition apply only if it can be determined at compile time
  (beware of the compiler not always inling code).
- Keep the ARM assembly but apply the above changes to it as well.
- Simplify generic C code for __arch_xprod64() further.
- Force __always_inline when optimizing for performance.
- Augment test_div64.c with important edge cases.

Link to v1: https://lore.kernel.org/lkml/20240705022334.1378363-1-nico@fluxnic.net/

The diffstat is:

 arch/arm/include/asm/div64.h |  13 +++-
 include/asm-generic/div64.h  | 121 ++++++++++++-----------------------
 lib/math/test_div64.c        |  85 +++++++++++++++++++++++-
 3 files changed, 134 insertions(+), 85 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-07-08  5:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-07 17:17 [PATCH v2 0/4] do_div() with constant divisor simplification Nicolas Pitre
2024-07-07 17:17 ` [PATCH v2 1/4] lib/math/test_div64: add some edge cases relevant to __div64_const32() Nicolas Pitre
2024-07-07 17:17 ` [PATCH v2 2/4] asm-generic/div64: optimize/simplify __div64_const32() Nicolas Pitre
2024-07-07 17:17 ` [PATCH v2 3/4] ARM: div64: improve __arch_xprod_64() Nicolas Pitre
2024-07-07 17:17 ` [PATCH v2 4/4] __arch_xprod64(): make __always_inline when optimizing for performance Nicolas Pitre
2024-07-07 18:59   ` Arnd Bergmann
2024-07-07 19:14     ` Nicolas Pitre
2024-07-07 19:37       ` Arnd Bergmann
2024-07-08  1:21         ` Nicolas Pitre
2024-07-08  5:21           ` Arnd Bergmann
2024-07-07 19:40   ` kernel test robot
2024-07-07 19:40   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox