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

Go to the source code of this file.

Macros

#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
 
#define AO_T_IS_INT
 

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_val, AO_t new_val)
 

Macro Definition Documentation

◆ AO_HAVE_compare_and_swap

#define AO_HAVE_compare_and_swap

Definition at line 109 of file hexagon.h.

◆ AO_HAVE_fetch_and_add

#define AO_HAVE_fetch_and_add

Definition at line 60 of file hexagon.h.

◆ AO_HAVE_fetch_compare_and_swap

#define AO_HAVE_fetch_compare_and_swap

Definition at line 133 of file hexagon.h.

◆ AO_HAVE_nop_full

#define AO_HAVE_nop_full

Definition at line 38 of file hexagon.h.

◆ AO_HAVE_test_and_set

#define AO_HAVE_test_and_set

Definition at line 83 of file hexagon.h.

◆ AO_T_IS_INT

#define AO_T_IS_INT

Definition at line 135 of file hexagon.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 88 of file hexagon.h.

89 {
90 AO_t __oldval;
91 int result = 0;
92 __asm__ __volatile__(
93 "1:\n"
94 " %0 = memw_locked(%3);\n" /* load and reserve */
95 " {\n"
96 " p2 = cmp.eq(%0,%4);\n" /* if load is not equal to */
97 " if (!p2.new) jump:nt 2f;\n" /* old, fail */
98 " }\n"
99 " memw_locked(%3,p1) = %5;\n" /* else store conditional */
100 " if (!p1) jump 1b;\n" /* retry if lost reservation */
101 " %1 = #1\n" /* success, result = 1 */
102 "2:\n"
103 : "=&r" (__oldval), "+r" (result), "+m"(*addr)
104 : "r" (addr), "r" (old), "r" (new_val)
105 : "p1", "p2", "memory"
106 );
107 return result;
108 }
volatile int result
#define AO_t
Definition: atomic_ops.h:156

◆ AO_fetch_and_add()

AO_INLINE AO_t AO_fetch_and_add ( volatile AO_t addr,
AO_t  incr 
)

Definition at line 45 of file hexagon.h.

46{
47 AO_t oldval;
48 AO_t newval;
49 __asm__ __volatile__(
50 "1:\n"
51 " %0 = memw_locked(%3);\n" /* load and reserve */
52 " %1 = add (%0,%4);\n" /* increment */
53 " memw_locked(%3,p1) = %1;\n" /* store conditional */
54 " if (!p1) jump 1b;\n" /* retry if lost reservation */
55 : "=&r"(oldval), "=&r"(newval), "+m"(*addr)
56 : "r"(addr), "r"(incr)
57 : "memory", "p1");
58 return oldval;
59}

◆ 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 113 of file hexagon.h.

114{
115 AO_t __oldval;
116
117 __asm__ __volatile__(
118 "1:\n"
119 " %0 = memw_locked(%2);\n" /* load and reserve */
120 " {\n"
121 " p2 = cmp.eq(%0,%3);\n" /* if load is not equal to */
122 " if (!p2.new) jump:nt 2f;\n" /* old_val, fail */
123 " }\n"
124 " memw_locked(%2,p1) = %4;\n" /* else store conditional */
125 " if (!p1) jump 1b;\n" /* retry if lost reservation */
126 "2:\n"
127 : "=&r" (__oldval), "+m"(*addr)
128 : "r" (addr), "r" (old_val), "r" (new_val)
129 : "p1", "p2", "memory"
130 );
131 return __oldval;
132}

◆ AO_nop_full()

AO_INLINE void AO_nop_full ( void  )

Definition at line 34 of file hexagon.h.

35{
36 __asm__ __volatile__("syncht" : : : "memory");
37}

◆ AO_test_and_set()

AO_INLINE AO_TS_VAL_t AO_test_and_set ( volatile AO_TS_t addr)

Definition at line 63 of file hexagon.h.

64{
65 int oldval;
66 int locked_value = 1;
67
68 __asm__ __volatile__(
69 "1:\n"
70 " %0 = memw_locked(%2);\n" /* load and reserve */
71 " {\n"
72 " p2 = cmp.eq(%0,#0);\n" /* if load is not zero, */
73 " if (!p2.new) jump:nt 2f;\n" /* we are done */
74 " }\n"
75 " memw_locked(%2,p1) = %3;\n" /* else store conditional */
76 " if (!p1) jump 1b;\n" /* retry if lost reservation */
77 "2:\n" /* oldval is zero if we set */
78 : "=&r"(oldval), "+m"(*addr)
79 : "r"(addr), "r"(locked_value)
80 : "memory", "p1", "p2");
81 return (AO_TS_VAL_t)oldval;
82}
#define AO_TS_VAL_t
Definition: gcc/hppa.h:44