@@ -26,14 +26,15 @@
*/
.macro bitop, name, instr
ENTRY( \name )
- and w3, w0, #63 // Get bit offset
+ and w3, w0, #31 // Get bit offset
eor w0, w0, w3 // Clear low bits
mov x2, #1
- add x1, x1, x0, lsr #3 // Get word offset
+ lsr x0, x0, #5
+ add x1, x1, x0, lsl #2 // Get word offset
lsl x3, x2, x3 // Create mask
-1: ldxr x2, [x1]
- \instr x2, x2, x3
- stxr w0, x2, [x1]
+1: ldxr w2, [x1]
+ \instr w2, w2, w3
+ stxr w0, w2, [x1]
cbnz w0, 1b
ret
ENDPROC(\name )
@@ -41,15 +42,16 @@ ENDPROC(\name )
.macro testop, name, instr
ENTRY( \name )
- and w3, w0, #63 // Get bit offset
+ and w3, w0, #31 // Get bit offset
eor w0, w0, w3 // Clear low bits
mov x2, #1
- add x1, x1, x0, lsr #3 // Get word offset
+ lsr x0, x0, #5
+ add x1, x1, x0, lsl #2 // Get word offset
lsl x4, x2, x3 // Create mask
-1: ldxr x2, [x1]
+1: ldxr w2, [x1]
lsr x0, x2, x3 // Save old value of bit
- \instr x2, x2, x4 // toggle bit
- stlxr w5, x2, [x1]
+ \instr w2, w2, w4 // toggle bit
+ stlxr w5, w2, [x1]
cbnz w5, 1b
dmb ish
and x0, x0, #1