PAPI 7.1.0.0
Loading...
Searching...
No Matches
gcc/powerpc.h File Reference
Include dependency graph for gcc/powerpc.h:

Go to the source code of this file.

Macros

#define AO_HAVE_nop_full
 
#define AO_nop_write()   AO_lwsync()
 
#define AO_HAVE_nop_write
 
#define AO_nop_read()   AO_lwsync()
 
#define AO_HAVE_nop_read
 
#define AO_PPC_LD   "lwz"
 
#define AO_PPC_LxARX   "lwarx"
 
#define AO_PPC_CMPx   "cmpw"
 
#define AO_PPC_STxCXd   "stwcx."
 
#define AO_PPC_LOAD_CLOBBER   "cc"
 
#define AO_T_IS_INT
 
#define AO_PPC_L(label)   label ": "
 
#define AO_PPC_BR_A(labelBF, addr)   labelBF
 
#define AO_HAVE_load_acquire
 
#define AO_HAVE_store_release
 
#define AO_HAVE_test_and_set
 
#define AO_HAVE_test_and_set_acquire
 
#define AO_HAVE_test_and_set_release
 
#define AO_HAVE_test_and_set_full
 
#define AO_HAVE_compare_and_swap
 
#define AO_HAVE_compare_and_swap_acquire
 
#define AO_HAVE_compare_and_swap_release
 
#define AO_HAVE_compare_and_swap_full
 
#define AO_HAVE_fetch_compare_and_swap
 
#define AO_HAVE_fetch_compare_and_swap_acquire
 
#define AO_HAVE_fetch_compare_and_swap_release
 
#define AO_HAVE_fetch_compare_and_swap_full
 
#define AO_HAVE_fetch_and_add
 
#define AO_HAVE_fetch_and_add_acquire
 
#define AO_HAVE_fetch_and_add_release
 
#define AO_HAVE_fetch_and_add_full
 

Functions

AO_INLINE void AO_nop_full (void)
 
AO_INLINE void AO_lwsync (void)
 
AO_INLINE AO_t AO_load_acquire (const volatile AO_t *addr)
 
AO_INLINE void AO_store_release (volatile AO_t *addr, AO_t value)
 
AO_INLINE AO_TS_VAL_t AO_test_and_set (volatile AO_TS_t *addr)
 
AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire (volatile AO_TS_t *addr)
 
AO_INLINE AO_TS_VAL_t AO_test_and_set_release (volatile AO_TS_t *addr)
 
AO_INLINE AO_TS_VAL_t AO_test_and_set_full (volatile AO_TS_t *addr)
 
AO_INLINE int AO_compare_and_swap (volatile AO_t *addr, AO_t old, AO_t new_val)
 
AO_INLINE int AO_compare_and_swap_acquire (volatile AO_t *addr, AO_t old, AO_t new_val)
 
AO_INLINE int AO_compare_and_swap_release (volatile AO_t *addr, AO_t old, AO_t new_val)
 
AO_INLINE int AO_compare_and_swap_full (volatile AO_t *addr, AO_t old, AO_t new_val)
 
AO_INLINE AO_t AO_fetch_compare_and_swap (volatile AO_t *addr, AO_t old_val, AO_t new_val)
 
AO_INLINE AO_t AO_fetch_compare_and_swap_acquire (volatile AO_t *addr, AO_t old_val, AO_t new_val)
 
AO_INLINE AO_t AO_fetch_compare_and_swap_release (volatile AO_t *addr, AO_t old_val, AO_t new_val)
 
AO_INLINE AO_t AO_fetch_compare_and_swap_full (volatile AO_t *addr, AO_t old_val, AO_t new_val)
 
AO_INLINE AO_t AO_fetch_and_add (volatile AO_t *addr, AO_t incr)
 
AO_INLINE AO_t AO_fetch_and_add_acquire (volatile AO_t *addr, AO_t incr)
 
AO_INLINE AO_t AO_fetch_and_add_release (volatile AO_t *addr, AO_t incr)
 
AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *addr, AO_t incr)
 

Macro Definition Documentation

