Go to the documentation of this file.
25 #include <linux/compiler.h>
26 #include <asm/byteorder.h>
27 #include <asm/atomic.h>
31 #define smp_mb__before_clear_bit() barrier()
32 #define smp_mb__after_clear_bit() barrier()
52 " {R10 = %1; R11 = asr(%2,#5); }\n"
53 " {R10 += asl(R11,#2); R11 = and(%2,#0x1f)}\n"
54 "1: R12 = memw_locked(R10);\n"
55 " { P0 = tstbit(R12,R11); R12 = clrbit(R12,R11); }\n"
56 " memw_locked(R10,P1) = R12;\n"
57 " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
59 :
"r" (addr),
"r" (nr)
60 :
"r10",
"r11",
"r12",
"p0",
"p1",
"memory"
76 " {R10 = %1; R11 = asr(%2,#5); }\n"
77 " {R10 += asl(R11,#2); R11 = and(%2,#0x1f)}\n"
78 "1: R12 = memw_locked(R10);\n"
79 " { P0 = tstbit(R12,R11); R12 = setbit(R12,R11); }\n"
80 " memw_locked(R10,P1) = R12;\n"
81 " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
83 :
"r" (addr),
"r" (nr)
84 :
"r10",
"r11",
"r12",
"p0",
"p1",
"memory"
102 " {R10 = %1; R11 = asr(%2,#5); }\n"
103 " {R10 += asl(R11,#2); R11 = and(%2,#0x1f)}\n"
104 "1: R12 = memw_locked(R10);\n"
105 " { P0 = tstbit(R12,R11); R12 = togglebit(R12,R11); }\n"
106 " memw_locked(R10,P1) = R12;\n"
107 " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n"
109 :
"r" (addr),
"r" (nr)
110 :
"r10",
"r11",
"r12",
"p0",
"p1",
"memory"
122 static inline void clear_bit(
int nr,
volatile void *addr)
127 static inline void set_bit(
int nr,
volatile void *addr)
132 static inline void change_bit(
int nr,
volatile void *addr)
146 static inline void __clear_bit(
int nr,
volatile unsigned long *addr)
151 static inline void __set_bit(
int nr,
volatile unsigned long *addr)
156 static inline void __change_bit(
int nr,
volatile unsigned long *addr)
177 static inline int __test_bit(
int nr,
const volatile unsigned long *addr)
182 "{P0 = tstbit(%1,%2); if (P0.new) %0 = #1; if (!P0.new) %0 = #0;}\n"
191 #define test_bit(nr, addr) __test_bit(nr, addr)
199 static inline long ffz(
int x)
203 asm(
"%0 = ct1(%1);\n"
216 static inline long fls(
int x)
220 asm(
"{ %0 = cl0(%1);}\n"
221 "%0 = sub(#32,%0);\n"
237 static inline long ffs(
int x)
241 asm(
"{ P0 = cmp.eq(%1,#0); %0 = ct0(%1);}\n"
242 "{ if P0 %0 = #0; if !P0 %0 = add(%0,#1);}\n"
259 static inline unsigned long __ffs(
unsigned long word)
263 asm(
"%0 = ct0(%1);\n"
277 static inline unsigned long __fls(
unsigned long word)
281 asm(
"%0 = cl0(%1);\n"
282 "%0 = sub(#31,%0);\n"