6
#if defined(__i386__) || defined(__alpha) || defined(__ia64) || defined(__x86_64__)
8
# if defined(__GNUC__) && !defined(__INTEL_COMPILER)
9
# if defined(__i386__) || defined(__x86_64__)
10
# include "tas-i386.h"
11
# elif defined(__ia64)
12
# include "tas-ia64.h"
14
# include "tas-alpha.h"
16
# define TESTANDSET testandset
18
# define TESTANDSET gcc_testandset
19
# define RELEASE_SPINLOCK gcc_clear_spinlock
21
extern int gcc_testandset();
22
extern void gcc_clear_spinlock();
38
/* make sure that locks are not sharing the same cache line */
46
#define PAD_LOCK_T pad_lock_t
48
static INLINE void armci_init_spinlock(LOCK_T *mutex)
53
static INLINE void armci_acquire_spinlock(LOCK_T *mutex)
58
int loop=0, maxloop =10;
59
while (TESTANDSET(mutex)){
64
printf("%d:spinlock sleeping\n",armci_me); fflush(stdout);
75
#ifdef RELEASE_SPINLOCK
77
# define armci_release_spinlock(x) MEMORY_BARRIER ();RELEASE_SPINLOCK(x)
79
# define armci_release_spinlock(x) RELEASE_SPINLOCK(x)
82
static INLINE void armci_release_spinlock(LOCK_T *mutex)
91
#if (defined(MACX)||defined(LINUX)) && defined(__GNUC__) && defined(__ppc__)
92
__asm__ __volatile__ ("isync" : : : "memory");