15 // You should have received a copy of the GNU General Public License version
16 // 2 along with this work; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 // or visit www.oracle.com if you need additional information or have any
21 // questions.
22 //
23 //
24
25 // Get the raw thread ID from %g7
26
27 .inline _raw_thread_id, 0
28 .register %g7,#scratch
29 .volatile
30 mov %g7, %o0
31 .nonvolatile
32 .end
33
34
35 // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest).
36 //
37 // Arguments:
38 // exchange_value: O0
39 // dest: O1
40 //
41 // Results:
42 // O0: the value previously stored in dest
43
44 .inline _Atomic_swap32, 2
45 .volatile
46 swap [%o1],%o0
47 .nonvolatile
48 .end
49
50
51 // Support for intptr_t Atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t * dest).
52 //
53 // 64-bit
54 //
55 // Arguments:
56 // exchange_value: O0
57 // dest: O1
58 //
59 // Results:
60 // O0: the value previously stored in dest
61
62 .inline _Atomic_swap64, 2
63 .volatile
64 1:
65 mov %o0, %o3
66 ldx [%o1], %o2
67 casx [%o1], %o2, %o3
68 cmp %o2, %o3
69 bne %xcc, 1b
70 nop
71 mov %o2, %o0
72 .nonvolatile
73 .end
74
75
76 // Support for jint Atomic::cmpxchg(jint exchange_value,
77 // volatile jint* dest,
78 // jint compare_value)
79 //
80 // Arguments:
81 // exchange_value: O0
82 // dest: O1
83 // compare_value: O2
84 //
85 // Results:
86 // O0: the value previously stored in dest
87
88 .inline _Atomic_cas32, 3
89 .volatile
90 cas [%o1], %o2, %o0
91 .nonvolatile
92 .end
93
94
95 // Support for intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value,
96 // volatile intptr_t* dest,
97 // intptr_t compare_value)
98 //
99 // 64-bit
100 //
101 // Arguments:
102 // exchange_value: O0
103 // dest: O1
104 // compare_value: O2
105 //
106 // Results:
107 // O0: the value previously stored in dest
108
109 .inline _Atomic_cas64, 3
110 .volatile
111 casx [%o1], %o2, %o0
112 .nonvolatile
113 .end
114
115
116 // Support for jlong Atomic::cmpxchg(jlong exchange_value,
117 // volatile jlong* dest,
118 // jlong compare_value)
119 //
120 // 32-bit calling conventions
121 //
122 // Arguments:
123 // exchange_value: O1:O0
124 // dest: O2
125 // compare_value: O4:O3
126 //
127 // Results:
128 // O1:O0: the value previously stored in dest
129
130 .inline _Atomic_casl, 3
131 .volatile
132 sllx %o0, 32, %o0
133 srl %o1, 0, %o1
134 or %o0,%o1,%o0
135 sllx %o3, 32, %o3
136 srl %o4, 0, %o4
137 or %o3,%o4,%o3
138 casx [%o2], %o3, %o0
139 srl %o0, 0, %o1
140 srlx %o0, 32, %o0
141 .nonvolatile
142 .end
143
144 // Support for jlong Atomic::load and Atomic::store on v9.
145 //
146 // void _Atomic_move_long_v9(volatile jlong* src, volatile jlong* dst)
147 //
148 // Arguments:
149 // src: O0
150 // dest: O1
151 //
152 // Overwrites O2
153
154 .inline _Atomic_move_long_v9,2
155 .volatile
156 ldx [%o0], %o2
157 stx %o2, [%o1]
158 .nonvolatile
159 .end
160
161 // Support for jint Atomic::add(jint add_value, volatile jint* dest).
162 //
163 // Arguments:
164 // add_value: O0 (e.g., +1 or -1)
165 // dest: O1
166 //
167 // Results:
168 // O0: the new value stored in dest
169 //
170 // Overwrites O3
171
172 .inline _Atomic_add32, 2
173 .volatile
174 2:
175 ld [%o1], %o2
176 add %o0, %o2, %o3
177 cas [%o1], %o2, %o3
178 cmp %o2, %o3
179 bne 2b
180 nop
181 add %o0, %o2, %o0
182 .nonvolatile
183 .end
184
185
186 // Support for intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest)
187 //
188 // 64-bit
189 //
190 // Arguments:
191 // add_value: O0 (e.g., +1 or -1)
192 // dest: O1
193 //
194 // Results:
195 // O0: the new value stored in dest
196 //
197 // Overwrites O3
198
199 .inline _Atomic_add64, 2
200 .volatile
201 3:
202 ldx [%o1], %o2
203 add %o0, %o2, %o3
204 casx [%o1], %o2, %o3
205 cmp %o2, %o3
206 bne %xcc, 3b
|
15 // You should have received a copy of the GNU General Public License version
16 // 2 along with this work; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 // or visit www.oracle.com if you need additional information or have any
21 // questions.
22 //
23 //
24
25 // Get the raw thread ID from %g7
26
27 .inline _raw_thread_id, 0
28 .register %g7,#scratch
29 .volatile
30 mov %g7, %o0
31 .nonvolatile
32 .end
33
34
35 // Support for int32_t GeneralizedAtomic::specialized_xchg(int32_t exchange_value, volatile int32_t* dest).
36 //
37 // Arguments:
38 // exchange_value: O0
39 // dest: O1
40 //
41 // Results:
42 // O0: the value previously stored in dest
43
44 .inline _Atomic_swap32, 2
45 .volatile
46 swap [%o1],%o0
47 .nonvolatile
48 .end
49
50
51 // Support for int64_t GeneralizedAtomic::specialized_xchg(int64_t exchange_value, volatile int64_t * dest).
52 //
53 // 64-bit
54 //
55 // Arguments:
56 // exchange_value: O0
57 // dest: O1
58 //
59 // Results:
60 // O0: the value previously stored in dest
61
62 .inline _Atomic_swap64, 2
63 .volatile
64 1:
65 mov %o0, %o3
66 ldx [%o1], %o2
67 casx [%o1], %o2, %o3
68 cmp %o2, %o3
69 bne %xcc, 1b
70 nop
71 mov %o2, %o0
72 .nonvolatile
73 .end
74
75
76 // Support for int32_t GeneralizedAtomic::specialized_cmpxchg(int32_t exchange_value,
77 // volatile int32_t* dest,
78 // int32_t compare_value)
79 //
80 // Arguments:
81 // exchange_value: O0
82 // dest: O1
83 // compare_value: O2
84 //
85 // Results:
86 // O0: the value previously stored in dest
87
88 .inline _Atomic_cas32, 3
89 .volatile
90 cas [%o1], %o2, %o0
91 .nonvolatile
92 .end
93
94
95 // Support for int64_t GeneralizedAtomic::specialized_cmpxchg(int64_t exchange_value,
96 // volatile int64_t* dest,
97 // int64_t compare_value)
98 //
99 // 64-bit
100 //
101 // Arguments:
102 // exchange_value: O0
103 // dest: O1
104 // compare_value: O2
105 //
106 // Results:
107 // O0: the value previously stored in dest
108
109 .inline _Atomic_cas64, 3
110 .volatile
111 casx [%o1], %o2, %o0
112 .nonvolatile
113 .end
114
115
116 // Support for int32_t GeneralizedAtomic::specialized_add(int32_t add_value, volatile int32_t* dest).
117 //
118 // Arguments:
119 // add_value: O0 (e.g., +1 or -1)
120 // dest: O1
121 //
122 // Results:
123 // O0: the new value stored in dest
124 //
125 // Overwrites O3
126
127 .inline _Atomic_add32, 2
128 .volatile
129 2:
130 ld [%o1], %o2
131 add %o0, %o2, %o3
132 cas [%o1], %o2, %o3
133 cmp %o2, %o3
134 bne 2b
135 nop
136 add %o0, %o2, %o0
137 .nonvolatile
138 .end
139
140
141 // Support for int64_t GeneralizedAtomic::specialized_add(int64_t add_value, volatile int64_t* dest)
142 //
143 // 64-bit
144 //
145 // Arguments:
146 // add_value: O0 (e.g., +1 or -1)
147 // dest: O1
148 //
149 // Results:
150 // O0: the new value stored in dest
151 //
152 // Overwrites O3
153
154 .inline _Atomic_add64, 2
155 .volatile
156 3:
157 ldx [%o1], %o2
158 add %o0, %o2, %o3
159 casx [%o1], %o2, %o3
160 cmp %o2, %o3
161 bne %xcc, 3b
|