diff options
Diffstat (limited to 'include/asm-frv/bitops.h')
-rw-r--r-- | include/asm-frv/bitops.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h index 980ae1b0cd28..97fb746f76c7 100644 --- a/include/asm-frv/bitops.h +++ b/include/asm-frv/bitops.h | |||
@@ -161,16 +161,29 @@ static inline int __test_bit(int nr, const volatile void * addr) | |||
161 | #include <asm-generic/bitops/__ffs.h> | 161 | #include <asm-generic/bitops/__ffs.h> |
162 | #include <asm-generic/bitops/find.h> | 162 | #include <asm-generic/bitops/find.h> |
163 | 163 | ||
164 | /* | 164 | /** |
165 | * fls: find last bit set. | 165 | * fls - find last bit set |
166 | * @x: the word to search | ||
167 | * | ||
168 | * This is defined the same way as ffs: | ||
169 | * - return 32..1 to indicate bit 31..0 most significant bit set | ||
170 | * - return 0 to indicate no bits set | ||
166 | */ | 171 | */ |
167 | #define fls(x) \ | 172 | #define fls(x) \ |
168 | ({ \ | 173 | ({ \ |
169 | int bit; \ | 174 | int bit; \ |
170 | \ | 175 | \ |
171 | asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x)); \ | 176 | asm(" subcc %1,gr0,gr0,icc0 \n" \ |
177 | " ckne icc0,cc4 \n" \ | ||
178 | " cscan.p %1,gr0,%0 ,cc4,#1 \n" \ | ||
179 | " csub %0,%0,%0 ,cc4,#0 \n" \ | ||
180 | " csub %2,%0,%0 ,cc4,#1 \n" \ | ||
181 | : "=&r"(bit) \ | ||
182 | : "r"(x), "r"(32) \ | ||
183 | : "icc0", "cc4" \ | ||
184 | ); \ | ||
172 | \ | 185 | \ |
173 | bit ? 33 - bit : bit; \ | 186 | bit; \ |
174 | }) | 187 | }) |
175 | 188 | ||
176 | #include <asm-generic/bitops/fls64.h> | 189 | #include <asm-generic/bitops/fls64.h> |