[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC 3/4] Arm64: further speed-up to hweight{32, 64}()



On 04/06/2019 17:11, Julien Grall wrote:
Hi Jan,

On 5/31/19 10:53 AM, Jan Beulich wrote:
According to Linux commit e75bef2a4f ("arm64: Select
ARCH_HAS_FAST_MULTIPLIER") this is a further improvement over the
variant using only bitwise operations on at least some hardware, and no
worse on other.

Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
RFC: To be honest I'm not fully convinced this is a win in particular in
      the hweight32() case, as there's no actual shift insn which gets
      replaced by the multiplication. Even for hweight64() the compiler
      could emit better code and avoid the explicit shift by 32 (which it
      emits at least for me).
I can see multiplication instruction used in both hweight32() and 
hweight64() with the compiler I am using.
I would expect the compiler could easily replace a multiply by a series 
of shift but it would be more difficult to do the invert.
Also, this has been in Linux for a year now, so I am assuming Linux 
folks are happy with changes (CCing Robin just in case I missed 
anything). Therefore I am happy to give it a go on Xen as well.
IIRC it did look like Linux's hweight() routines could possibly be 
further tuned for the A64 ISA to shave off one or two more instructions, 
but it's yet to be proven that performance is anywhere near critical 
enough to justify maintaining arch-specific versions. It costs us 
basically nothing to switch between the two generic implementations 
though, so since the smaller-and-no-slower code can be considered a net 
win (however minor), there seemed no reason *not* to apply the existing 
option appropriately.
Robin.

Cheers,

--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -12,6 +12,7 @@ config ARM_32
  config ARM_64
      def_bool y
      depends on 64BIT
+    select HAS_FAST_MULTIPLY
  config ARM
      def_bool y


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.