bitops.S (e5451c8f8330e03ad3cfa16048b4daf961af434f) bitops.S (d3867f0483103b8ff7edfdea3ef1981c03d96891)
1/* bitops.S: Sparc64 atomic bit operations.
2 *
3 * Copyright (C) 2000, 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/linkage.h>
7#include <asm/asi.h>
8#include <asm/backoff.h>
1/* bitops.S: Sparc64 atomic bit operations.
2 *
3 * Copyright (C) 2000, 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/linkage.h>
7#include <asm/asi.h>
8#include <asm/backoff.h>
9#include <asm/export.h>
9
10 .text
11
12ENTRY(test_and_set_bit) /* %o0=nr, %o1=addr */
13 BACKOFF_SETUP(%o3)
14 srlx %o0, 6, %g1
15 mov 1, %o2
16 sllx %g1, 3, %g3

--- 7 unchanged lines hidden (view full) ---

24 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
25 and %g7, %o2, %g2
26 clr %o0
27 movrne %g2, 1, %o0
28 retl
29 nop
302: BACKOFF_SPIN(%o3, %o4, 1b)
31ENDPROC(test_and_set_bit)
10
11 .text
12
13ENTRY(test_and_set_bit) /* %o0=nr, %o1=addr */
14 BACKOFF_SETUP(%o3)
15 srlx %o0, 6, %g1
16 mov 1, %o2
17 sllx %g1, 3, %g3

--- 7 unchanged lines hidden (view full) ---

25 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
26 and %g7, %o2, %g2
27 clr %o0
28 movrne %g2, 1, %o0
29 retl
30 nop
312: BACKOFF_SPIN(%o3, %o4, 1b)
32ENDPROC(test_and_set_bit)
33EXPORT_SYMBOL(test_and_set_bit)
32
33ENTRY(test_and_clear_bit) /* %o0=nr, %o1=addr */
34 BACKOFF_SETUP(%o3)
35 srlx %o0, 6, %g1
36 mov 1, %o2
37 sllx %g1, 3, %g3
38 and %o0, 63, %g2
39 sllx %o2, %g2, %o2

--- 5 unchanged lines hidden (view full) ---

45 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
46 and %g7, %o2, %g2
47 clr %o0
48 movrne %g2, 1, %o0
49 retl
50 nop
512: BACKOFF_SPIN(%o3, %o4, 1b)
52ENDPROC(test_and_clear_bit)
34
35ENTRY(test_and_clear_bit) /* %o0=nr, %o1=addr */
36 BACKOFF_SETUP(%o3)
37 srlx %o0, 6, %g1
38 mov 1, %o2
39 sllx %g1, 3, %g3
40 and %o0, 63, %g2
41 sllx %o2, %g2, %o2

--- 5 unchanged lines hidden (view full) ---

47 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
48 and %g7, %o2, %g2
49 clr %o0
50 movrne %g2, 1, %o0
51 retl
52 nop
532: BACKOFF_SPIN(%o3, %o4, 1b)
54ENDPROC(test_and_clear_bit)
55EXPORT_SYMBOL(test_and_clear_bit)
53
54ENTRY(test_and_change_bit) /* %o0=nr, %o1=addr */
55 BACKOFF_SETUP(%o3)
56 srlx %o0, 6, %g1
57 mov 1, %o2
58 sllx %g1, 3, %g3
59 and %o0, 63, %g2
60 sllx %o2, %g2, %o2

--- 5 unchanged lines hidden (view full) ---

66 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
67 and %g7, %o2, %g2
68 clr %o0
69 movrne %g2, 1, %o0
70 retl
71 nop
722: BACKOFF_SPIN(%o3, %o4, 1b)
73ENDPROC(test_and_change_bit)
56
57ENTRY(test_and_change_bit) /* %o0=nr, %o1=addr */
58 BACKOFF_SETUP(%o3)
59 srlx %o0, 6, %g1
60 mov 1, %o2
61 sllx %g1, 3, %g3
62 and %o0, 63, %g2
63 sllx %o2, %g2, %o2

--- 5 unchanged lines hidden (view full) ---

