PAPI 7.1.0.0
Loading...
Searching...
No Matches
mips.h File Reference
Include dependency graph for mips.h:

Go to the source code of this file.

Macros

#define AO_NO_DD_ORDERING
 
#define AO_T_IS_INT
 
#define AO_MIPS_SET_ISA   " .set mips2\n"
 
#define AO_MIPS_LL_1(args)   " ll " args "\n"
 
#define AO_MIPS_SC(args)   " sc " args "\n"
 
#define AO_MIPS_LL(args)   AO_MIPS_LL_1(args)
 
#define AO_HAVE_nop_full
 
#define AO_HAVE_fetch_and_add
 
#define AO_HAVE_test_and_set
 
#define AO_HAVE_compare_and_swap
 
#define AO_HAVE_fetch_compare_and_swap
 

Functions

AO_INLINE void AO_nop_full (void)
 
AO_INLINE AO_t AO_fetch_and_add (volatile AO_t *addr, AO_t incr)
 
AO_INLINE AO_TS_VAL_t AO_test_and_set (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 AO_t AO_fetch_compare_and_swap (volatile AO_t *addr, AO_t old, AO_t new_val)
 

Macro Definition Documentation

◆ AO_HAVE_compare_and_swap

#define AO_HAVE_compare_and_swap

Definition at line 165 of file mips.h.

◆ AO_HAVE_fetch_and_add

#define AO_HAVE_fetch_and_add

Definition at line 109 of file mips.h.

◆ AO_HAVE_fetch_compare_and_swap

#define AO_HAVE_fetch_compare_and_swap

Definition at line 193 of file mips.h.

◆ AO_HAVE_nop_full

#define AO_HAVE_nop_full

Definition at line 83 of file mips.h.

◆ AO_HAVE_test_and_set

#define AO_HAVE_test_and_set

Definition at line 134 of file mips.h.

◆ AO_MIPS_LL

#define AO_MIPS_LL (   args)    AO_MIPS_LL_1(args)

Definition at line 68 of file mips.h.

◆ AO_MIPS_LL_1

#define AO_MIPS_LL_1 (   args)    " ll " args "\n"

Definition at line 50 of file mips.h.

◆ AO_MIPS_SC

#define AO_MIPS_SC (   args)    " sc " args "\n"

Definition at line 51 of file mips.h.

◆ AO_MIPS_SET_ISA

#define AO_MIPS_SET_ISA   " .set mips2\n"

Definition at line 48 of file mips.h.

◆ AO_NO_DD_ORDERING

#define AO_NO_DD_ORDERING

Definition at line 21 of file mips.h.

◆ AO_T_IS_INT

#define AO_T_IS_INT

Definition at line 43 of file mips.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 141 of file mips.h.

142 {
143 register int was_equal = 0;
144 register int temp;
145
146 __asm__ __volatile__(
147 " .set push\n"
149 " .set noreorder\n"
150 " .set nomacro\n"
151 "1: "
152 AO_MIPS_LL("%0, %1")
153 " bne %0, %4, 2f\n"
154 " move %0, %3\n"
155 AO_MIPS_SC("%0, %1")
156 " .set pop\n"
157 " beqz %0, 1b\n"
158 " li %2, 1\n"
159 "2:"
160 : "=&r" (temp), "+m" (*addr), "+r" (was_equal)
161 : "r" (new_val), "r" (old)
162 : "memory");
163 return was_equal;
164 }
#define AO_MIPS_SET_ISA
Definition: mips.h:48
#define AO_MIPS_SC(args)
Definition: mips.h:51
#define AO_MIPS_LL(args)
Definition: mips.h:68

◆ AO_fetch_and_add()

AO_INLINE AO_t AO_fetch_and_add ( volatile AO_t addr,
AO_t  incr 
)

Definition at line 87 of file mips.h.

88{
89 register int result;
90 register int temp;
91
92 __asm__ __volatile__(
93 " .set push\n"
95 " .set noreorder\n"
96 " .set nomacro\n"
97 "1: "
98 AO_MIPS_LL("%0, %2")
99 " addu %1, %0, %3\n"
100 AO_MIPS_SC("%1, %2")
101 " beqz %1, 1b\n"
102 " nop\n"
103 " .set pop"
104 : "=&r" (result), "=&r" (temp), "+m" (*addr)
105 : "Ir" (incr)
106 : "memory");
107 return (AO_t)result;
108}
volatile int result
#define AO_t
Definition: atomic_ops.h:156

◆ AO_fetch_compare_and_swap()

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

Definition at line 169 of file mips.h.

170{
171 register int fetched_val;
172 register int temp;
173
174 __asm__ __volatile__(
175 " .set push\n"
177 " .set noreorder\n"
178 " .set nomacro\n"
179 "1: "
180 AO_MIPS_LL("%0, %2")
181 " bne %0, %4, 2f\n"
182 " move %1, %3\n"
183 AO_MIPS_SC("%1, %2")
184 " beqz %1, 1b\n"
185 " nop\n"
186 " .set pop\n"
187 "2:"
188 : "=&r" (fetched_val), "=&r" (temp), "+m" (*addr)
189 : "r" (new_val), "Jr" (old)
190 : "memory");
191 return (AO_t)fetched_val;
192}

◆ AO_nop_full()

AO_INLINE void AO_nop_full ( void  )

Definition at line 72 of file mips.h.

73{
74 __asm__ __volatile__(
75 " .set push\n"
77 " .set noreorder\n"
78 " .set nomacro\n"
79 " sync\n"
80 " .set pop"
81 : : : "memory");
82}

◆ AO_test_and_set()

AO_INLINE AO_TS_VAL_t AO_test_and_set ( volatile AO_TS_t addr)

Definition at line 112 of file mips.h.

113{
114 register int oldval;
115 register int temp;
116
117 __asm__ __volatile__(
118 " .set push\n"
120 " .set noreorder\n"
121 " .set nomacro\n"
122 "1: "
123 AO_MIPS_LL("%0, %2")
124 " move %1, %3\n"
125 AO_MIPS_SC("%1, %2")
126 " beqz %1, 1b\n"
127 " nop\n"
128 " .set pop"
129 : "=&r" (oldval), "=&r" (temp), "+m" (*addr)
130 : "r" (1)
131 : "memory");
132 return (AO_TS_VAL_t)oldval;
133}
#define AO_TS_VAL_t
Definition: gcc/hppa.h:44