This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libstdc++] atomicity.h PATCH


The constraints in the i486 and m68k patterns were broken; they failed to
record that *__mem is also used for output.  This caused problems with the
tree-ssa branch.

Tested i686-pc-linux-gnu, applied to trunk.

2003-01-02  Jason Merrill  <jason@redhat.com>

	* config/cpu/i486/atomicity.h (__exchange_and_add, __atomic_add):
	*__mem is also an output.
	* config/cpu/m68k/atomicity.h (__exchange_and_add): Likewise.

*** ./config/cpu/i486/atomicity.h.~1~	2003-01-02 12:14:46.000000000 -0500
--- ./config/cpu/i486/atomicity.h	2003-01-01 16:54:04.000000000 -0500
*************** __attribute__ ((__unused__))
*** 37,45 ****
  __exchange_and_add (volatile _Atomic_word *__mem, int __val)
  {
    register _Atomic_word __result;
!   __asm__ __volatile__ ("lock; xaddl %0,%2"
! 			: "=r" (__result) 
!                         : "0" (__val), "m" (*__mem) 
                          : "memory");
    return __result;
  }
--- 37,45 ----
  __exchange_and_add (volatile _Atomic_word *__mem, int __val)
  {
    register _Atomic_word __result;
!   __asm__ __volatile__ ("lock; xaddl %0,%1"
! 			: "=r" (__result), "+m" (*__mem) 
!                         : "0" (__val)
                          : "memory");
    return __result;
  }
*************** static inline void
*** 48,55 ****
  __attribute__ ((__unused__))
  __atomic_add (volatile _Atomic_word* __mem, int __val)
  {
!   __asm__ __volatile__ ("lock; addl %0,%1"
! 			: : "ir" (__val), "m" (*__mem) : "memory");
  }
  
  #endif /* atomicity.h */
--- 48,55 ----
  __attribute__ ((__unused__))
  __atomic_add (volatile _Atomic_word* __mem, int __val)
  {
!   __asm__ __volatile__ ("lock; addl %1,%0"
! 			: "+m" (*__mem) : "ir" (__val) : "memory");
  }
  
  #endif /* atomicity.h */
*** ./config/cpu/m68k/atomicity.h.~1~	2003-01-02 12:14:46.000000000 -0500
--- ./config/cpu/m68k/atomicity.h	2003-01-01 19:35:41.000000000 -0500
*************** __exchange_and_add (volatile _Atomic_wor
*** 43,53 ****
    register _Atomic_word __result = *__mem;
    register _Atomic_word __temp;
    __asm__ __volatile__ ("1: move%.l %0,%1\n\t"
! 			"add%.l %2,%1\n\t"
! 			"cas%.l %0,%1,%3\n\t"
  			"jne 1b"
! 			: "=d" (__result), "=&d" (__temp)
! 			: "d" (__val), "m" (*__mem), "0" (__result)
  			: "memory");
    return __result;
  }
--- 43,53 ----
    register _Atomic_word __result = *__mem;
    register _Atomic_word __temp;
    __asm__ __volatile__ ("1: move%.l %0,%1\n\t"
! 			"add%.l %3,%1\n\t"
! 			"cas%.l %0,%1,%2\n\t"
  			"jne 1b"
! 			: "=d" (__result), "=&d" (__temp), "+m" (*__mem)
! 			: "d" (__val), "0" (__result)
  			: "memory");
    return __result;
  }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]