◆ AO_HAVE_compare_and_swap

#define AO_HAVE_compare_and_swap

Definition at line 210 of file gcc/powerpc.h.

◆ AO_HAVE_compare_and_swap_acquire

#define AO_HAVE_compare_and_swap_acquire

Definition at line 219 of file gcc/powerpc.h.

◆ AO_HAVE_compare_and_swap_full

#define AO_HAVE_compare_and_swap_full

Definition at line 239 of file gcc/powerpc.h.

◆ AO_HAVE_compare_and_swap_release

#define AO_HAVE_compare_and_swap_release

Definition at line 227 of file gcc/powerpc.h.

◆ AO_HAVE_fetch_and_add

#define AO_HAVE_fetch_and_add

Definition at line 312 of file gcc/powerpc.h.

◆ AO_HAVE_fetch_and_add_acquire

#define AO_HAVE_fetch_and_add_acquire

Definition at line 320 of file gcc/powerpc.h.

◆ AO_HAVE_fetch_and_add_full

#define AO_HAVE_fetch_and_add_full

Definition at line 337 of file gcc/powerpc.h.

◆ AO_HAVE_fetch_and_add_release

#define AO_HAVE_fetch_and_add_release

Definition at line 327 of file gcc/powerpc.h.

◆ AO_HAVE_fetch_compare_and_swap

#define AO_HAVE_fetch_compare_and_swap

Definition at line 261 of file gcc/powerpc.h.

◆ AO_HAVE_fetch_compare_and_swap_acquire

#define AO_HAVE_fetch_compare_and_swap_acquire

Definition at line 271 of file gcc/powerpc.h.

◆ AO_HAVE_fetch_compare_and_swap_full

#define AO_HAVE_fetch_compare_and_swap_full

Definition at line 293 of file gcc/powerpc.h.

◆ AO_HAVE_fetch_compare_and_swap_release

#define AO_HAVE_fetch_compare_and_swap_release

Definition at line 280 of file gcc/powerpc.h.

◆ AO_HAVE_load_acquire

#define AO_HAVE_load_acquire

Definition at line 123 of file gcc/powerpc.h.

◆ AO_HAVE_nop_full

#define AO_HAVE_nop_full

Definition at line 55 of file gcc/powerpc.h.

◆ AO_HAVE_nop_read

#define AO_HAVE_nop_read

Definition at line 72 of file gcc/powerpc.h.

◆ AO_HAVE_nop_write

#define AO_HAVE_nop_write

Definition at line 69 of file gcc/powerpc.h.

◆ AO_HAVE_store_release

#define AO_HAVE_store_release

Definition at line 133 of file gcc/powerpc.h.

◆ AO_HAVE_test_and_set

#define AO_HAVE_test_and_set

Definition at line 160 of file gcc/powerpc.h.

◆ AO_HAVE_test_and_set_acquire

#define AO_HAVE_test_and_set_acquire

Definition at line 168 of file gcc/powerpc.h.

◆ AO_HAVE_test_and_set_full

#define AO_HAVE_test_and_set_full

Definition at line 185 of file gcc/powerpc.h.

◆ AO_HAVE_test_and_set_release

#define AO_HAVE_test_and_set_release

Definition at line 175 of file gcc/powerpc.h.

◆ AO_nop_read

#define AO_nop_read (   void)    AO_lwsync()

Definition at line 71 of file gcc/powerpc.h.

◆ AO_nop_write

#define AO_nop_write (   void)    AO_lwsync()

Definition at line 68 of file gcc/powerpc.h.

◆ AO_PPC_BR_A

#define AO_PPC_BR_A (   labelBF,
  addr 
)    labelBF

Definition at line 100 of file gcc/powerpc.h.

◆ AO_PPC_CMPx

#define AO_PPC_CMPx   "cmpw"

Definition at line 84 of file gcc/powerpc.h.

◆ AO_PPC_L

#define AO_PPC_L (   label)    label ": "

Definition at line 99 of file gcc/powerpc.h.

◆ AO_PPC_LD

#define AO_PPC_LD   "lwz"

