powerpc64 libstdc++

Alan Modra amodra@bigpond.net.au
Sat Jul 27 03:45:00 GMT 2002


On Fri, Jul 26, 2002 at 02:28:59PM -0400, David Edelsohn wrote:
> to use AIX primitives, not the the processor instructions.  Similar to the
> compare_and_swap support in libstdc++-v3.

That reminds me.  No occurrences of __always_swap anywhere in the gcc
repo, except here and arm/atomicity.h.  Similarly for __test_and_set,
except for one protected by #ifdef MIPS in boehm-gc/include/private/.
Given that we don't need these two functions, the other two,
__exchange_and_add and __atomic_add will work fine for powerpc64.

libstdc++-v3/ChangeLog
	* configure.target (cpu_include_dir): Use cpu/powerpc for powerpc64.
	* config/cpu/powerpc/atomicity.h (__always_swap): Remove.
	(__test_and_set): Remove.

OK mainline?  I'll rip out the arm/atomicity.h ones too, if you like.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: libstdc++-v3/configure.target
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.target,v
retrieving revision 1.47
diff -u -p -r1.47 configure.target
--- libstdc++-v3/configure.target	11 Jul 2002 18:56:58 -0000	1.47
+++ libstdc++-v3/configure.target	27 Jul 2002 08:36:30 -0000
@@ -85,7 +85,7 @@ case "${target_cpu}" in
   mmix)
     ATOMICITYH="cpu/generic"
     ;;
-  powerpc | rs6000)
+  powerpc* | rs6000)
     cpu_include_dir="cpu/powerpc"
     ;;
   s390 | s390x)
Index: libstdc++-v3/config/cpu/powerpc/atomicity.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/cpu/powerpc/atomicity.h,v
retrieving revision 1.3
diff -u -p -r1.3 atomicity.h
--- libstdc++-v3/config/cpu/powerpc/atomicity.h	24 Jun 2002 05:48:14 -0000	1.3
+++ libstdc++-v3/config/cpu/powerpc/atomicity.h	27 Jul 2002 08:36:30 -0000
@@ -69,44 +69,4 @@ __atomic_add (volatile _Atomic_word *__m
 	: "cr0", "memory");
 }
 
-static inline long
-__attribute__ ((__unused__))
-__always_swap (volatile long *__p, long int __newval)
-{
-  long __res;
-  __asm__ __volatile__ (
-	"/* Inline always swap */\n"
-	"0:\t"
-	"lwarx    %0,0,%1 \n\t"
-	"stwcx.   %2,0,%1 \n\t"
-	"bne-     0b \n\t"
-	"/* End always swap */"
-	: "=&r"(__res)
-	: "r"(__p), "r"(__newval)
-	: "cr0", "memory");
-  return __res;
-}
-
-static inline int
-__attribute__ ((__unused__))
-__test_and_set (volatile long *__p, long int __newval)
-{
-  int __res;
-  __asm__ __volatile__ (
-	"/* Inline test & set */\n"
-	"0:\t"
-	"lwarx    %0,0,%1 \n\t"
-	"cmpwi    %0,0 \n\t"
-	"bne-     1f \n\t"
-	"stwcx.   %2,0,%1 \n\t"
-	"bne-     0b \n"
-	"1:\n\t"
-	"/* End test & set */"
-	: "=&r"(__res)
-	: "r"(__p), "r"(__newval)
-	: "cr0", "memory");
-  return __res;
-}
-
 #endif /* atomicity.h */
-



More information about the Gcc-patches mailing list