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

Go to the source code of this file.

Macros

#define AO_HAVE_test_and_set_full
 
#define AO_HAVE_compare_and_swap_full
 
#define AO_HAVE_fetch_compare_and_swap_full
 

Functions

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

Macro Definition Documentation

◆ AO_HAVE_compare_and_swap_full

#define AO_HAVE_compare_and_swap_full

Definition at line 64 of file gcc/sparc.h.

◆ AO_HAVE_fetch_compare_and_swap_full

#define AO_HAVE_fetch_compare_and_swap_full

Definition at line 81 of file gcc/sparc.h.

◆ AO_HAVE_test_and_set_full

#define AO_HAVE_test_and_set_full

Definition at line 38 of file gcc/sparc.h.

Function Documentation

◆ 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 45 of file gcc/sparc.h.

45 {
46 AO_t ret;
47 __asm__ __volatile__ ("membar #StoreLoad | #LoadLoad\n\t"
48# if defined(__arch64__)
49 "casx [%2],%0,%1\n\t"
50# else
51 "cas [%2],%0,%1\n\t" /* 32-bit version */
52# endif
53 "membar #StoreLoad | #StoreStore\n\t"
54 "cmp %0,%1\n\t"
55 "be,a 0f\n\t"
56 "mov 1,%0\n\t"/* one insn after branch always executed */
57 "clr %0\n\t"
58 "0:\n\t"
59 : "=r" (ret), "+r" (new_val)
60 : "r" (addr), "0" (old)
61 : "memory", "cc");
62 return (int)ret;
63}
#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,
AO_t  new_val 
)

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

68 {
69 __asm__ __volatile__ ("membar #StoreLoad | #LoadLoad\n\t"
70# if defined(__arch64__)
71 "casx [%1],%2,%0\n\t"
72# else
73 "cas [%1],%2,%0\n\t" /* 32-bit version */
74# endif
75 "membar #StoreLoad | #StoreStore\n\t"
76 : "+r" (new_val)
77 : "r" (addr), "r" (old)
78 : "memory");
79 return new_val;
80}

◆ AO_test_and_set_full()

AO_INLINE AO_TS_VAL_t AO_test_and_set_full ( volatile AO_TS_t addr)

Definition at line 30 of file gcc/sparc.h.

30 {
31 AO_TS_VAL_t oldval;
32
33 __asm__ __volatile__("ldstub %1,%0"
34 : "=r"(oldval), "=m"(*addr)
35 : "m"(*addr) : "memory");
36 return oldval;
37}
#define AO_TS_VAL_t
Definition: gcc/hppa.h:44