} while (ret);
}
+ #define BLAS_LOCK_DEFINED
static __inline unsigned long long rpcc(void){
+#if defined(_MSC_VER) && !defined(__clang__)
+ return __rdtsc(); // use MSVC intrinsic
+#else
unsigned int a, d;
__asm__ __volatile__ ("rdtsc" : "=a" (a), "=d" (d));
return ((unsigned long long)a + ((unsigned long long)d << 32));
+#endif
};
+ #define RPCC_DEFINED
static __inline unsigned long getstackaddr(void){
+#if defined(_MSC_VER) && !defined(__clang__)
+ return (unsigned long)_ReturnAddress(); // use MSVC intrinsic
+#else
unsigned long addr;
__asm__ __volatile__ ("mov %%esp, %0"
: "=r"(ret), "=m"(*address)
: "0"(1), "m"(*address)
: "memory");
-
+#else
+ ret=InterlockedExchange64((volatile LONG64 *)(address), 1);
+#endif
} while (ret);
+
}
+ #define BLAS_LOCK_DEFINED
static __inline BLASULONG rpcc(void){
+#ifdef C_MSVC
+ return __rdtsc();
+#else
BLASULONG a, d;
__asm__ __volatile__ ("rdtsc" : "=a" (a), "=d" (d));
return ((BLASULONG)a + ((BLASULONG)d << 32));
+#endif
}
+ #define RPCC_DEFINED
#define RPCC64BIT
#define BITMASK(a, b, c) ((((a) >> (b)) & (c)))
- #define CONSTRUCTOR __attribute__ ((constructor))
- #define DESTRUCTOR __attribute__ ((destructor))
+#if defined(_MSC_VER) && !defined(__clang__)
+#define CONSTRUCTOR __cdecl
+#define DESTRUCTOR __cdecl
+#else
+ #define CONSTRUCTOR __attribute__ ((constructor(101)))
+ #define DESTRUCTOR __attribute__ ((destructor(101)))
+#endif
#ifdef DYNAMIC_ARCH
gotoblas_t *gotoblas = NULL;