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

[xen master] ARM/div: Drop __div64_fls()



commit 2eb32c6c2d3ae25a85409e7388ab01bf3f0487ac
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Aug 23 13:23:00 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    ARM/div: Drop __div64_fls()
    
    Following the improvements to Xen's bitops, fls() does constant propagation 
in
    all cases.  Use it, and drop the local opencoded helper.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/include/asm/div64.h | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/include/asm/div64.h b/xen/arch/arm/include/asm/div64.h
index 0459d5cc01..da1f1fcbd5 100644
--- a/xen/arch/arm/include/asm/div64.h
+++ b/xen/arch/arm/include/asm/div64.h
@@ -102,7 +102,7 @@
                /* preserve low part of n for reminder computation */   \
                __r = __n;                                              \
                /* determine number of bits to represent __b */         \
-               __p = 1 << __div64_fls(__b);                            \
+               __p = 1 << fls(__b);                                    \
                /* compute __m = ((__p << 64) + __b - 1) / __b */       \
                __m = (~0ULL / __b) * __p;                              \
                __m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;     \
@@ -150,8 +150,8 @@
                                __p /= (__m & -__m);                    \
                                __m /= (__m & -__m);                    \
                        } else {                                        \
-                               __p >>= __div64_fls(__bits);            \
-                               __m >>= __div64_fls(__bits);            \
+                               __p >>= fls(__bits);                    \
+                               __m >>= fls(__bits);                    \
                        }                                               \
                        /* No correction needed. */                     \
                        __c = 0;                                        \
@@ -217,18 +217,6 @@
        __r;                                                            \
 })
 
-/* our own fls implementation to make sure constant propagation is fine */
-#define __div64_fls(bits)                                              \
-({                                                                     \
-       unsigned int __left = (bits), __nr = 0;                         \
-       if (__left & 0xffff0000) __nr += 16, __left >>= 16;             \
-       if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;             \
-       if (__left & 0x000000f0) __nr +=  4, __left >>=  4;             \
-       if (__left & 0x0000000c) __nr +=  2, __left >>=  2;             \
-       if (__left & 0x00000002) __nr +=  1;                            \
-       __nr;                                                           \
-})
-
 #endif /* GCC version */
 
 #endif /* BITS_PER_LONG */
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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