69 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
70 and %g7, %o2, %g2
71 clr %o0
72 movrne %g2, 1, %o0
73 retl
74 nop
752: BACKOFF_SPIN(%o3, %o4, 1b)
76ENDPROC(test_and_change_bit)
77EXPORT_SYMBOL(test_and_change_bit)
74
75ENTRY(set_bit) /* %o0=nr, %o1=addr */
76 BACKOFF_SETUP(%o3)
77 srlx %o0, 6, %g1
78 mov 1, %o2
79 sllx %g1, 3, %g3
80 and %o0, 63, %g2
81 sllx %o2, %g2, %o2
82 add %o1, %g3, %o1
831: ldx [%o1], %g7
84 or %g7, %o2, %g1
85 casx [%o1], %g7, %g1
86 cmp %g7, %g1
87 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
88 nop
89 retl
90 nop
912: BACKOFF_SPIN(%o3, %o4, 1b)
92ENDPROC(set_bit)
78
79ENTRY(set_bit) /* %o0=nr, %o1=addr */
80 BACKOFF_SETUP(%o3)
81 srlx %o0, 6, %g1
82 mov 1, %o2
83 sllx %g1, 3, %g3
84 and %o0, 63, %g2
85 sllx %o2, %g2, %o2
86 add %o1, %g3, %o1
871: ldx [%o1], %g7
88 or %g7, %o2, %g1
89 casx [%o1], %g7, %g1
90 cmp %g7, %g1
91 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
92 nop
93 retl
94 nop
952: BACKOFF_SPIN(%o3, %o4, 1b)
96ENDPROC(set_bit)
97EXPORT_SYMBOL(set_bit)
93
94ENTRY(clear_bit) /* %o0=nr, %o1=addr */
95 BACKOFF_SETUP(%o3)
96 srlx %o0, 6, %g1
97 mov 1, %o2
98 sllx %g1, 3, %g3
99 and %o0, 63, %g2
100 sllx %o2, %g2, %o2
101 add %o1, %g3, %o1
1021: ldx [%o1], %g7
103 andn %g7, %o2, %g1
104 casx [%o1], %g7, %g1
105 cmp %g7, %g1
106 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
107 nop
108 retl
109 nop
1102: BACKOFF_SPIN(%o3, %o4, 1b)
111ENDPROC(clear_bit)
98
99ENTRY(clear_bit) /* %o0=nr, %o1=addr */
100 BACKOFF_SETUP(%o3)
101 srlx %o0, 6, %g1
102 mov 1, %o2
103 sllx %g1, 3, %g3
104 and %o0, 63, %g2
105 sllx %o2, %g2, %o2
106 add %o1, %g3, %o1
1071: ldx [%o1], %g7
108 andn %g7, %o2, %g1
109 casx [%o1], %g7, %g1
110 cmp %g7, %g1
111 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
112 nop
113 retl
114 nop
1152: BACKOFF_SPIN(%o3, %o4, 1b)
116ENDPROC(clear_bit)
117EXPORT_SYMBOL(clear_bit)
112
113ENTRY(change_bit) /* %o0=nr, %o1=addr */
114 BACKOFF_SETUP(%o3)
115 srlx %o0, 6, %g1
116 mov 1, %o2
117 sllx %g1, 3, %g3
118 and %o0, 63, %g2
119 sllx %o2, %g2, %o2
120 add %o1, %g3, %o1
1211: ldx [%o1], %g7
122 xor %g7, %o2, %g1
123 casx [%o1], %g7, %g1
124 cmp %g7, %g1
125 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
126 nop
127 retl
128 nop
1292: BACKOFF_SPIN(%o3, %o4, 1b)
130ENDPROC(change_bit)
118
119ENTRY(change_bit) /* %o0=nr, %o1=addr */
120 BACKOFF_SETUP(%o3)
121 srlx %o0, 6, %g1
122 mov 1, %o2
123 sllx %g1, 3, %g3
124 and %o0, 63, %g2
125 sllx %o2, %g2, %o2
126 add %o1, %g3, %o1
1271: ldx [%o1], %g7
128 xor %g7, %o2, %g1
129 casx [%o1], %g7, %g1
130 cmp %g7, %g1
131 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
132 nop
133 retl
134 nop
1352: BACKOFF_SPIN(%o3, %o4, 1b)
136ENDPROC(change_bit)
137EXPORT_SYMBOL(change_bit)