mips-support-upstream-1.7.3
authorDebian Open MPI Maintainers <pkg-openmpi-maintainers@lists.alioth.debian.org>
Fri, 14 Nov 2014 16:57:11 +0000 (16:57 +0000)
committerJulien Cristau <jcristau@debian.org>
Fri, 14 Nov 2014 16:57:11 +0000 (16:57 +0000)
Gbp-Pq: Name mips-support-upstream-1.7.3.diff

opal/asm/base/MIPS.asm
opal/include/opal/sys/mips/atomic.h

index d5c69f0f9dd29a5145684cf3e6f6fd03ca62d4a5..a5f4abad49e2017437e9a30b7810b5144fcf382d 100644 (file)
@@ -1,26 +1,48 @@
 START_FILE
 
+#ifdef __linux__
 #include <sys/asm.h>
+#else
+#include <asm.h>
+#endif
 #include <regdef.h>
        
        TEXT
 
        ALIGN(8)
 LEAF(opal_atomic_mb)
+#ifdef __linux__
+       .set mips2
+#endif
        sync
+#ifdef __linux__
+       .set mips0
+#endif 
        j       ra
 END(opal_atomic_mb)
 
        
        ALIGN(8)
 LEAF(opal_atomic_rmb)
+#ifdef __linux__
+       .set mips2
+#endif
        sync
+#ifdef __linux__
+       .set mips0
+#endif
        j       ra
 END(opal_atomic_rmb)
        
        
 LEAF(opal_atomic_wmb)
+#ifdef __linux__
+       .set mips2
+#endif
        sync
+#ifdef __linux__
+       .set mips0
+#endif
        j       ra
 END(opal_atomic_wmb)
 
@@ -28,10 +50,22 @@ END(opal_atomic_wmb)
 LEAF(opal_atomic_cmpset_32)
        .set noreorder        
 retry1:                
+#ifdef __linux__
+       .set mips2
+#endif
        ll     $3, 0($4)         
+#ifdef __linux__
+       .set mips0
+#endif
        bne    $3, $5, done1   
        or     $2, $6, 0      
+#ifdef __linux__
+       .set mips2
+#endif
        sc     $2, 0($4)         
+#ifdef __linux__
+       .set mips0
+#endif
        beqz   $2, retry1
 done1:                 
        .set reorder          
@@ -45,13 +79,31 @@ END(opal_atomic_cmpset_32)
 LEAF(opal_atomic_cmpset_acq_32)
        .set noreorder        
 retry2:                
+#ifdef __linux__
+       .set mips2
+#endif
        ll     $3, 0($4)         
+#ifdef __linux__
+       .set mips0
+#endif
        bne    $3, $5, done2   
        or     $2, $6, 0      
+#ifdef __linux__
+       .set mips2
+#endif
        sc     $2, 0($4)         
+#ifdef __linux__
+       .set mips0
+#endif
        beqz   $2, retry2   
 done2:                 
+#ifdef __linux__
+       .set mips2
+#endif
        sync
+#ifdef __linux__
+       .set mips0
+#endif
        .set reorder          
 
        xor     $3,$3,$5
@@ -62,12 +114,30 @@ END(opal_atomic_cmpset_acq_32)
        
 LEAF(opal_atomic_cmpset_rel_32)
        .set noreorder        
+#ifdef __linux__
+       .set mips2
+#endif
        sync
+#ifdef __linux__
+       .set mips0
+#endif
 retry3:                
+#ifdef __linux__
+       .set mips2
+#endif
        ll     $3, 0($4)         
+#ifdef __linux__
+       .set mips0
+#endif
        bne    $3, $5, done3   
        or     $2, $6, 0      
+#ifdef __linux__
+       .set mips2
+#endif
        sc     $2, 0($4)         
+#ifdef __linux__
+       .set mips0
+#endif
        beqz   $2, retry3   
 done3:                 
        .set reorder          
@@ -77,7 +147,7 @@ done3:
        sltu    $2,$3,1
 END(opal_atomic_cmpset_rel_32)
        
-       
+#ifdef __mips64        
 LEAF(opal_atomic_cmpset_64)
                .set noreorder        
 retry4:                
@@ -128,3 +198,4 @@ done6:
        j       ra
        sltu    $3,$4,1
 END(opal_atomic_cmpset_rel_64)
+#endif /* __mips64 */
index 0168f533678f749daac91b6e3381d27a34374fe8..9eca559aacba50ec4aef7bc032a2e6f65a787c60 100644 (file)
 #if OPAL_WANT_SMP_LOCKS
 
 /* BWB - FIX ME! */
+#ifdef __linux__
+#define MB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory")
+#define RMB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory")
+#define WMB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory")
+#define SMP_SYNC ".set mips2; sync; .set mips0"
+#else
 #define MB() __asm__ __volatile__("sync": : :"memory")
 #define RMB() __asm__ __volatile__("sync": : :"memory")
 #define WMB() __asm__ __volatile__("sync": : :"memory")
 #define SMP_SYNC "sync"
+#endif
 
 #else
 
 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
 
 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
-#define OPAL_HAVE_ATOMIC_CMPSET_64 1
 
+#ifdef __mips64
+#define OPAL_HAVE_ATOMIC_CMPSET_64 1
+#endif
 
 /**********************************************************************
  *
@@ -93,10 +102,16 @@ static inline int opal_atomic_cmpset_32(volatile int32_t *addr,
    __asm__ __volatile__ (".set noreorder        \n"
                          ".set noat             \n"
                          "1:                    \n"
+#ifdef __linux__
+                         ".set mips2         \n\t"
+#endif
                          "ll     %0, %2         \n" /* load *addr into ret */
                          "bne    %0, %z3, 2f    \n" /* done if oldval != ret */
                          "or     $1, %z4, 0     \n" /* tmp = newval (delay slot) */
                          "sc     $1, %2         \n" /* store tmp in *addr */
+#ifdef __linux__
+                         ".set mips0         \n\t"
+#endif
                          /* note: ret will be 0 if failed, 1 if succeeded */
                          "beqz   $1, 1b         \n" /* if 0 jump back to 1b */
                         "nop                   \n" /* fill delay slots */
@@ -133,7 +148,7 @@ static inline int opal_atomic_cmpset_rel_32(volatile int32_t *addr,
     return opal_atomic_cmpset_32(addr, oldval, newval);
 }
 
-
+#ifdef OPAL_HAVE_ATOMIC_CMPSET_64
 static inline int opal_atomic_cmpset_64(volatile int64_t *addr,
                                         int64_t oldval, int64_t newval)
 {
@@ -182,6 +197,7 @@ static inline int opal_atomic_cmpset_rel_64(volatile int64_t *addr,
     opal_atomic_wmb();
     return opal_atomic_cmpset_64(addr, oldval, newval);
 }
+#endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */
 
 #endif /* OMPI_GCC_INLINE_ASSEMBLY */