Definition at line 82 of file gcc/powerpc.h.

◆ AO_PPC_LOAD_CLOBBER

#define AO_PPC_LOAD_CLOBBER   "cc"

Definition at line 86 of file gcc/powerpc.h.

◆ AO_PPC_LxARX

#define AO_PPC_LxARX   "lwarx"

Definition at line 83 of file gcc/powerpc.h.

◆ AO_PPC_STxCXd

#define AO_PPC_STxCXd   "stwcx."

Definition at line 85 of file gcc/powerpc.h.

◆ AO_T_IS_INT

#define AO_T_IS_INT

Definition at line 90 of file gcc/powerpc.h.

Function Documentation

◆ AO_compare_and_swap()

AO_INLINE int AO_compare_and_swap ( volatile AO_t addr,
AO_t  old,
AO_t  new_val 
)

Definition at line 191 of file gcc/powerpc.h.

192 {
193 AO_t oldval;
194 int result = 0;
195
196 __asm__ __volatile__(
197 AO_PPC_L("1") AO_PPC_LxARX " %0,0,%2\n" /* load and reserve */
198 AO_PPC_CMPx " %0, %4\n" /* if load is not equal to */
199 "bne " AO_PPC_BR_A("2f", "$+16") "\n" /* old, fail */
200 AO_PPC_STxCXd " %3,0,%2\n" /* else store conditional */
201 "bne- " AO_PPC_BR_A("1b", "$-16") "\n"
202 /* retry if lost reservation */
203 "li %1,1\n" /* result = 1; */
204 AO_PPC_L("2") "\n"
205 : "=&r"(oldval), "=&r"(result)
206 : "r"(addr), "r"(new_val), "r"(old), "1"(result)
207 : "memory", "cr0");
208 return result;
209 }
volatile int result
#define AO_t
Definition: atomic_ops.h:156
#define AO_PPC_STxCXd
Definition: gcc/powerpc.h:85
#define AO_PPC_LxARX
Definition: gcc/powerpc.h:83
#define AO_PPC_CMPx
Definition: gcc/powerpc.h:84
#define AO_PPC_L(label)
Definition: gcc/powerpc.h:99
#define AO_PPC_BR_A(labelBF, addr)
Definition: gcc/powerpc.h:100
Here is the caller graph for this function:

◆ AO_compare_and_swap_acquire()

AO_INLINE int AO_compare_and_swap_acquire ( volatile AO_t addr,
AO_t  old,
AO_t  new_val 
)

Definition at line 213 of file gcc/powerpc.h.

214 {
215 int result = AO_compare_and_swap(addr, old, new_val);
216 AO_lwsync();
217 return result;
218 }
AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val)
Definition: gcc/powerpc.h:191
AO_INLINE void AO_lwsync(void)
Definition: gcc/powerpc.h:59
Here is the call graph for this function:

◆ AO_compare_and_swap_full()

AO_INLINE int AO_compare_and_swap_full ( volatile AO_t addr,
AO_t  old,
AO_t  new_val 
)

Definition at line 230 of file gcc/powerpc.h.

231 {
232 int result;
233 AO_lwsync();
234 result = AO_compare_and_swap(addr, old, new_val);
235 if (result)
236 AO_lwsync();
237 return result;
238 }
Here is the call graph for this function:

◆ AO_compare_and_swap_release()

AO_INLINE int AO_compare_and_swap_release ( volatile AO_t addr,
AO_t  old,
AO_t  new_val 
)

Definition at line 222 of file gcc/powerpc.h.

223 {
224 AO_lwsync();
225 return AO_compare_and_swap(addr, old, new_val);
226 }
Here is the call graph for this function:

◆ AO_fetch_and_add()

AO_INLINE AO_t AO_fetch_and_add ( volatile AO_t addr,
AO_t  incr 
)

Definition at line 297 of file gcc/powerpc.h.

