Replace vpermpd with vpermilpd
[platform/upstream/openblas.git] / common_x86_64.h
index 5437769..c05998d 100644 (file)
 #endif
 */
 
-#define MB
-#define WMB
+#ifdef __GNUC__
+#define MB do { __asm__ __volatile__("": : :"memory"); } while (0)
+#define WMB do { __asm__ __volatile__("": : :"memory"); } while (0)
+#else
+#define MB do {} while (0)
+#define WMB do {} while (0)
+#endif
 
 static void __inline blas_lock(volatile BLASULONG *address){
 
@@ -86,6 +91,7 @@ static void __inline blas_lock(volatile BLASULONG *address){
   } while (ret);
 
 }
+#define BLAS_LOCK_DEFINED
 
 static __inline BLASULONG rpcc(void){
 #ifdef C_MSVC
@@ -98,6 +104,7 @@ static __inline BLASULONG rpcc(void){
   return ((BLASULONG)a + ((BLASULONG)d << 32));
 #endif
 }
+#define RPCC_DEFINED
 
 #define RPCC64BIT
 
@@ -122,7 +129,8 @@ static __inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx){
   *ecx=cpuinfo[2];
   *edx=cpuinfo[3];
 #else
-        __asm__ __volatile__("cpuid"
+        __asm__ __volatile__("mov $0, %%ecx;"
+                            "cpuid"
                             : "=a" (*eax),
                             "=b" (*ebx),
                             "=c" (*ecx),
@@ -194,9 +202,16 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
 
   if (y <= 1) return x;
 
+#if (MAX_CPU_NUMBER > 64)  
+  if (y > 64) { 
+         result = x / y;
+         return result;
+  }
+#endif
+       
   y = blas_quick_divide_table[y];
 
-  __asm__ __volatile__  ("mull %0" :"=d" (result) :"a"(x), "0" (y));
+  __asm__ __volatile__  ("mull %0" :"=d" (result), "+a"(x) : "0" (y));
 
   return result;
 }
@@ -243,6 +258,10 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
 #define RETURN_BY_STACK
 #endif
 
+#ifdef F_INTERFACE_FLANG
+#define RETURN_BY_STACK
+#endif
+
 #ifdef F_INTERFACE_PGI
 #define RETURN_BY_STACK
 #endif
@@ -258,7 +277,7 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
 #ifdef ASSEMBLER
 
 #if defined(PILEDRIVER) || defined(BULLDOZER) || defined(STEAMROLLER) || defined(EXCAVATOR)
-//Enable some optimazation for barcelona.
+//Enable some optimization for barcelona.
 #define BARCELONA_OPTIMIZATION
 #endif
 
@@ -394,10 +413,10 @@ REALNAME:
 
 #define PROFCODE
 
-#define EPILOGUE .end   REALNAME
+#define EPILOGUE .end
 #endif
 
-#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(__ELF__) || defined(C_PGI)
+#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLY) || defined(__ELF__) || defined(C_PGI)
 #define PROLOGUE \
        .text; \
        .align 512; \