x86, UML: remove x86-specific implementations of find_first_bit
[sfrench/cifs-2.6.git] / include / asm-x86 / bitops_64.h
index 7118ef2cc4ec34a4b9f74c9c3d8d35be082ce98c..cb23122d23f1b091e02fb0fd057c7e6339bb69a1 100644 (file)
@@ -4,27 +4,6 @@
 /*
  * Copyright 1992, Linus Torvalds.
  */
-
-extern long find_first_zero_bit(const unsigned long *addr, unsigned long size);
-extern long find_first_bit(const unsigned long *addr, unsigned long size);
-
-/* return index of first bet set in val or max when no bit is set */
-static inline long __scanbit(unsigned long val, unsigned long max)
-{
-       asm("bsfq %1,%0 ; cmovz %2,%0" : "=&r" (val) : "r" (val), "r" (max));
-       return val;
-}
-
-#define find_first_bit(addr, size)                                     \
-       ((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG       \
-         ? (__scanbit(*(unsigned long *)(addr), (size)))               \
-         : find_first_bit((addr), (size))))
-
-#define find_first_zero_bit(addr, size)                                        \
-       ((__builtin_constant_p((size)) && (size) <= BITS_PER_LONG       \
-         ? (__scanbit(~*(unsigned long *)(addr), (size)))              \
-         : find_first_zero_bit((addr), (size))))
-
 static inline void set_bit_string(unsigned long *bitmap, unsigned long i,
                                  int len)
 {
@@ -35,105 +14,18 @@ static inline void set_bit_string(unsigned long *bitmap, unsigned long i,
        }
 }
 
-/**
- * ffz - find first zero in word.
- * @word: The word to search
- *
- * Undefined if no zero exists, so code should check against ~0UL first.
- */
-static inline unsigned long ffz(unsigned long word)
-{
-       __asm__("bsfq %1,%0"
-               :"=r" (word)
-               :"r" (~word));
-       return word;
-}
-
-/**
- * __ffs - find first bit in word.
- * @word: The word to search
- *
- * Undefined if no bit exists, so code should check against 0 first.
- */
-static inline unsigned long __ffs(unsigned long word)
-{
-       __asm__("bsfq %1,%0"
-               :"=r" (word)
-               :"rm" (word));
-       return word;
-}
-
-/*
- * __fls: find last bit set.
- * @word: The word to search
- *
- * Undefined if no zero exists, so code should check against ~0UL first.
- */
-static inline unsigned long __fls(unsigned long word)
-{
-       __asm__("bsrq %1,%0"
-               :"=r" (word)
-               :"rm" (word));
-       return word;
-}
-
 #ifdef __KERNEL__
 
 #include <asm-generic/bitops/sched.h>
 
-/**
- * ffs - find first bit set
- * @x: the word to search
- *
- * This is defined the same way as
- * the libc and compiler builtin ffs routines, therefore
- * differs in spirit from the above ffz (man ffs).
- */
-static inline int ffs(int x)
-{
-       int r;
-
-       __asm__("bsfl %1,%0\n\t"
-               "cmovzl %2,%0" 
-               : "=r" (r) : "rm" (x), "r" (-1));
-       return r+1;
-}
-
-/**
- * fls64 - find last bit set in 64 bit word
- * @x: the word to search
- *
- * This is defined the same way as fls.
- */
-static inline int fls64(__u64 x)
-{
-       if (x == 0)
-               return 0;
-       return __fls(x) + 1;
-}
-
-/**
- * fls - find last bit set
- * @x: the word to search
- *
- * This is defined the same way as ffs.
- */
-static inline int fls(int x)
-{
-       int r;
-
-       __asm__("bsrl %1,%0\n\t"
-               "cmovzl %2,%0"
-               : "=&r" (r) : "rm" (x), "rm" (-1));
-       return r+1;
-}
-
 #define ARCH_HAS_FAST_MULTIPLIER 1
 
 #include <asm-generic/bitops/hweight.h>
 
 #endif /* __KERNEL__ */
 
+#include <asm-generic/bitops/fls64.h>
+
 #ifdef __KERNEL__
 
 #include <asm-generic/bitops/ext2-non-atomic.h>