PATCH: Support MIPS II

H . J . Lu hjl@lucon.org
Thu Apr 25 18:19:00 GMT 2002


I have been using this patch for a while.


H.J.
-------------- next part --------------
2002-02-05  H.J. Lu <hjl@gnu.org>

	* config/cpu/mips/bits/atomicity.h: Support MIPS I and II.

	* configure.target (cpu_include_dir): Set to `config/cpu/mips'
	for mips

--- libstdc++-v3/config/cpu/mips/bits/atomicity.h.mips	Fri Oct  5 20:46:34 2001
+++ libstdc++-v3/config/cpu/mips/bits/atomicity.h	Sat Feb  2 19:49:00 2002
@@ -1,6 +1,6 @@
-// Low-level functions for atomic operations. MIPS II version.
+// Low-level functions for atomic operations. Mips version.
 
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -28,13 +28,17 @@
 // the GNU General Public License.
 
 #ifndef _BITS_ATOMICITY_H 
-#define _BITS_ATOMICITY_H 1
-
-// #include <sgidefs.h>
-// #ifdef (_MIPS_ISA_MIPS2)
 
 typedef int _Atomic_word;
 
+#ifdef _MIPS_ISA
+
+#include <sgidefs.h>
+
+#if _MIPS_ISA >= _MIPS_ISA_MIPS2
+
+#define _BITS_ATOMICITY_H 1
+
 static inline int
 __attribute__ ((unused))
 __exchange_and_add (volatile _Atomic_word *__mem, int __val)
@@ -42,7 +46,7 @@ __exchange_and_add (volatile _Atomic_wor
   int __result, __tmp;
 
   __asm__ __volatile__
-    ("/* Inline exchange & add */\n\t"
+    ("/* Inline exchange & add */\n"
      "1:\n\t"
      "ll	%0,%3\n\t"
      "addu	%1,%4,%0\n\t"
@@ -63,7 +67,7 @@ __atomic_add (volatile _Atomic_word *__m
   int __result;
 
   __asm__ __volatile__
-    ("/* Inline atomic add */\n\t"
+    ("/* Inline atomic add */\n"
      "1:\n\t"
      "ll	%0,%2\n\t"
      "addu	%0,%3,%0\n\t"
@@ -75,4 +79,30 @@ __atomic_add (volatile _Atomic_word *__m
      : "memory");
 }
 
+#endif /* _MIPS_ISA >= _MIPS_ISA_MIPS2 */
+
+#endif /* !_MIPS_ISA */
+
+#ifndef _BITS_ATOMICITY_H 
+
+#define _BITS_ATOMICITY_H 1
+
+static inline int
+__attribute__ ((unused))
+__exchange_and_add (volatile _Atomic_word *__mem, int __val)
+{
+  int __result = *__mem;
+  *__mem += __val;
+  return __result;
+}
+
+static inline void
+__attribute__ ((unused))
+__atomic_add (volatile _Atomic_word *__mem, int __val)
+{
+  *__mem += __val;
+}
+
+#endif
+
 #endif /* atomicity.h */
--- libstdc++-v3/configure.target.mips	Sat Jan 19 11:06:36 2002
+++ libstdc++-v3/configure.target	Sat Feb  2 19:50:14 2002
@@ -43,6 +43,9 @@ case "${target_cpu}" in
   m68k | m680[246]0)
     cpu_include_dir="config/cpu/m68k"
     ;;
+   mips*)
+     cpu_include_dir=config/cpu/mips
+     ;;
   powerpc | rs6000)
     cpu_include_dir="config/cpu/powerpc"
     ;;


More information about the Libstdc++ mailing list