diff options
Diffstat (limited to 'contrib/libstdc++/config/cpu')
25 files changed, 1611 insertions, 0 deletions
diff --git a/contrib/libstdc++/config/cpu/alpha/bits/atomicity.h b/contrib/libstdc++/config/cpu/alpha/bits/atomicity.h new file mode 100644 index 000000000000..895d87ae6eed --- /dev/null +++ b/contrib/libstdc++/config/cpu/alpha/bits/atomicity.h @@ -0,0 +1,76 @@ +// Low-level functions for atomic operations: Alpha version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#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 +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) +{ + 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)); + + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + 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)); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/alpha/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/alpha/bits/cpu_limits.h new file mode 100644 index 000000000000..21d31e3631a6 --- /dev/null +++ b/contrib/libstdc++/config/cpu/alpha/bits/cpu_limits.h @@ -0,0 +1,38 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 + +#define __glibcpp_long_double_bits 64 + +#endif + + + diff --git a/contrib/libstdc++/config/cpu/arm/bits/atomicity.h b/contrib/libstdc++/config/cpu/arm/bits/atomicity.h new file mode 100644 index 000000000000..2363edf7cdfe --- /dev/null +++ b/contrib/libstdc++/config/cpu/arm/bits/atomicity.h @@ -0,0 +1,221 @@ +// Low-level functions for atomic operations: ARM version -*- C++ -*- + +// Copyright (C) 2000, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __tmp, __tmp2, __result; +#ifdef __thumb__ + /* Since this function is inlined, we can't be sure of the alignment. */ + __asm__ __volatile__ ( + "ldr %0, 4f \n\t" + "bx %0 \n\t" + ".align 0 \n" + "4:\t" + ".word 0f \n\t" + ".code 32 \n" + "0:\t" + "ldr %0, [%3] \n\t" + "add %1, %0, %4 \n\t" + "swp %2, %1, [%3] \n\t" + "cmp %0, %2 \n\t" + "swpne %1, %2, [%3] \n\t" + "bne 0b \n\t" + "ldr %1, 1f \n\t" + "bx %1 \n" + "1:\t" + ".word 2f \n\t" + ".code 16 \n" + "2:\n" + : "=&l"(__result), "=&r"(__tmp), "=&r"(__tmp2) + : "r" (__mem), "r"(__val) + : "cc", "memory"); +#else + __asm__ __volatile__ ( + "\n" + "0:\t" + "ldr %0, [%3] \n\t" + "add %1, %0, %4 \n\t" + "swp %2, %1, [%3] \n\t" + "cmp %0, %2 \n\t" + "swpne %1, %2, [%3] \n\t" + "bne 0b \n\t" + "" + : "=&r"(__result), "=&r"(__tmp), "=&r"(__tmp2) + : "r" (__mem), "r"(__val) + : "cc", "memory"); +#endif + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __tmp, __tmp2, __tmp3; +#ifdef __thumb__ + /* Since this function is inlined, we can't be sure of the alignment. */ + __asm__ __volatile__ ( + "ldr %0, 4f \n\t" + "bx %0 \n\t" + ".align 0\n" + "4:\t" + ".word 0f \n\t" + ".code 32 \n" + "0:\t" + "ldr %0, [%3] \n\t" + "add %1, %0, %4 \n\t" + "swp %2, %1, [%3] \n\t" + "cmp %0, %2 \n\t" + "swpne %1, %2,[%3] \n\t" + "bne 0b \n\t" + "ldr %1, 1f \n\t" + "bx %1 \n" + "1:\t" + ".word 2f \n\t" + ".code 16 \n" + "2:\n" + : "=&l"(__tmp), "=&r"(__tmp2), "=&r"(__tmp3) + : "r" (__mem), "r"(__val) + : "cc", "memory"); +#else + __asm__ __volatile__ ( + "\n" + "0:\t" + "ldr %0, [%3] \n\t" + "add %1, %0, %4 \n\t" + "swp %2, %1, [%3] \n\t" + "cmp %0, %2 \n\t" + "swpne %1, %2, [%3] \n\t" + "bne 0b \n\t" + "" + : "=&r"(__tmp), "=&r"(__tmp2), "=&r"(__tmp3) + : "r" (__mem), "r"(__val) + : "cc", "memory"); +#endif +} + +static inline long +__attribute__ ((__unused__)) +__always_swap (volatile long *__p, long __newval) +{ + long __result; +#ifdef __thumb__ + long __tmp; + /* Since this function is inlined, we can't be sure of the alignment. */ + __asm__ __volatile__ ( + "ldr %0, 4f \n\t" + "bx %0 \n\t" + ".align 0 \n" + "4:\t" + ".word 0f \n\t" + ".code 32\n" + "0:\t" + "swp %0, %3, [%2] \n\t" + "ldr %1, 1f \n\t" + "bx %1 \n" + "1:\t" + ".word 2f \n\t" + ".code 16 \n" + "2:\n" + : "=&l"(__result), "=&r"(__tmp) + : "r"(__p), "r"(__newval) + : "memory"); +#else + __asm__ __volatile__ ( + "\n\t" + "swp %0, %2, [%1] \n\t" + "" + : "=&r"(__result) + : "r"(__p), "r"(__newval) + : "memory"); +#endif + return __result; +} + +static inline int +__attribute__ ((__unused__)) +__test_and_set (volatile long *__p, long __newval) +{ + int __result; + long __tmp; +#ifdef __thumb__ + /* Since this function is inlined, we can't be sure of the alignment. */ + __asm__ __volatile__ ( + "ldr %0, 4f \n\t" + "bx %0 \n\t" + ".align 0 \n" + "4:\t" + ".word 0f \n\t" + ".code 32 \n" + "0:\t" + "ldr %0, [%2] \n\t" + "cmp %0, #0 \n\t" + "bne 1f \n\t" + "swp %1, %3, [%2] \n\t" + "cmp %0, %1 \n\t" + "swpne %0, %1, [%2]\n\t" + "bne 0b \n" + "1:\t" + "ldr %1, 2f \n\t" + "bx %1 \n" + "2:\t" + ".word 3f \n\t" + ".code 16 \n" + "3:" + : "=&l"(__result), "=r" (__tmp) + : "r"(__p), "r"(__newval) + : "cc", "memory"); +#else + __asm__ __volatile__ ( + "\n" + "0:\t" + "ldr %0, [%2] \n\t" + "cmp %0, #0 \n\t" + "bne 1f \n\t" + "swp %1, %3, [%2] \n\t" + "cmp %0, %1 \n\t" + "swpne %0, %1, [%2] \n\t" + "bne 0b \n" + "1:\n\t" + "" + : "=&r"(__result), "=r" (__tmp) + : "r"(__p), "r"(__newval) + : "cc", "memory"); +#endif + return __result; +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/cris/bits/atomicity.h b/contrib/libstdc++/config/cpu/cris/bits/atomicity.h new file mode 100644 index 000000000000..55c374f3ed78 --- /dev/null +++ b/contrib/libstdc++/config/cpu/cris/bits/atomicity.h @@ -0,0 +1,79 @@ +// Low-level functions for atomic operations: CRIS version -*- C++ -*- + +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +// This entity must not cross a page boundary. +typedef int _Atomic_word __attribute__ ((__aligned__ (4))); + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (_Atomic_word* __mem, int __val) +{ + int __tmp; + _Atomic_word __result; + +#if (__CRIS_arch_version >= 10) + __asm__ __volatile__ (" clearf \n" + "0: \n" + " move.d %4,%2 \n" + " move.d [%3],%0 \n" + " add.d %0,%2 \n" + " ax \n" + " move.d %2,[%3] \n" + " bwf 0b \n" + " clearf \n" + : "=&r" (__result), "=m" (*__mem), "=&r" (__tmp) + : "r" (__mem), "g" (__val), "m" (*__mem) + : "memory"); +#else + __asm__ __volatile__ (" move $ccr,$r9 \n" + " di \n" + " move.d %4,%2 \n" + " move.d [%3],%0 \n" + " add.d %0,%2 \n" + " move.d %2,[%3] \n" + " move $r9,$ccr \n" + : "=&r" (__result), "=m" (*__mem), "=&r" (__tmp) + : "r" (__mem), "g" (__val), "m" (*__mem) + : "memory", "r9"); +#endif + + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (_Atomic_word* __mem, int __val) +{ + __exchange_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/cris/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/cris/bits/cpu_limits.h new file mode 100644 index 000000000000..f0ff04dedaa1 --- /dev/null +++ b/contrib/libstdc++/config/cpu/cris/bits/cpu_limits.h @@ -0,0 +1,33 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_double_bits 64 + +#endif diff --git a/contrib/libstdc++/config/cpu/generic/bits/atomicity.h b/contrib/libstdc++/config/cpu/generic/bits/atomicity.h new file mode 100644 index 000000000000..fca2b83d5844 --- /dev/null +++ b/contrib/libstdc++/config/cpu/generic/bits/atomicity.h @@ -0,0 +1,51 @@ +// Low-level functions for atomic operations: Generic version -*- C++ -*- + +// Copyright (C) 1999, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (_Atomic_word* __mem, int __val) +{ + _Atomic_word __result = *__mem; + *__mem += __val; + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (_Atomic_word* __mem, int __val) +{ + *__mem += __val; +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/generic/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/generic/bits/cpu_limits.h new file mode 100644 index 000000000000..0438f7c6e9f8 --- /dev/null +++ b/contrib/libstdc++/config/cpu/generic/bits/cpu_limits.h @@ -0,0 +1,41 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +// Nothing is defined in the generic file. In that way, we fall back +// on the defaults in std_limits.h. + +// If you need to override these defaults, you can either use a +// CPU-specific version (in which case you must modify +// configure.target) or you must add the overrides to your +// os_defines.h. In general, if all systems for your CPU use the +// same values, it is best to use a cpu-specific configuration file. + +#endif + diff --git a/contrib/libstdc++/config/cpu/generic/bits/limits.h b/contrib/libstdc++/config/cpu/generic/bits/limits.h new file mode 100644 index 000000000000..8fa5a82145f6 --- /dev/null +++ b/contrib/libstdc++/config/cpu/generic/bits/limits.h @@ -0,0 +1,40 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +// Nothing is defined in the generic file. In that way, we fall back +// on the defaults in std_limits.h. + +// If you need to override these defaults, you can either use a +// CPU-specific version (in which case you must modify +// configure.target) or you must add the overrides to your +// os_defines.h. In general, if all systems for your CPU use the +// same values, it is best to use a cpu-specific configuration file. + +#endif diff --git a/contrib/libstdc++/config/cpu/i386/bits/atomicity.h b/contrib/libstdc++/config/cpu/i386/bits/atomicity.h new file mode 100644 index 000000000000..4733503ff44b --- /dev/null +++ b/contrib/libstdc++/config/cpu/i386/bits/atomicity.h @@ -0,0 +1,59 @@ +// Low-level functions for atomic operations: x86, x < 4 version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __result; + __asm__ __volatile__ ("lock; xaddl %0,%2" + : "=r" (__result) + : "0" (__val), "m" (*__mem) + : "memory"); + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + __asm__ __volatile__ ("lock; addl %0,%1" + : : "ir" (__val), "m" (*__mem) : "memory"); +} + +#endif /* atomicity.h */ + + + + diff --git a/contrib/libstdc++/config/cpu/i386/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/i386/bits/cpu_limits.h new file mode 100644 index 000000000000..be304e2d8055 --- /dev/null +++ b/contrib/libstdc++/config/cpu/i386/bits/cpu_limits.h @@ -0,0 +1,33 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_double_bits 80 + +#endif diff --git a/contrib/libstdc++/config/cpu/i486/bits/atomicity.h b/contrib/libstdc++/config/cpu/i486/bits/atomicity.h new file mode 100644 index 000000000000..92f5011c3a11 --- /dev/null +++ b/contrib/libstdc++/config/cpu/i486/bits/atomicity.h @@ -0,0 +1,57 @@ +// Low-level functions for atomic operations: x86, x >= 4 version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __result; + __asm__ __volatile__ ("lock; xaddl %0,%2" + : "=r" (__result) + : "0" (__val), "m" (*__mem) + : "memory"); + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + __asm__ __volatile__ ("lock; addl %0,%1" + : : "ir" (__val), "m" (*__mem) : "memory"); +} + +#endif /* atomicity.h */ + + diff --git a/contrib/libstdc++/config/cpu/ia64/bits/atomicity.h b/contrib/libstdc++/config/cpu/ia64/bits/atomicity.h new file mode 100644 index 000000000000..e28e1490ba55 --- /dev/null +++ b/contrib/libstdc++/config/cpu/ia64/bits/atomicity.h @@ -0,0 +1,51 @@ +// Low-level functions for atomic operations: IA64 version -*- C++ -*- + +// Copyright (C) 2000, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +#include <ia64intrin.h> + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + return __sync_fetch_and_add (__mem, __val); +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + __sync_fetch_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/ia64/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/ia64/bits/cpu_limits.h new file mode 100644 index 000000000000..735f7d5bb217 --- /dev/null +++ b/contrib/libstdc++/config/cpu/ia64/bits/cpu_limits.h @@ -0,0 +1,36 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 + +// While sizeof(long double) == 16, the format is the same as the x86. +#define __glibcpp_long_double_bits 80 + +#endif diff --git a/contrib/libstdc++/config/cpu/m68k/bits/atomicity.h b/contrib/libstdc++/config/cpu/m68k/bits/atomicity.h new file mode 100644 index 000000000000..c5d339469e38 --- /dev/null +++ b/contrib/libstdc++/config/cpu/m68k/bits/atomicity.h @@ -0,0 +1,158 @@ +// Low-level functions for atomic operations: m68k version -*- C++ -*- + +// 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +#if defined(__mc68020__) || defined(__mc68030__) \ + || defined(__mc68040__) || defined(__mc68060__) +// These variants support compare-and-swap. + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __result = *__mem; + register _Atomic_word __temp; + __asm__ __volatile__ ("1: move%.l %0,%1\n\t" + "add%.l %2,%1\n\t" + "cas%.l %0,%1,%3\n\t" + "jbne 1b" + : "=d" (__result), "=&d" (__temp) + : "d" (__val), "m" (*__mem), "0" (__result) + : "memory"); + return __result; +} + +#elif defined(__rtems__) + /* + * TAS/JBNE is unsafe on systems with strict priority-based scheduling. + * Disable interrupts, which we can do only from supervisor mode. + */ +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __result; + short __level, __tmpsr; + __asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w %1,%%sr" + : "=d"(__level), "=d"(__tmpsr) : "1"(0x700)); + + __result = *__mem; + *__mem = __result + __val; + + __asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level)); + + return __result; +} + +#elif !defined(__mcf5200__) && !defined(__mcf5300__) +// 68000, 68010, cpu32 and 5400 support test-and-set. + +template <int __inst> +struct __Atomicity_lock +{ + static volatile unsigned char _S_atomicity_lock; +}; + +template <int __inst> +volatile unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0; + +template volatile unsigned char __Atomicity_lock<0>::_S_atomicity_lock; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __result; + + __asm__ __volatile__("1: tas %0\n\tjbne 1b" + : "=m"(__Atomicity_lock<0>::_S_atomicity_lock) + : "m"(__Atomicity_lock<0>::_S_atomicity_lock)); + + __result = *__mem; + *__mem = __result + __val; + + __Atomicity_lock<0>::_S_atomicity_lock = 0; + + return __result; +} + +#elif defined(__vxWorks__) || defined(__embedded__) +// The best we can hope for is to disable interrupts, which we +// can only do from supervisor mode. + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __result; + short __level, __tmpsr; + __asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w %1,%%sr" + : "=d"(__level), "=d"(__tmpsr) : "1"(0x700)); + + __result = *__mem; + *__mem = __result + __val; + + __asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level)); + + return __result; +} + +#else +// These variants do not support any atomic operations at all. + +#warning "__exchange_and_add is not atomic for this target" + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __result; + + __result = *__mem; + *__mem = __result + __val; + + return __result; +} + +#endif /* CAS / IRQ / TAS */ + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + // Careful: using add.l with a memory destination is not + // architecturally guaranteed to be atomic. + (void) __exchange_and_add (__mem, __val); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/m68k/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/m68k/bits/cpu_limits.h new file mode 100644 index 000000000000..07e4e03a12b4 --- /dev/null +++ b/contrib/libstdc++/config/cpu/m68k/bits/cpu_limits.h @@ -0,0 +1,35 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_double_bits 96 + +#endif + + diff --git a/contrib/libstdc++/config/cpu/mips/bits/atomicity.h b/contrib/libstdc++/config/cpu/mips/bits/atomicity.h new file mode 100644 index 000000000000..7878c6eeb911 --- /dev/null +++ b/contrib/libstdc++/config/cpu/mips/bits/atomicity.h @@ -0,0 +1,78 @@ +// Low-level functions for atomic operations. MIPS II version. + +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// 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; + +static inline int +__attribute__ ((unused)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + int __result, __tmp; + + __asm__ __volatile__ + ("/* Inline exchange & add */\n\t" + "1:\n\t" + "ll %0,%3\n\t" + "addu %1,%4,%0\n\t" + "sc %1,%2\n\t" + "beqz %1,1b\n\t" + "/* End exchange & add */" + : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) + : "m" (*__mem), "r"(__val) + : "memory"); + + return __result; +} + +static inline void +__attribute__ ((unused)) +__atomic_add (volatile _Atomic_word *__mem, int __val) +{ + int __result; + + __asm__ __volatile__ + ("/* Inline atomic add */\n\t" + "1:\n\t" + "ll %0,%2\n\t" + "addu %0,%3,%0\n\t" + "sc %0,%1\n\t" + "beqz %0,1b\n\t" + "/* End atomic add */" + : "=&r"(__result), "=m"(*__mem) + : "m" (*__mem), "r"(__val) + : "memory"); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/mmix/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/mmix/bits/cpu_limits.h new file mode 100644 index 000000000000..e40ce97413ae --- /dev/null +++ b/contrib/libstdc++/config/cpu/mmix/bits/cpu_limits.h @@ -0,0 +1,34 @@ +// Copyright (C) 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 +#define __glibcpp_long_double_bits 64 + +#endif diff --git a/contrib/libstdc++/config/cpu/powerpc/bits/atomicity.h b/contrib/libstdc++/config/cpu/powerpc/bits/atomicity.h new file mode 100644 index 000000000000..05addba57850 --- /dev/null +++ b/contrib/libstdc++/config/cpu/powerpc/bits/atomicity.h @@ -0,0 +1,112 @@ +// Low-level functions for atomic operations: PowerPC version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __tmp, __res; + __asm__ __volatile__ ( + "/* Inline exchange & add */\n" + "0:\t" + "lwarx %0,0,%2 \n\t" + "add%I3 %1,%0,%3 \n\t" + "stwcx. %1,0,%2 \n\t" + "bne- 0b \n\t" + "/* End exchange & add */" + : "=&b"(__res), "=&r"(__tmp) + : "r" (__mem), "Ir"(__val) + : "cr0", "memory"); + return __res; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __tmp; + __asm__ __volatile__ ( + "/* Inline atomic add */\n" + "0:\t" + "lwarx %0,0,%1 \n\t" + "add%I2 %0,%0,%2 \n\t" + "stwcx. %0,0,%1 \n\t" + "bne- 0b \n\t" + "/* End atomic add */" + : "=&b"(__tmp) + : "r" (__mem), "Ir"(__val) + : "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 */ + diff --git a/contrib/libstdc++/config/cpu/powerpc/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/powerpc/bits/cpu_limits.h new file mode 100644 index 000000000000..87d7883bb02b --- /dev/null +++ b/contrib/libstdc++/config/cpu/powerpc/bits/cpu_limits.h @@ -0,0 +1,38 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#ifndef __LONG_DOUBLE_128__ +#define __glibcpp_long_double_bits 64 +#endif + +#endif + + + diff --git a/contrib/libstdc++/config/cpu/s390/bits/atomicity.h b/contrib/libstdc++/config/cpu/s390/bits/atomicity.h new file mode 100644 index 000000000000..331c29a570ac --- /dev/null +++ b/contrib/libstdc++/config/cpu/s390/bits/atomicity.h @@ -0,0 +1,60 @@ +// Low-level functions for atomic operations: S/390 version -*- C++ -*- + +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __old_val, __new_val; + + __asm__ __volatile__ (" l %0,0(%2)\n" + "0: lr %1,%0\n" + " ar %1,%3\n" + " cs %0,%1,0(%2)\n" + " jl 0b" + : "=&d" (__old_val), "=&d" (__new_val) + : "a" (__mem), "d" (__val) : "cc", "memory" ); + return __old_val; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word *__mem, int __val) +{ + __exchange_and_add (__mem, __val); +} + +#endif /* atomicity.h */ + + diff --git a/contrib/libstdc++/config/cpu/s390/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/s390/bits/cpu_limits.h new file mode 100644 index 000000000000..f0ff04dedaa1 --- /dev/null +++ b/contrib/libstdc++/config/cpu/s390/bits/cpu_limits.h @@ -0,0 +1,33 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_double_bits 64 + +#endif diff --git a/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h b/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h new file mode 100644 index 000000000000..aa639e42efb4 --- /dev/null +++ b/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h @@ -0,0 +1,88 @@ +// Low-level functions for atomic operations: Sparc32 version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +template <int __inst> +struct __Atomicity_lock +{ + static unsigned char _S_atomicity_lock; +}; + +template <int __inst> +unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0; + +template unsigned char __Atomicity_lock<0>::_S_atomicity_lock; + +static int +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __result, __tmp; + + __asm__ __volatile__("1: ldstub [%1], %0\n\t" + " cmp %0, 0\n\t" + " bne 1b\n\t" + " nop" + : "=&r" (__tmp) + : "r" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "memory"); + __result = *__mem; + *__mem += __val; + __asm__ __volatile__("stb %%g0, [%0]" + : /* no outputs */ + : "r" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "memory"); + return __result; +} + +static void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __tmp; + + __asm__ __volatile__("1: ldstub [%1], %0\n\t" + " cmp %0, 0\n\t" + " bne 1b\n\t" + " nop" + : "=&r" (__tmp) + : "r" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "memory"); + *__mem += __val; + __asm__ __volatile__("stb %%g0, [%0]" + : /* no outputs */ + : "r" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "memory"); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h b/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h new file mode 100644 index 000000000000..e13ca82fad2d --- /dev/null +++ b/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h @@ -0,0 +1,70 @@ +// Low-level functions for atomic operations: Sparc64 version -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef long _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + _Atomic_word __tmp1, __tmp2; + + __asm__ __volatile__("1: ldx [%2], %0\n\t" + " add %0, %3, %1\n\t" + " casx [%2], %0, %1\n\t" + " sub %0, %1, %0\n\t" + " brnz,pn %0, 1b\n\t" + " nop" + : "=&r" (__tmp1), "=&r" (__tmp2) + : "r" (__mem), "r" (__val) + : "memory"); + return __tmp2; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + _Atomic_word __tmp1, __tmp2; + + __asm__ __volatile__("1: ldx [%2], %0\n\t" + " add %0, %3, %1\n\t" + " casx [%2], %0, %1\n\t" + " sub %0, %1, %0\n\t" + " brnz,pn %0, 1b\n\t" + " nop" + : "=&r" (__tmp1), "=&r" (__tmp2) + : "r" (__mem), "r" (__val) + : "memory"); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/x86-64/bits/atomicity.h b/contrib/libstdc++/config/cpu/x86-64/bits/atomicity.h new file mode 100644 index 000000000000..15ff07fc1721 --- /dev/null +++ b/contrib/libstdc++/config/cpu/x86-64/bits/atomicity.h @@ -0,0 +1,55 @@ +// Low-level functions for atomic operations: AMD x86-64, -*- C++ -*- + +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _BITS_ATOMICITY_H +#define _BITS_ATOMICITY_H 1 + +typedef int _Atomic_word; + +static inline _Atomic_word +__attribute__ ((__unused__)) +__exchange_and_add (volatile _Atomic_word *__mem, int __val) +{ + register _Atomic_word __result; + __asm__ __volatile__ ("lock; xaddl %0,%2" + : "=r" (__result) + : "0" (__val), "m" (*__mem) + : "memory"); + return __result; +} + +static inline void +__attribute__ ((__unused__)) +__atomic_add (volatile _Atomic_word* __mem, int __val) +{ + __asm__ __volatile__ ("lock; addl %0,%1" + : : "ir" (__val), "m" (*__mem) : "memory"); +} + +#endif /* atomicity.h */ diff --git a/contrib/libstdc++/config/cpu/x86-64/bits/cpu_limits.h b/contrib/libstdc++/config/cpu/x86-64/bits/cpu_limits.h new file mode 100644 index 000000000000..7de187e2080e --- /dev/null +++ b/contrib/libstdc++/config/cpu/x86-64/bits/cpu_limits.h @@ -0,0 +1,35 @@ +// Copyright (C) 2001 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCPP_CPU_LIMITS +#define _GLIBCPP_CPU_LIMITS 1 + +#define __glibcpp_long_bits 64 + +#define __glibcpp_long_double_bits 80 + +#endif |