297 {
298 AO_t oldval;
299 AO_t newval;
300
301 __asm__ __volatile__(
302 AO_PPC_L("1") AO_PPC_LxARX " %0,0,%2\n" /* load and reserve */
303 "add %1,%0,%3\n" /* increment */
304 AO_PPC_STxCXd " %1,0,%2\n" /* store conditional */
305 "bne- " AO_PPC_BR_A("1b", "$-12") "\n"
306 /* retry if lost reservation */
307 : "=&r"(oldval), "=&r"(newval)
308 : "r"(addr), "r"(incr)
309 : "memory", "cr0");
310 return oldval;
311}
Here is the caller graph for this function:

◆ AO_fetch_and_add_acquire()

AO_INLINE AO_t AO_fetch_and_add_acquire ( volatile AO_t addr,
AO_t  incr 
)

Definition at line 315 of file gcc/powerpc.h.

315 {
316 AO_t result = AO_fetch_and_add(addr, incr);
317 AO_lwsync();
318 return result;
319}
AO_INLINE AO_t AO_fetch_and_add(volatile AO_t *addr, AO_t incr)
Definition: gcc/powerpc.h:297
Here is the call graph for this function:

◆ AO_fetch_and_add_full()

AO_INLINE AO_t AO_fetch_and_add_full ( volatile AO_t addr,
AO_t  incr 
)

Definition at line 330 of file gcc/powerpc.h.

330 {
331 AO_t result;
332 AO_lwsync();
333 result = AO_fetch_and_add(addr, incr);
334 AO_lwsync();
335 return result;
336}
Here is the call graph for this function:

◆ AO_fetch_and_add_release()

AO_INLINE AO_t AO_fetch_and_add_release ( volatile AO_t addr,
AO_t  incr 
)

Definition at line 323 of file gcc/powerpc.h.

323 {
324 AO_lwsync();
325 return AO_fetch_and_add(addr, incr);
326}
Here is the call graph for this function:

◆ AO_fetch_compare_and_swap()

AO_INLINE AO_t AO_fetch_compare_and_swap ( volatile AO_t addr,
AO_t  old_val,
AO_t  new_val 
)

Definition at line 244 of file gcc/powerpc.h.

245{
246 AO_t fetched_val;
247
248 __asm__ __volatile__(
249 AO_PPC_L("1") AO_PPC_LxARX " %0,0,%1\n" /* load and reserve */
250 AO_PPC_CMPx " %0, %3\n" /* if load is not equal to */
251 "bne " AO_PPC_BR_A("2f", "$+12") "\n" /* old_val, fail */
252 AO_PPC_STxCXd " %2,0,%1\n" /* else store conditional */
253 "bne- " AO_PPC_BR_A("1b", "$-16") "\n"
254 /* retry if lost reservation */
255 AO_PPC_L("2") "\n"
256 : "=&r"(fetched_val)
257 : "r"(addr), "r"(new_val), "r"(old_val)
258 : "memory", "cr0");
259 return fetched_val;
260}
Here is the caller graph for this function:

◆ AO_fetch_compare_and_swap_acquire()

AO_INLINE AO_t AO_fetch_compare_and_swap_acquire ( volatile AO_t addr,
AO_t  old_val,
AO_t  new_val 
)

Definition at line 264 of file gcc/powerpc.h.

266{
267 AO_t result = AO_fetch_compare_and_swap(addr, old_val, new_val);
268 AO_lwsync();
269 return result;
270}
AO_INLINE AO_t AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
Definition: gcc/powerpc.h:244
Here is the call graph for this function:

◆ AO_fetch_compare_and_swap_full()

AO_INLINE AO_t AO_fetch_compare_and_swap_full ( volatile AO_t addr,
AO_t  old_val,
AO_t  new_val 
)

Definition at line 283 of file gcc/powerpc.h.

285{
286 AO_t result;
287 AO_lwsync();
288 result = AO_fetch_compare_and_swap(addr, old_val, new_val);
289 if (result == old_val)
290 AO_lwsync();
291 return result;
292}
Here is the call graph for this function:

◆ AO_fetch_compare_and_swap_release()

AO_INLINE AO_t AO_fetch_compare_and_swap_release ( volatile AO_t addr,
AO_t  old_val,
AO_t  new_val 
)

