Skip to contentSkip to conversation

arm64: Select ARCH_HAS_FAST_MULTIPLIER

PATCH New Robin Murphy 3 participants 3 messages Apr 24, 2018 – May 16, 2018 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: Select ARCH_HAS_FAST_MULTIPLIER

It is probably safe to assume that all Armv8-A implementations have a multiplier whose efficiency is comparable or better than a sequence of three or so register-dependent arithmetic instructions. Select ARCH_HAS_FAST_MULTIPLIER to get ever-so-slightly nicer codegen in the few dusty old corners which care.

In a contrived benchmark calling hweight64() in a loop, this does indeed turn out to be a small win overall, with no measurable impact on Cortex-A57 but about 5% performance improvement on Cortex-A53.

---

Apropos of stumbling across this option whilst digging down into some bitmap-juggling code...

 arch/arm64/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/Kconfig +1 -0
index eb2cf4938f6d..9c850f3b398f 100644
@@ -12,6 +12,7 @@ config ARM64
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
 	select ARCH_HAS_ELF_RANDOMIZE
+	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA
Signature · 1 line
2.17.0.dirty
#1 lore raw

PATCH 1/1 arm64: Select ARCH_HAS_FAST_MULTIPLIER

Quoted 6 lines · Robin Murphy

It is probably safe to assume that all Armv8-A implementations have a multiplier whose efficiency is comparable or better than a sequence of three or so register-dependent arithmetic instructions. Select ARCH_HAS_FAST_MULTIPLIER to get ever-so-slightly nicer codegen in the few dusty old corners which care.

Quoted 6 lines

In a contrived benchmark calling hweight64() in a loop, this does indeed turn out to be a small win overall, with no measurable impact on Cortex-A57 but about 5% performance improvement on Cortex-A53.

---

Will

maintainer Applied
#2 lore raw

PATCH 1/1 arm64: Select ARCH_HAS_FAST_MULTIPLIER

In reply to Robin Murphy
Quoted 11 lines · Robin Murphy

It is probably safe to assume that all Armv8-A implementations have a multiplier whose efficiency is comparable or better than a sequence of three or so register-dependent arithmetic instructions. Select ARCH_HAS_FAST_MULTIPLIER to get ever-so-slightly nicer codegen in the few dusty old corners which care.

In a contrived benchmark calling hweight64() in a loop, this does indeed turn out to be a small win overall, with no measurable impact on Cortex-A57 but about 5% performance improvement on Cortex-A53.

Queued for 4.18. Thanks.

Signature · 1 line
Catalin