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

Go to the source code of this file.

Macros

#define AO_USE_PENTIUM4_INSTRS
 
#define AO_HAVE_nop_full
 
#define AO_HAVE_fetch_and_add_full
 
#define AO_HAVE_char_fetch_and_add_full
 
#define AO_HAVE_short_fetch_and_add_full
 
#define AO_HAVE_and_full
 
#define AO_HAVE_or_full
 
#define AO_HAVE_xor_full
 
#define AO_HAVE_test_and_set_full
 
#define AO_HAVE_compare_and_swap_full
 
#define AO_HAVE_fetch_compare_and_swap_full
 
#define AO_HAVE_int_fetch_and_add_full
 

Functions

AO_INLINE void AO_nop_full (void)
 
AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
 
AO_INLINE unsigned char AO_char_fetch_and_add_full (volatile unsigned char *p, unsigned char incr)
 
AO_INLINE unsigned short AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr)
 
AO_INLINE void AO_and_full (volatile AO_t *p, AO_t value)
 
AO_INLINE void AO_or_full (volatile AO_t *p, AO_t value)
 
AO_INLINE void AO_xor_full (volatile AO_t *p, AO_t value)
 
AO_INLINE AO_TS_VAL_t AO_test_and_set_full (volatile AO_TS_t *addr)
 
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_full (volatile AO_t *addr, AO_t old_val, AO_t new_val)
 
AO_INLINE unsigned int AO_int_fetch_and_add_full (volatile unsigned int *p, unsigned int incr)
 

Macro Definition Documentation

◆ AO_HAVE_and_full

#define AO_HAVE_and_full

Definition at line 98 of file sunc/x86.h.

◆ AO_HAVE_char_fetch_and_add_full

#define AO_HAVE_char_fetch_and_add_full

Definition at line 74 of file sunc/x86.h.

◆ AO_HAVE_compare_and_swap_full

#define AO_HAVE_compare_and_swap_full

Definition at line 146 of file sunc/x86.h.

◆ AO_HAVE_fetch_and_add_full

#define AO_HAVE_fetch_and_add_full

Definition at line 60 of file sunc/x86.h.

◆ AO_HAVE_fetch_compare_and_swap_full

#define AO_HAVE_fetch_compare_and_swap_full

Definition at line 160 of file sunc/x86.h.

◆ AO_HAVE_int_fetch_and_add_full

#define AO_HAVE_int_fetch_and_add_full

Definition at line 207 of file sunc/x86.h.

◆ AO_HAVE_nop_full

#define AO_HAVE_nop_full

Definition at line 36 of file sunc/x86.h.

◆ AO_HAVE_or_full

#define AO_HAVE_or_full

Definition at line 108 of file sunc/x86.h.

◆ AO_HAVE_short_fetch_and_add_full

#define AO_HAVE_short_fetch_and_add_full

Definition at line 87 of file sunc/x86.h.

◆ AO_HAVE_test_and_set_full

#define AO_HAVE_test_and_set_full

Definition at line 132 of file sunc/x86.h.

◆ AO_HAVE_xor_full

#define AO_HAVE_xor_full

Definition at line 118 of file sunc/x86.h.

◆ AO_USE_PENTIUM4_INSTRS

#define AO_USE_PENTIUM4_INSTRS

Definition at line 27 of file sunc/x86.h.

Function Documentation

◆ AO_and_full()

AO_INLINE void AO_and_full ( volatile AO_t p,
AO_t  value 
)

Definition at line 91 of file sunc/x86.h.

92 {
93 __asm__ __volatile__ ("lock; and %1, %0"
94 : "+m" (*p)
95 : "r" (value)
96 : "memory");
97 }

◆ AO_char_fetch_and_add_full()

AO_INLINE unsigned char AO_char_fetch_and_add_full ( volatile unsigned char *  p,
unsigned char  incr 
)

Definition at line 64 of file sunc/x86.h.

