BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls_atomicoperations_powerpc32_aix_xlc.h
Go to the documentation of this file.
1/// @file bsls_atomicoperations_powerpc32_aix_xlc.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bsls_atomicoperations_powerpc32_aix_xlc.h -*-C++-*-
8#ifndef INCLUDED_BSLS_ATOMICOPERATIONS_POWERPC32_AIX_XLC
9#define INCLUDED_BSLS_ATOMICOPERATIONS_POWERPC32_AIX_XLC
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bsls_atomicoperations_powerpc32_aix_xlc bsls_atomicoperations_powerpc32_aix_xlc
15/// @brief Provide implementations of atomic operations for PowerPC/AIX-32bit.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bsls
19/// @{
20/// @addtogroup bsls_atomicoperations_powerpc32_aix_xlc
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bsls_atomicoperations_powerpc32_aix_xlc-purpose"> Purpose</a>
25/// * <a href="#bsls_atomicoperations_powerpc32_aix_xlc-classes"> Classes </a>
26/// * <a href="#bsls_atomicoperations_powerpc32_aix_xlc-description"> Description </a>
27///
28/// # Purpose {#bsls_atomicoperations_powerpc32_aix_xlc-purpose}
29/// Provide implementations of atomic operations for PowerPC/AIX-32bit.
30///
31/// # Classes {#bsls_atomicoperations_powerpc32_aix_xlc-classes}
32///
33/// - bsls::AtomicOperations_POWERPC32_AIX_XLC: atomics for PPC32/AIX.
34///
35/// # Description {#bsls_atomicoperations_powerpc32_aix_xlc-description}
36/// This component provides classes necessary to implement atomics
37/// on the AIX PowerPC platform in 32bit mode with the xlC compiler. The
38/// classes are for private use only. See @ref bsls_atomicoperations and
39/// @ref bsls_atomic for the public interface to atomics.
40/// @}
41/** @} */
42/** @} */
43
44/** @addtogroup bsl
45 * @{
46 */
47/** @addtogroup bsls
48 * @{
49 */
50/** @addtogroup bsls_atomicoperations_powerpc32_aix_xlc
51 * @{
52 */
53
54#include <bsls_atomicoperations_powerpc_aix_xlc_default.h>
55#include <bsls_platform.h>
56#include <bsls_types.h>
57
58#if defined(BSLS_PLATFORM_CPU_POWERPC) && defined(BSLS_PLATFORM_CMP_IBM) \
59 && defined(BSLS_PLATFORM_CPU_32_BIT)
60
61
62
63namespace bsls {
64
65 // *** functions implemented in assembly ***
66
67Types::Int64 AtomicOperations_Powerpc32_GetInt64(
68 const volatile Types::Int64 *atomicInt);
69Types::Int64 AtomicOperations_Powerpc32_GetInt64Relaxed(
70 const volatile Types::Int64 *atomicInt);
71Types::Int64 AtomicOperations_Powerpc32_GetInt64Acquire(
72 const volatile Types::Int64 *atomicInt);
73
74} // close package namespace
75
76 // *** extern "C" functions due to prototype hacks ***
77
78extern "C"
79void bsls_AtomicOperations_Powerpc32_SetInt64(
80 volatile bsls::Types::Int64 *atomicInt,
81 bsls::Types::Int64 value);
82
83extern "C"
84void bsls_AtomicOperations_Powerpc32_SetInt64Relaxed(
85 volatile bsls::Types::Int64 *atomicInt,
86 bsls::Types::Int64 value);
87
88extern "C"
89void bsls_AtomicOperations_Powerpc32_SetInt64Release(
90 volatile bsls::Types::Int64 *atomicInt,
91 bsls::Types::Int64 value);
92
93extern "C"
94bsls::Types::Int64 bsls_AtomicOperations_Powerpc32_SwapInt64(
95 volatile bsls::Types::Int64 *atomicInt,
96 bsls::Types::Int64 value);
97
98extern "C"
99bsls::Types::Int64 bsls_AtomicOperations_Powerpc32_SwapInt64AcqRel(
100 volatile bsls::Types::Int64 *atomicInt,
101 bsls::Types::Int64 value);
102
103extern "C"
104bsls::Types::Int64 bsls_AtomicOperations_Powerpc32_testAndSwapInt64(
105 volatile bsls::Types::Int64 *atomicInt,
106 bsls::Types::Int64 compareValue,
107 bsls::Types::Int64 swapValue);
108
109extern "C"
110bsls::Types::Int64 bsls_AtomicOperations_Powerpc32_testAndSwapInt64AcqRel(
111 volatile bsls::Types::Int64 *atomicInt,
112 bsls::Types::Int64 compareValue,
113 bsls::Types::Int64 swapValue);
114
115extern "C"
116bsls::Types::Int64 bsls_AtomicOperations_Powerpc32_AddInt64(
117 volatile bsls::Types::Int64 *atomicInt,
118 bsls::Types::Int64 value);
119
120extern "C"
121bsls::Types::Int64 bsls_AtomicOperations_Powerpc32_AddInt64Relaxed(
122 volatile bsls::Types::Int64 *atomicInt,
123 bsls::Types::Int64 value);
124
125extern "C"
126bsls::Types::Int64 bsls_AtomicOperations_Powerpc32_AddInt64AcqRel(
127 volatile bsls::Types::Int64 *atomicInt,
128 bsls::Types::Int64 value);
129
130namespace bsls {
131
132struct AtomicOperations_POWERPC32_AIX_XLC;
133typedef AtomicOperations_POWERPC32_AIX_XLC AtomicOperations_Imp;
134
135 // ============================================================
136 // struct Atomic_TypeTraits<AtomicOperations_POWERPC32_AIX_XLC>
137 // ============================================================
138
139template <>
140struct Atomic_TypeTraits<AtomicOperations_POWERPC32_AIX_XLC>
141{
142 struct Int
143 {
144 volatile int d_value __attribute__((__aligned__(sizeof(int))));
145 };
146
147 struct Int64
148 {
149 volatile Types::Int64 d_value
150 __attribute__((__aligned__(sizeof(Types::Int64))));
151 };
152
153 struct Uint
154 {
155 volatile unsigned int d_value
156 __attribute__((__aligned__(sizeof(unsigned int))));
157 };
158
159 struct Uint64
160 {
161 volatile Types::Uint64 d_value
162 __attribute__((__aligned__(sizeof(Types::Uint64))));
163 };
164
165 struct Pointer
166 {
167 void * volatile d_value __attribute__((__aligned__(sizeof(void *))));
168 };
169};
170
171 // =========================================
172 // struct AtomicOperations_POWERPC32_AIX_XLC
173 // =========================================
174
175struct AtomicOperations_POWERPC32_AIX_XLC
176 : AtomicOperations_POWERPC_AIX_XLC_Default32<
177 AtomicOperations_POWERPC32_AIX_XLC>
178{
179 typedef Atomic_TypeTraits<AtomicOperations_POWERPC32_AIX_XLC>
180 AtomicTypes;
181
182 // *** atomic functions for Int64 ***
183
184 static Types::Int64 getInt64(const AtomicTypes::Int64 *atomicInt);
185
186 static Types::Int64 getInt64Relaxed(const AtomicTypes::Int64 *atomicInt);
187
188 static Types::Int64 getInt64Acquire(const AtomicTypes::Int64 *atomicInt);
189
190 static void setInt64(AtomicTypes::Int64 *atomicInt, Types::Int64 value);
191
192 static void setInt64Relaxed(AtomicTypes::Int64 *atomicInt,
193 Types::Int64 value);
194
195 static void setInt64Release(AtomicTypes::Int64 *atomicInt,
196 Types::Int64 value);
197
198 static Types::Int64 swapInt64(AtomicTypes::Int64 *atomicInt,
199 Types::Int64 swapValue);
200
201 static Types::Int64 swapInt64AcqRel(AtomicTypes::Int64 *atomicInt,
202 Types::Int64 swapValue);
203
204 static Types::Int64 testAndSwapInt64(AtomicTypes::Int64 *atomicInt,
205 Types::Int64 compareValue,
206 Types::Int64 swapValue);
207
208 static Types::Int64 testAndSwapInt64AcqRel(AtomicTypes::Int64 *atomicInt,
209 Types::Int64 compareValue,
210 Types::Int64 swapValue);
211
212 static Types::Int64 addInt64Nv(AtomicTypes::Int64 *atomicInt,
213 Types::Int64 value);
214
215 static Types::Int64 addInt64NvRelaxed(AtomicTypes::Int64 *atomicInt,
216 Types::Int64 value);
217
218 static Types::Int64 addInt64NvAcqRel(AtomicTypes::Int64 *atomicInt,
219 Types::Int64 value);
220};
221
222// ===========================================================================
223// INLINE FUNCTION DEFINITIONS
224// ===========================================================================
225
226 // -----------------------------------------
227 // struct AtomicOperations_POWERPC32_AIX_XLC
228 // -----------------------------------------
229
230inline
231Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
232 getInt64(const AtomicTypes::Int64 *atomicInt)
233{
234 return AtomicOperations_Powerpc32_GetInt64(&atomicInt->d_value);
235}
236
237inline
238Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
239 getInt64Relaxed(const AtomicTypes::Int64 *atomicInt)
240{
241 return AtomicOperations_Powerpc32_GetInt64Relaxed(&atomicInt->d_value);
242}
243
244inline
245Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
246 getInt64Acquire(const AtomicTypes::Int64 *atomicInt)
247{
248 return AtomicOperations_Powerpc32_GetInt64Acquire(&atomicInt->d_value);
249}
250
251inline
252void AtomicOperations_POWERPC32_AIX_XLC::
253 setInt64(AtomicTypes::Int64 *atomicInt, Types::Int64 value)
254{
255 bsls_AtomicOperations_Powerpc32_SetInt64(&atomicInt->d_value, value);
256}
257
258inline
259void AtomicOperations_POWERPC32_AIX_XLC::
260 setInt64Relaxed(AtomicTypes::Int64 *atomicInt, Types::Int64 value)
261{
262 bsls_AtomicOperations_Powerpc32_SetInt64Relaxed(&atomicInt->d_value,
263 value);
264}
265
266inline
267void AtomicOperations_POWERPC32_AIX_XLC::
268 setInt64Release(AtomicTypes::Int64 *atomicInt, Types::Int64 value)
269{
270 bsls_AtomicOperations_Powerpc32_SetInt64Release(&atomicInt->d_value,
271 value);
272}
273
274inline
275Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
276 swapInt64(AtomicTypes::Int64 *atomicInt,
277 Types::Int64 swapValue)
278{
279 return bsls_AtomicOperations_Powerpc32_SwapInt64(&atomicInt->d_value,
280 swapValue);
281}
282
283inline
284Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
285 swapInt64AcqRel(AtomicTypes::Int64 *atomicInt,
286 Types::Int64 swapValue)
287{
288 return bsls_AtomicOperations_Powerpc32_SwapInt64AcqRel(&atomicInt->d_value,
289 swapValue);
290}
291
292inline
293Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
294 testAndSwapInt64(AtomicTypes::Int64 *atomicInt,
295 Types::Int64 compareValue,
296 Types::Int64 swapValue)
297{
298 return bsls_AtomicOperations_Powerpc32_testAndSwapInt64(
299 &atomicInt->d_value,
300 compareValue,
301 swapValue);
302}
303
304inline
305Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
306 testAndSwapInt64AcqRel(AtomicTypes::Int64 *atomicInt,
307 Types::Int64 compareValue,
308 Types::Int64 swapValue)
309{
310 return bsls_AtomicOperations_Powerpc32_testAndSwapInt64AcqRel(
311 &atomicInt->d_value,
312 compareValue,
313 swapValue);
314}
315
316inline
317Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
318 addInt64Nv(AtomicTypes::Int64 *atomicInt,
319 Types::Int64 value)
320{
321 return bsls_AtomicOperations_Powerpc32_AddInt64(&atomicInt->d_value,
322 value);
323}
324
325inline
326Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
327 addInt64NvRelaxed(AtomicTypes::Int64 *atomicInt,
328 Types::Int64 value)
329{
330 return bsls_AtomicOperations_Powerpc32_AddInt64Relaxed(&atomicInt->d_value,
331 value);
332}
333
334inline
335Types::Int64 AtomicOperations_POWERPC32_AIX_XLC::
336 addInt64NvAcqRel(AtomicTypes::Int64 *atomicInt,
337 Types::Int64 value)
338{
339 return bsls_AtomicOperations_Powerpc32_AddInt64AcqRel(&atomicInt->d_value,
340 value);
341}
342
343} // close package namespace
344
345
346
347#endif
348
349#endif
350
351// ----------------------------------------------------------------------------
352// Copyright 2013 Bloomberg Finance L.P.
353//
354// Licensed under the Apache License, Version 2.0 (the "License");
355// you may not use this file except in compliance with the License.
356// You may obtain a copy of the License at
357//
358// http://www.apache.org/licenses/LICENSE-2.0
359//
360// Unless required by applicable law or agreed to in writing, software
361// distributed under the License is distributed on an "AS IS" BASIS,
362// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
363// See the License for the specific language governing permissions and
364// limitations under the License.
365// ----------------------------- END-OF-FILE ----------------------------------
366
367/** @} */
368/** @} */
369/** @} */
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlt_iso8601util.h:691
long long Int64
Definition bsls_types.h:132