[mono/mono] [2 commits] 00bdbda2: Enable GCC atomics on sparc32/64.

"alexrp ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141f2beeea8-0e780f4b-ca8d-42d6-93fd-83ffcea22384-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/481abfa4f3ff...d7e3f8f1bb10

   Commit: 00bdbda27f4308e169979cbcf2607996cf927112
   Author: Alex Rønne Petersen <[email protected]> 
     Date: 2013-10-26 03:08:16 GMT
      URL: https://github.com/mono/mono/commit/00bdbda27f4308e169979cbcf2607996cf927112

Enable GCC atomics on sparc32/64.

Changed paths:
  M configure.in
  M mono/utils/atomic.h
  M mono/utils/mono-membar.h

Modified: configure.in
===================================================================
@@ -2796,7 +2796,7 @@ esac
 dnl Use GCC atomic ops if they work on the target.
 if test x$GCC = "xyes"; then
 	case $TARGET in
-	X86 | AMD64 | ARM | POWERPC | POWERPC64 | MIPS | S390X)
+	X86 | AMD64 | ARM | POWERPC | POWERPC64 | MIPS | S390X | SPARC | SPARC64)
 		AC_DEFINE(USE_GCC_ATOMIC_OPS, 1, [...])
 		;;
 	esac

Modified: mono/utils/atomic.h
===================================================================
@@ -231,7 +231,7 @@ static inline void InterlockedWrite(volatile gint32 *dst, gint32 val)
 	} while (__sync_val_compare_and_swap (dst, old_val, val) != old_val);
 }
 
-#if defined (TARGET_OSX) || defined (__arm__) || (defined (__mips__) && !defined (__mips64)) || (defined (__powerpc__) && !defined (__powerpc64__))
+#if defined (TARGET_OSX) || defined (__arm__) || (defined (__mips__) && !defined (__mips64)) || (defined (__powerpc__) && !defined (__powerpc64__)) || (defined (__sparc__) && !defined (__arch64__))
 #define BROKEN_64BIT_ATOMICS_INTRINSIC 1
 #endif
 
@@ -351,166 +351,6 @@ static inline void InterlockedWrite64(volatile gint64 *dst, gint64 val)
 	InterlockedExchange64 (dst, val);
 }
 
