This is the mail archive of the gcc-bugs@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]

Re: Invalid asms in libstdc++-v3/config/cpu/alpha/bits/atomicity.h


On Wed, Jan 24, 2001 at 02:03:49AM -0200, Alexandre Oliva wrote:
> We can obviously remove the comments, but I don't see the point of
> using .subsection and .previous, and I'm not sure 1b and 2f are
> supported either.

I think 1b/2f are, but .subsection definitely isn't.  Try this.


r~



Index: atomicity.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/config/cpu/alpha/bits/atomicity.h,v
retrieving revision 1.3
diff -c -p -d -r1.3 atomicity.h
*** atomicity.h	2000/08/22 18:24:15	1.3
--- atomicity.h	2001/01/25 01:55:08
***************
*** 20,25 ****
--- 20,30 ----
  #ifndef _BITS_ATOMICITY_H
  #define _BITS_ATOMICITY_H	1
  
+ /* @@@ With gas we can play nice .subsection games to get the
+    non-predicted branch pointing forward.  But Digital assemblers
+    don't understand those directives.  This isn't a terribly
+    important issue, so just ignore it.  */
+ 
  typedef int _Atomic_word;
  
  static inline _Atomic_word
*************** __exchange_and_add (volatile _Atomic_wor
*** 29,46 ****
    register int __result, __tmp;
  
    __asm__ __volatile__ (
! 	"/* Inline exchange & add */\n"
! 	"1:\t"
  	"ldl_l	%0,%3\n\t"
  	"addl	%0,%4,%1\n\t"
  	"stl_c	%1,%2\n\t"
! 	"beq	%1,2f\n"
! 	".subsection 1\n"
! 	"2:\t"
! 	"br	1b\n"
! 	".previous\n\t"
! 	"mb\n\t"
! 	"/* End exchange & add */"
  	: "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
  	: "m" (*__mem), "r"(__val));
  
--- 34,45 ----
    register int __result, __tmp;
  
    __asm__ __volatile__ (
! 	"\n$Lxadd_%=:\n\t"
  	"ldl_l	%0,%3\n\t"
  	"addl	%0,%4,%1\n\t"
  	"stl_c	%1,%2\n\t"
! 	"beq	%1,$Lxadd_%=\n\t"
! 	"mb"
  	: "=&r"(__result), "=&r"(__tmp), "=m"(*__mem)
  	: "m" (*__mem), "r"(__val));
  
*************** __atomic_add (volatile _Atomic_word* __m
*** 54,71 ****
    register _Atomic_word __result;
  
    __asm__ __volatile__ (
! 	"/* Inline exchange & add */\n"
! 	"1:\t"
  	"ldl_l	%0,%2\n\t"
  	"addl	%0,%3,%0\n\t"
  	"stl_c	%0,%1\n\t"
! 	"beq	%0,2f\n\t"
! 	".subsection 1\n"
! 	"2:\t"
! 	"br	1b\n"
! 	".previous\n\t"
! 	"mb\n\t"
! 	"/* End exchange & add */"
  	: "=&r"(__result), "=m"(*__mem)
  	: "m" (*__mem), "r"(__val));
  }
--- 53,64 ----
    register _Atomic_word __result;
  
    __asm__ __volatile__ (
! 	"\n$Ladd_%=:\n\t"
  	"ldl_l	%0,%2\n\t"
  	"addl	%0,%3,%0\n\t"
  	"stl_c	%0,%1\n\t"
! 	"beq	%0,$Ladd_%=\n\t"
! 	"mb"
  	: "=&r"(__result), "=m"(*__mem)
  	: "m" (*__mem), "r"(__val));
  }
*************** __compare_and_swap (volatile long *__p, 
*** 77,97 ****
    int __ret;
  
    __asm__ __volatile__ (
! 	"/* Inline compare & swap */\n"
! 	"1:\t"
  	"ldq_l	%0,%4\n\t"
  	"cmpeq	%0,%2,%0\n\t"
  	"beq	%0,3f\n\t"
  	"mov	%3,%0\n\t"
  	"stq_c	%0,%1\n\t"
! 	"beq	%0,2f\n\t"
! 	".subsection 1\n"
! 	"2:\t"
! 	"br	1b\n"
! 	".previous\n\t"
! 	"3:\t"
! 	"mb\n\t"
! 	"/* End compare & swap */"
  	: "=&r"(__ret), "=m"(*__p)
  	: "r"(__oldval), "r"(__newval), "m"(*__p));
  
--- 70,83 ----
    int __ret;
  
    __asm__ __volatile__ (
! 	"\n$Lcas_%=:\n\t"
  	"ldq_l	%0,%4\n\t"
  	"cmpeq	%0,%2,%0\n\t"
  	"beq	%0,3f\n\t"
  	"mov	%3,%0\n\t"
  	"stq_c	%0,%1\n\t"
! 	"beq	%0,$Lcas_%=\n\t"
! 	"mb"
  	: "=&r"(__ret), "=m"(*__p)
  	: "r"(__oldval), "r"(__newval), "m"(*__p));
  

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