[PATCH] arm: lib: implement aeabi_uldivmod via div64_u64_rem
Arnd Bergmann
arnd at kernel.org
Sat Jul 16 02:46:59 PDT 2022
On Sat, Jul 16, 2022 at 2:16 AM Nick Desaulniers
<ndesaulniers at google.com> wrote:
>
> Compilers frequently need to defer 64b division to a libcall with this
> symbol name. It essentially is div64_u64_rem, just with a different
> signature. Kernel developers know to call div64_u64_rem, but compilers
> don't.
>
> Link: https://lore.kernel.org/lkml/20220524004156.0000790e@garyguo.net/
> Suggested-by: Gary Guo <gary at garyguo.net>
> Signed-off-by: Nick Desaulniers <ndesaulniers at google.com>
This has historically been strongly NAK'd, and I don't think that position
has changed in the meantime. A variable-argument 64-bit division is
really expensive, especially on 32-bit machines that lack a native
32-bit division instruction, and we don't want developers to accidentally
insert one in their driver code.
Explicitly calling one of the division helpers in linux/math64.h is the
established way for driver writers to declare that a particular division
cannot be turned into a cheaper operation and is never run in a
performance critical code path. The compiler of course cannot know
about either of those.
Arnd
More information about the linux-arm-kernel
mailing list