-#elif (defined(sparc) || defined (__sparc__)) && defined(__GNUC__)
-
-G_GNUC_UNUSED 
-static inline gint32 InterlockedCompareExchange(volatile gint32 *_dest, gint32 _exch, gint32 _comp)
-{
-       register volatile gint32 *dest asm("g1") = _dest;
-       register gint32 comp asm("o4") = _comp;
-       register gint32 exch asm("o5") = _exch;
-
-       __asm__ __volatile__(
-               /* cas [%%g1], %%o4, %%o5 */
-               ".word 0xdbe0500c"
-               : "=r" (exch)
-               : "0" (exch), "r" (dest), "r" (comp)
-               : "memory");
-
-       return exch;
-}
-
-G_GNUC_UNUSED 
-static inline gpointer InterlockedCompareExchangePointer(volatile gpointer *_dest, gpointer _exch, gpointer _comp)
-{
-       register volatile gpointer *dest asm("g1") = _dest;
-       register gpointer comp asm("o4") = _comp;
-       register gpointer exch asm("o5") = _exch;
-
-       __asm__ __volatile__(
-#ifdef SPARCV9
-               /* casx [%%g1], %%o4, %%o5 */
-               ".word 0xdbf0500c"
-#else
-               /* cas [%%g1], %%o4, %%o5 */
-               ".word 0xdbe0500c"
-#endif
-               : "=r" (exch)
-               : "0" (exch), "r" (dest), "r" (comp)
-               : "memory");
-
-       return exch;
-}
-
-G_GNUC_UNUSED 
-static inline gint32 InterlockedIncrement(volatile gint32 *_dest)
-{
-       register volatile gint32 *dest asm("g1") = _dest;
-       register gint32 tmp asm("o4");
-       register gint32 ret asm("o5");
-
-       __asm__ __volatile__(
-               "1:     ld      [%%g1], %%o4\n\t"
-               "       add     %%o4, 1, %%o5\n\t"
-               /*      cas     [%%g1], %%o4, %%o5 */
-               "       .word   0xdbe0500c\n\t"
-               "       cmp     %%o4, %%o5\n\t"
-               "       bne     1b\n\t"
-               "        add    %%o5, 1, %%o5"
-               : "=&r" (tmp), "=&r" (ret)
-               : "r" (dest)
-               : "memory", "cc");
-
-        return ret;
-}
-
-G_GNUC_UNUSED 
-static inline gint32 InterlockedDecrement(volatile gint32 *_dest)
-{
-       register volatile gint32 *dest asm("g1") = _dest;
-       register gint32 tmp asm("o4");
-       register gint32 ret asm("o5");
-
-       __asm__ __volatile__(
-               "1:     ld      [%%g1], %%o4\n\t"
-               "       sub     %%o4, 1, %%o5\n\t"
-               /*      cas     [%%g1], %%o4, %%o5 */
-               "       .word   0xdbe0500c\n\t"
-               "       cmp     %%o4, %%o5\n\t"
-               "       bne     1b\n\t"
-               "        sub    %%o5, 1, %%o5"
-               : "=&r" (tmp), "=&r" (ret)
-               : "r" (dest)
-               : "memory", "cc");
-
-        return ret;
-}
-
-G_GNUC_UNUSED
-static inline gint32 InterlockedExchange(volatile gint32 *_dest, gint32 exch)
-{
-       register volatile gint32 *dest asm("g1") = _dest;
-       register gint32 tmp asm("o4");
-       register gint32 ret asm("o5");
-
-       __asm__ __volatile__(
-               "1:     ld      [%%g1], %%o4\n\t"
-               "       mov     %3, %%o5\n\t"
-               /*      cas     [%%g1], %%o4, %%o5 */
-               "       .word   0xdbe0500c\n\t"
-               "       cmp     %%o4, %%o5\n\t"
-               "       bne     1b\n\t"
-               "        nop"
-               : "=&r" (tmp), "=&r" (ret)
-               : "r" (dest), "r" (exch)
-               : "memory", "cc");
-
-        return ret;
-}
-
-G_GNUC_UNUSED
-static inline gpointer InterlockedExchangePointer(volatile gpointer *_dest, gpointer exch)
-{
-       register volatile gpointer *dest asm("g1") = _dest;
-       register gpointer tmp asm("o4");
-       register gpointer ret asm("o5");
-
-       __asm__ __volatile__(
-#ifdef SPARCV9
-               "1:     ldx     [%%g1], %%o4\n\t"
-#else
-               "1:     ld      [%%g1], %%o4\n\t"
-#endif
-               "       mov     %3, %%o5\n\t"
-#ifdef SPARCV9
-               /*      casx    [%%g1], %%o4, %%o5 */
-               "       .word   0xdbf0500c\n\t"
-#else
-               /*      cas     [%%g1], %%o4, %%o5 */
-               "       .word   0xdbe0500c\n\t"
-#endif
-               "       cmp     %%o4, %%o5\n\t"
-               "       bne     1b\n\t"
-               "        nop"
-               : "=&r" (tmp), "=&r" (ret)
-               : "r" (dest), "r" (exch)
-               : "memory", "cc");
-
-        return ret;
-}
-
-G_GNUC_UNUSED
-static inline gint32 InterlockedExchangeAdd(volatile gint32 *_dest, gint32 add)
-{
-       register volatile gint32 *dest asm("g1") = _dest;
-       register gint32 tmp asm("o4");
-       register gint32 ret asm("o5");
-
-       __asm__ __volatile__(
-               "1:     ld      [%%g1], %%o4\n\t"
-               "       add     %%o4, %3, %%o5\n\t"
-               /*      cas     [%%g1], %%o4, %%o5 */
-               "       .word   0xdbe0500c\n\t"
-               "       cmp     %%o4, %%o5\n\t"
-               "       bne     1b\n\t"
-               "        add    %%o5, %3, %%o5"
-               : "=&r" (tmp), "=&r" (ret)
-               : "r" (dest), "r" (add)
-               : "memory", "cc");
-
-        return ret;
-}
-
 #elif defined(__ia64__)
 
 #ifdef __INTEL_COMPILER

Modified: mono/utils/mono-membar.h
===================================================================
@@ -60,21 +60,6 @@ static inline void mono_memory_write_barrier (void)
 {
 	mono_memory_barrier ();
 }
-#elif defined(sparc) || defined(__sparc__)
-static inline void mono_memory_barrier (void)
-{
-	__asm__ __volatile__ ("membar	#LoadLoad | #LoadStore | #StoreStore | #StoreLoad" : : : "memory");
-}
-
-static inline void mono_memory_read_barrier (void)
-{
-	__asm__ __volatile__ ("membar	#LoadLoad" : : : "memory");
-}
-
-static inline void mono_memory_write_barrier (void)
-{
-	__asm__ __volatile__ ("membar	#StoreStore" : : : "memory");
-}
 #elif defined(__s390__)
 static inline void mono_memory_barrier (void)
 {

   Commit: d7e3f8f1bb10d8883a6c55716f1edf3a792c40b7
   Author: Alex Rønne Petersen <[email protected]> 
     Date: 2013-10-26 03:08:19 GMT
      URL: https://github.com/mono/mono/commit/d7e3f8f1bb10d8883a6c55716f1edf3a792c40b7

Remove dead s390(x) code from mono-membar.h.

Changed paths:
  M mono/utils/mono-membar.h

Modified: mono/utils/mono-membar.h
===================================================================
@@ -60,21 +60,6 @@ static inline void mono_memory_write_barrier (void)
 {
 	mono_memory_barrier ();
 }
-#elif defined(__s390__)
-static inline void mono_memory_barrier (void)
-{
-	__asm__ __volatile__ ("bcr 15,0" : : : "memory");
-}
-
-static inline void mono_memory_read_barrier (void)
-{
-	mono_memory_barrier ();
-}
-
-static inline void mono_memory_write_barrier (void)
-{
-	mono_memory_barrier ();
-}
 #elif defined(__ia64__)
 static inline void mono_memory_barrier (void)
 {
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.