65{
66 unsigned char result;
67
68 __asm__ __volatile__ ("lock; xaddb %0, %1"
69 : "=q" (result), "+m" (*p)
70 : "0" (incr)
71 : "memory");
72 return result;
73}
volatile int result

◆ 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 137 of file sunc/x86.h.

138 {
139 char result;
140 __asm__ __volatile__ ("lock; cmpxchg %2, %0; setz %1"
141 : "+m" (*addr), "=a" (result)
142 : "r" (new_val), "a" (old)
143 : "memory");
144 return (int) result;
145 }

◆ AO_fetch_and_add_full()

AO_INLINE AO_t AO_fetch_and_add_full ( volatile AO_t p,
AO_t  incr 
)

Definition at line 50 of file sunc/x86.h.

51 {
53
54 __asm__ __volatile__ ("lock; xadd %0, %1"
55 : "=r" (result), "+m" (*p)
56 : "0" (incr)
57 : "memory");
58 return result;
59 }
#define AO_t
Definition: atomic_ops.h:156

◆ 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 150 of file sunc/x86.h.

152{
153 AO_t fetched_val;
154 __asm__ __volatile__ ("lock; cmpxchg %2, %0"
155 : "+m" (*addr), "=a" (fetched_val)
156 : "r" (new_val), "a" (old_val)
157 : "memory");
158 return fetched_val;
159}

◆ AO_int_fetch_and_add_full()

AO_INLINE unsigned int AO_int_fetch_and_add_full ( volatile unsigned int p,
unsigned int  incr 
)

Definition at line 197 of file sunc/x86.h.

198 {
199 unsigned int result;
200
201 __asm__ __volatile__ ("lock; xaddl %0, %1"
202 : "=r" (result), "+m" (*p)
203 : "0" (incr)
204 : "memory");
205 return result;
206 }

◆ AO_nop_full()

AO_INLINE void AO_nop_full ( void  )

Definition at line 32 of file sunc/x86.h.

33 {
34 __asm__ __volatile__ ("mfence" : : : "memory");
35 }

◆ AO_or_full()

AO_INLINE void AO_or_full ( volatile AO_t p,
AO_t  value 
)

Definition at line 101 of file sunc/x86.h.

102 {
103 __asm__ __volatile__ ("lock; or %1, %0"
104 : "+m" (*p)
105 : "r" (value)
106 : "memory");
107 }

◆ AO_short_fetch_and_add_full()

AO_INLINE unsigned short AO_short_fetch_and_add_full ( volatile unsigned short *  p,
unsigned short  incr 
)

Definition at line 77 of file sunc/x86.h.

78{
79 unsigned short result;
80
81 __asm__ __volatile__ ("lock; xaddw %0, %1"
82 : "=r" (result), "+m" (*p)
83 : "0" (incr)
84 : "memory");
85 return result;
86}

◆ AO_test_and_set_full()

AO_INLINE AO_TS_VAL_t AO_test_and_set_full ( volatile AO_TS_t addr)

Definition at line 122 of file sunc/x86.h.

123{
124 AO_TS_t oldval;
125 /* Note: the "xchg" instruction does not need a "lock" prefix */
126 __asm__ __volatile__ ("xchg %b0, %1"
127 : "=q" (oldval), "+m" (*addr)
128 : "0" (0xff)
129 : "memory");
130 return (AO_TS_VAL_t)oldval;
131}
#define AO_TS_t
Definition: gcc/hppa.h:39
#define AO_TS_VAL_t
Definition: gcc/hppa.h:44

◆ AO_xor_full()

AO_INLINE void AO_xor_full ( volatile AO_t p,
AO_t  value 
)

Definition at line 111 of file sunc/x86.h.

112 {
113 __asm__ __volatile__ ("lock; xor %1, %0"
114 : "+m" (*p)
115 : "r" (value)
116 : "memory");
117 }