PAPI 7.1.0.0
Loading...
Searching...
No Matches
alpha.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
3 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
4 * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
5 *
6 *
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
9 *
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
15 *
16 */
17
18#include "../loadstore/atomic_load.h"
19#include "../loadstore/atomic_store.h"
20
21#include "../test_and_set_t_is_ao_t.h"
22
23#define AO_NO_DD_ORDERING
24 /* Data dependence does not imply read ordering. */
25
26AO_INLINE void
28{
29 __asm__ __volatile__("mb" : : : "memory");
30}
31#define AO_HAVE_nop_full
32
33AO_INLINE void
35{
36 __asm__ __volatile__("wmb" : : : "memory");
37}
38#define AO_HAVE_nop_write
39
40/* mb should be used for AO_nop_read(). That's the default. */
41
42/* TODO: implement AO_fetch_and_add explicitly. */
43
44/* We believe that ldq_l ... stq_c does not imply any memory barrier. */
45AO_INLINE int
47 AO_t old, AO_t new_val)
48{
49 unsigned long was_equal;
50 unsigned long temp;
51
52 __asm__ __volatile__(
53 "1: ldq_l %0,%1\n"
54 " cmpeq %0,%4,%2\n"
55 " mov %3,%0\n"
56 " beq %2,2f\n"
57 " stq_c %0,%1\n"
58 " beq %0,1b\n"
59 "2:\n"
60 : "=&r" (temp), "+m" (*addr), "=&r" (was_equal)
61 : "r" (new_val), "Ir" (old)
62 :"memory");
63 return (int)was_equal;
64}
65#define AO_HAVE_compare_and_swap
66
67/* TODO: implement AO_fetch_compare_and_swap */
AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val)
Definition: alpha.h:46
AO_INLINE void AO_nop_write(void)
Definition: alpha.h:34
AO_INLINE void AO_nop_full(void)
Definition: alpha.h:27
#define AO_t
Definition: atomic_ops.h:156
#define AO_INLINE
Definition: atomic_ops.h:186