Definition at line 274 of file gcc/powerpc.h.

276{
277 AO_lwsync();
278 return AO_fetch_compare_and_swap(addr, old_val, new_val);
279}
Here is the call graph for this function:

◆ AO_load_acquire()

AO_INLINE AO_t AO_load_acquire ( const volatile AO_t addr)

Definition at line 110 of file gcc/powerpc.h.

111{
112 AO_t result;
113
114 __asm__ __volatile__ (
115 AO_PPC_LD "%U1%X1 %0,%1\n"
116 "cmpw %0,%0\n"
117 "bne- " AO_PPC_BR_A("1f", "$+4") "\n"
118 AO_PPC_L("1") "isync\n"
119 : "=r" (result)
120 : "m"(*addr) : "memory", AO_PPC_LOAD_CLOBBER);
121 return result;
122}
#define AO_PPC_LD
Definition: gcc/powerpc.h:82
#define AO_PPC_LOAD_CLOBBER
Definition: gcc/powerpc.h:86

◆ AO_lwsync()

AO_INLINE void AO_lwsync ( void  )

Definition at line 59 of file gcc/powerpc.h.

60{
61#ifdef __NO_LWSYNC__
62 __asm__ __volatile__("sync" : : : "memory");
63#else
64 __asm__ __volatile__("lwsync" : : : "memory");
65#endif
66}
Here is the caller graph for this function:

◆ AO_nop_full()

AO_INLINE void AO_nop_full ( void  )

Definition at line 51 of file gcc/powerpc.h.

52{
53 __asm__ __volatile__("sync" : : : "memory");
54}

◆ AO_store_release()

AO_INLINE void AO_store_release ( volatile AO_t addr,
AO_t  value 
)

Definition at line 128 of file gcc/powerpc.h.

129{
130 AO_lwsync();
131 *addr = value;
132}
Here is the call graph for this function:

◆ AO_test_and_set()

AO_INLINE AO_TS_VAL_t AO_test_and_set ( volatile AO_TS_t addr)

Definition at line 140 of file gcc/powerpc.h.

140 {
141 /* TODO: And we should be using smaller objects anyway. */
142 AO_t oldval;
143 AO_t temp = 1; /* locked value */
144
145 __asm__ __volatile__(
146 AO_PPC_L("1") AO_PPC_LxARX " %0,0,%1\n"
147 /* load and reserve */
148 AO_PPC_CMPx "i %0, 0\n" /* if load is */
149 "bne " AO_PPC_BR_A("2f", "$+12") "\n"
150 /* non-zero, return already set */
151 AO_PPC_STxCXd " %2,0,%1\n" /* else store conditional */
152 "bne- " AO_PPC_BR_A("1b", "$-16") "\n"
153 /* retry if lost reservation */
154 AO_PPC_L("2") "\n" /* oldval is zero if we set */
155 : "=&r"(oldval)
156 : "r"(addr), "r"(temp)
157 : "memory", "cr0");
158 return (AO_TS_VAL_t)oldval;
159}
#define AO_TS_VAL_t
Definition: gcc/hppa.h:44
Here is the caller graph for this function:

◆ AO_test_and_set_acquire()

AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire ( volatile AO_TS_t addr)

Definition at line 163 of file gcc/powerpc.h.

163 {
165 AO_lwsync();
166 return result;
167}
AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr)
Definition: gcc/powerpc.h:140
Here is the call graph for this function:

◆ AO_test_and_set_full()

AO_INLINE AO_TS_VAL_t AO_test_and_set_full ( volatile AO_TS_t addr)

Definition at line 178 of file gcc/powerpc.h.

178 {
180 AO_lwsync();
181 result = AO_test_and_set(addr);
182 AO_lwsync();
183 return result;
184}
Here is the call graph for this function:

◆ AO_test_and_set_release()

AO_INLINE AO_TS_VAL_t AO_test_and_set_release ( volatile AO_TS_t addr)

Definition at line 171 of file gcc/powerpc.h.

171 {
172 AO_lwsync();
173 return AO_test_and_set(addr);
174}
Here is the call graph for this function: