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

Go to the source code of this file.

Macros

#define AO_nop_write()   AO_lwsync()
 
#define AO_HAVE_nop_write
 
#define AO_nop_read()   AO_lwsync()
 
#define AO_HAVE_nop_read
 
#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_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
 

Functions

void AO_sync (void)
 
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 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)
 

Macro Definition Documentation

◆ AO_HAVE_fetch_compare_and_swap

#define AO_HAVE_fetch_compare_and_swap

Definition at line 150 of file ibmc/powerpc.h.

◆ AO_HAVE_fetch_compare_and_swap_acquire

#define AO_HAVE_fetch_compare_and_swap_acquire

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

◆ AO_HAVE_fetch_compare_and_swap_full

#define AO_HAVE_fetch_compare_and_swap_full

Definition at line 181 of file ibmc/powerpc.h.

◆ AO_HAVE_fetch_compare_and_swap_release

#define AO_HAVE_fetch_compare_and_swap_release

Definition at line 169 of file ibmc/powerpc.h.

◆ AO_HAVE_load_acquire

#define AO_HAVE_load_acquire

Definition at line 45 of file ibmc/powerpc.h.

◆ AO_HAVE_nop_read

#define AO_HAVE_nop_read

Definition at line 34 of file ibmc/powerpc.h.

◆ AO_HAVE_nop_write

#define AO_HAVE_nop_write

Definition at line 31 of file ibmc/powerpc.h.

◆ AO_HAVE_store_release

#define AO_HAVE_store_release

Definition at line 53 of file ibmc/powerpc.h.

◆ AO_HAVE_test_and_set

#define AO_HAVE_test_and_set

Definition at line 93 of file ibmc/powerpc.h.

◆ AO_HAVE_test_and_set_acquire

#define AO_HAVE_test_and_set_acquire

Definition at line 101 of file ibmc/powerpc.h.

◆ AO_HAVE_test_and_set_full

#define AO_HAVE_test_and_set_full

Definition at line 118 of file ibmc/powerpc.h.

◆ AO_HAVE_test_and_set_release

#define AO_HAVE_test_and_set_release

Definition at line 108 of file ibmc/powerpc.h.

◆ AO_nop_read

#define AO_nop_read (   void)    AO_lwsync()

Definition at line 33 of file ibmc/powerpc.h.

◆ AO_nop_write

#define AO_nop_write (   void)    AO_lwsync()

Definition at line 30 of file ibmc/powerpc.h.

Function Documentation

◆ 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 122 of file ibmc/powerpc.h.

123{
124 AO_t fetched_val;
125# if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__)
126 __asm__ __volatile__(
127 "1:ldarx %0,0,%1\n" /* load and reserve */
128 "cmpd %0, %3\n" /* if load is not equal to */
129 "bne 2f\n" /* old_val, fail */
130 "stdcx. %2,0,%1\n" /* else store conditional */
131 "bne- 1b\n" /* retry if lost reservation */
132 "2:\n"
133 : "=&r"(fetched_val)
134 : "r"(addr), "r"(new_val), "r"(old_val)
135 : "memory", "cr0");
136# else
137 __asm__ __volatile__(
138 "1:lwarx %0,0,%1\n" /* load and reserve */
139 "cmpw %0, %3\n" /* if load is not equal to */
140 "bne 2f\n" /* old_val, fail */
141 "stwcx. %2,0,%1\n" /* else store conditional */
142 "bne- 1b\n" /* retry if lost reservation */
143 "2:\n"
144 : "=&r"(fetched_val)
145 : "r"(addr), "r"(new_val), "r"(old_val)
146 : "memory", "cr0");
147# endif
148 return fetched_val;
149}
#define AO_t
Definition: atomic_ops.h:156
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 153 of file ibmc/powerpc.h.

155{
156 AO_t result = AO_fetch_compare_and_swap(addr, old_val, new_val);
157 AO_lwsync();
158 return result;
159}
volatile int result
void AO_lwsync(void)
Definition: gcc/powerpc.h:59
AO_INLINE AO_t AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
Definition: ibmc/powerpc.h:122
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 172 of file ibmc/powerpc.h.

174{
175 AO_t result;
176 AO_lwsync();
177 result = AO_fetch_compare_and_swap(addr, old_val, new_val);
178 AO_lwsync();
179 return result;
180}
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 163 of file ibmc/powerpc.h.

165{
166 AO_lwsync();
167 return AO_fetch_compare_and_swap(addr, old_val, new_val);
168}
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 39 of file ibmc/powerpc.h.

40{
41 AO_t result = *addr;
42 AO_lwsync();
43 return result;
44}
Here is the call graph for this function:

◆ AO_lwsync()

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_store_release()

AO_INLINE void AO_store_release ( volatile AO_t addr,
AO_t  value 
)

Definition at line 48 of file ibmc/powerpc.h.

49{
50 AO_lwsync();
51 *addr = value;
52}
Here is the call graph for this function:

◆ AO_sync()

void AO_sync ( void  )

◆ AO_test_and_set()

AO_INLINE AO_TS_VAL_t AO_test_and_set ( volatile AO_TS_t addr)

Definition at line 60 of file ibmc/powerpc.h.

60 {
61#if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__)
62/* Completely untested. And we should be using smaller objects anyway. */
63 unsigned long oldval;
64 unsigned long temp = 1; /* locked value */
65
66 __asm__ __volatile__(
67 "1:ldarx %0,0,%1\n" /* load and reserve */
68 "cmpdi %0, 0\n" /* if load is */
69 "bne 2f\n" /* non-zero, return already set */
70 "stdcx. %2,0,%1\n" /* else store conditional */
71 "bne- 1b\n" /* retry if lost reservation */
72 "2:\n" /* oldval is zero if we set */
73 : "=&r"(oldval)
74 : "r"(addr), "r"(temp)
75 : "memory", "cr0");
76#else
77 int oldval;
78 int temp = 1; /* locked value */
79
80 __asm__ __volatile__(
81 "1:lwarx %0,0,%1\n" /* load and reserve */
82 "cmpwi %0, 0\n" /* if load is */
83 "bne 2f\n" /* non-zero, return already set */
84 "stwcx. %2,0,%1\n" /* else store conditional */
85 "bne- 1b\n" /* retry if lost reservation */
86 "2:\n" /* oldval is zero if we set */
87 : "=&r"(oldval)
88 : "r"(addr), "r"(temp)
89 : "memory", "cr0");
90#endif
91 return (AO_TS_VAL_t)oldval;
92}
#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 96 of file ibmc/powerpc.h.

96 {
98 AO_lwsync();
99 return result;
100}
AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr)
Definition: ibmc/powerpc.h:60
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 111 of file ibmc/powerpc.h.

111 {
113 AO_lwsync();
114 result = AO_test_and_set(addr);
115 AO_lwsync();
116 return result;
117}
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 104 of file ibmc/powerpc.h.

104 {
105 AO_lwsync();
106 return AO_test_and_set(addr);
107}
Here is the call graph for this function: