Commit bd11db39 by Alan Modra Committed by Alan Modra

cpu_limits.h (__glibcpp_long_bits): Define.

	* config/cpu/powerpc/cpu_limits.h (__glibcpp_long_bits): Define.
	* configure.target (cpu_include_dir): Use cpu/powerpc for powerpc64.
	* config/cpu/powerpc/atomicity.h (__always_swap): Remove.
	(__test_and_set): Remove.
	(_STWCX): Define and use.

From-SVN: r55854
parent 4307be72
2002-07-29 Alan Modra <amodra@bigpond.net.au>
* config/cpu/powerpc/cpu_limits.h (__glibcpp_long_bits): Define.
* configure.target (cpu_include_dir): Use cpu/powerpc for powerpc64.
* config/cpu/powerpc/atomicity.h (__always_swap): Remove.
(__test_and_set): Remove.
(_STWCX): Define and use.
2002-07-26 Phil Edwards <pme@gcc.gnu.org> 2002-07-26 Phil Edwards <pme@gcc.gnu.org>
* libsupc++/new (placement delete): Remove unused paramater names. * libsupc++/new (placement delete): Remove unused paramater names.
......
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
#ifndef _BITS_ATOMICITY_H #ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H 1 #define _BITS_ATOMICITY_H 1
#ifdef __PPC405__
#define _STWCX "sync \n\tstwcx. "
#else
#define _STWCX "stwcx. "
#endif
typedef int _Atomic_word; typedef int _Atomic_word;
static inline _Atomic_word static inline _Atomic_word
...@@ -42,7 +48,7 @@ __exchange_and_add (volatile _Atomic_word* __mem, int __val) ...@@ -42,7 +48,7 @@ __exchange_and_add (volatile _Atomic_word* __mem, int __val)
"0:\t" "0:\t"
"lwarx %0,0,%2 \n\t" "lwarx %0,0,%2 \n\t"
"add%I3 %1,%0,%3 \n\t" "add%I3 %1,%0,%3 \n\t"
"stwcx. %1,0,%2 \n\t" _STWCX " %1,0,%2 \n\t"
"bne- 0b \n\t" "bne- 0b \n\t"
"/* End exchange & add */" "/* End exchange & add */"
: "=&b"(__res), "=&r"(__tmp) : "=&b"(__res), "=&r"(__tmp)
...@@ -61,7 +67,7 @@ __atomic_add (volatile _Atomic_word *__mem, int __val) ...@@ -61,7 +67,7 @@ __atomic_add (volatile _Atomic_word *__mem, int __val)
"0:\t" "0:\t"
"lwarx %0,0,%1 \n\t" "lwarx %0,0,%1 \n\t"
"add%I2 %0,%0,%2 \n\t" "add%I2 %0,%0,%2 \n\t"
"stwcx. %0,0,%1 \n\t" _STWCX " %0,0,%1 \n\t"
"bne- 0b \n\t" "bne- 0b \n\t"
"/* End atomic add */" "/* End atomic add */"
: "=&b"(__tmp) : "=&b"(__tmp)
...@@ -69,44 +75,4 @@ __atomic_add (volatile _Atomic_word *__mem, int __val) ...@@ -69,44 +75,4 @@ __atomic_add (volatile _Atomic_word *__mem, int __val)
: "cr0", "memory"); : "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 */ #endif /* atomicity.h */
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#ifndef _GLIBCPP_CPU_LIMITS #ifndef _GLIBCPP_CPU_LIMITS
#define _GLIBCPP_CPU_LIMITS 1 #define _GLIBCPP_CPU_LIMITS 1
#ifdef __powerpc64__
#define __glibcpp_long_bits 64
#endif
#ifndef __LONG_DOUBLE_128__ #ifndef __LONG_DOUBLE_128__
#define __glibcpp_long_double_bits 64 #define __glibcpp_long_double_bits 64
#endif #endif
......
...@@ -85,7 +85,7 @@ case "${target_cpu}" in ...@@ -85,7 +85,7 @@ case "${target_cpu}" in
mmix) mmix)
ATOMICITYH="cpu/generic" ATOMICITYH="cpu/generic"
;; ;;
powerpc | rs6000) powerpc* | rs6000)
cpu_include_dir="cpu/powerpc" cpu_include_dir="cpu/powerpc"
;; ;;
s390 | s390x) s390 | s390x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment