diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-11-11 03:28:18 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-01-27 23:18:45 -0500 |
commit | 63e2c803326babe74033b3cbe6e8c550037c554f (patch) | |
tree | 9a08d857d6d7f8fd8a73f3c5f600a2db90d2875c /include/asm-sh/bitops.h | |
parent | 079060c6ff6edd32955c3e511024578db89a717b (diff) |
sh: Plug in SH-5 ffz()/__ffs() bitops.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh/bitops.h')
-rw-r--r-- | include/asm-sh/bitops.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h index df805f20b267..a7bd81a7f064 100644 --- a/include/asm-sh/bitops.h +++ b/include/asm-sh/bitops.h | |||
@@ -105,6 +105,7 @@ static inline int test_and_change_bit(int nr, volatile void * addr) | |||
105 | 105 | ||
106 | #include <asm-generic/bitops/non-atomic.h> | 106 | #include <asm-generic/bitops/non-atomic.h> |
107 | 107 | ||
108 | #ifdef CONFIG_SUPERH32 | ||
108 | static inline unsigned long ffz(unsigned long word) | 109 | static inline unsigned long ffz(unsigned long word) |
109 | { | 110 | { |
110 | unsigned long result; | 111 | unsigned long result; |
@@ -138,6 +139,31 @@ static inline unsigned long __ffs(unsigned long word) | |||
138 | : "t"); | 139 | : "t"); |
139 | return result; | 140 | return result; |
140 | } | 141 | } |
142 | #else | ||
143 | static inline unsigned long ffz(unsigned long word) | ||
144 | { | ||
145 | unsigned long result, __d2, __d3; | ||
146 | |||
147 | __asm__("gettr tr0, %2\n\t" | ||
148 | "pta $+32, tr0\n\t" | ||
149 | "andi %1, 1, %3\n\t" | ||
150 | "beq %3, r63, tr0\n\t" | ||
151 | "pta $+4, tr0\n" | ||
152 | "0:\n\t" | ||
153 | "shlri.l %1, 1, %1\n\t" | ||
154 | "addi %0, 1, %0\n\t" | ||
155 | "andi %1, 1, %3\n\t" | ||
156 | "beqi %3, 1, tr0\n" | ||
157 | "1:\n\t" | ||
158 | "ptabs %2, tr0\n\t" | ||
159 | : "=r" (result), "=r" (word), "=r" (__d2), "=r" (__d3) | ||
160 | : "0" (0L), "1" (word)); | ||
161 | |||
162 | return result; | ||
163 | } | ||
164 | |||
165 | #include <asm-generic/bitops/__ffs.h> | ||
166 | #endif | ||
141 | 167 | ||
142 | #include <asm-generic/bitops/find.h> | 168 | #include <asm-generic/bitops/find.h> |
143 | #include <asm-generic/bitops/ffs.h> | 169 | #include <asm-generic/bitops/ffs.h> |