+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>
* libsupc++/new (placement delete): Remove unused paramater names.
#ifndef _BITS_ATOMICITY_H
#define _BITS_ATOMICITY_H 1
+#ifdef __PPC405__
+#define _STWCX "sync \n\tstwcx. "
+#else
+#define _STWCX "stwcx. "
+#endif
+
typedef int _Atomic_word;
static inline _Atomic_word
"0:\t"
"lwarx %0,0,%2 \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"
"/* End exchange & add */"
: "=&b"(__res), "=&r"(__tmp)
"0:\t"
"lwarx %0,0,%1 \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"
"/* End atomic add */"
: "=&b"(__tmp)
: "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 */
-
#ifndef _GLIBCPP_CPU_LIMITS
#define _GLIBCPP_CPU_LIMITS 1
+#ifdef __powerpc64__
+#define __glibcpp_long_bits 64
+#endif
+
#ifndef __LONG_DOUBLE_128__
#define __glibcpp_long_double_bits 64
#endif