public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] lib: fix 842 build on 32-bit architectures
@ 2015-05-13 20:56 Arnd Bergmann
  2015-05-13 23:52 ` Dan Streetman
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arnd Bergmann @ 2015-05-13 20:56 UTC (permalink / raw)
  To: linux-arm-kernel

Building the 842 code on 32-bit ARM currently results in this link
error:

ERROR: "__aeabi_uldivmod" [lib/842/842_decompress.ko] undefined!

The reason is that the __do_index function performs a 64-bit
division by a power-of-two number, but it has no insight into
the function arguments.

By marking that function inline, the fsize argument is always
known at the time that do_index is called, and the compiler is
able to replace the extremely expensive 64-bit division with
a cheap constant shift operation.

Aside from fixing that link error, this approach should also improve
both code size and performance on 32-bit architectures significantly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Found while building arm32 allmodconfig with gcc-5.0

diff --git a/lib/842/842_decompress.c b/lib/842/842_decompress.c
index 6b2b45aecde3..285bf6b6959c 100644
--- a/lib/842/842_decompress.c
+++ b/lib/842/842_decompress.c
@@ -169,7 +169,7 @@ static int do_data(struct sw842_param *p, u8 n)
 	return 0;
 }
 
-static int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize)
+static inline int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize)
 {
 	u64 index, offset, total = round_down(p->out - p->ostart, 8);
 	int ret;

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

end of thread, other threads:[~2015-05-14 11:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-13 20:56 [PATCH] lib: fix 842 build on 32-bit architectures Arnd Bergmann
2015-05-13 23:52 ` Dan Streetman
2015-05-14  8:54   ` Dan Streetman
2015-05-14 10:49     ` Arnd Bergmann
2015-05-14 11:03       ` Dan Streetman
2015-05-14  3:06 ` Herbert Xu
2015-05-14 10:03 ` Russell King - ARM Linux

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