diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-02-23 10:15:45 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-02-23 10:15:45 -0500 |
commit | c758cdf4f6e959b92683f2dba6ce8617ac4f0a83 (patch) | |
tree | 36e2664048b4ba9d6925b33281afcab2a0aab53d /config/cpu | |
parent | 25786b77b700abbcce664e7e39504a2b0dd1f0c8 (diff) | |
download | jack1-c758cdf4f6e959b92683f2dba6ce8617ac4f0a83.tar.gz |
uncrustification of jack source code
Diffstat (limited to 'config/cpu')
-rw-r--r-- | config/cpu/alpha/atomicity.h | 48 | ||||
-rw-r--r-- | config/cpu/alpha/cycles.h | 7 | ||||
-rw-r--r-- | config/cpu/cris/atomicity.h | 56 | ||||
-rw-r--r-- | config/cpu/generic/atomicity.h | 12 | ||||
-rw-r--r-- | config/cpu/generic/cycles.h | 13 | ||||
-rw-r--r-- | config/cpu/i386/atomicity.h | 23 | ||||
-rw-r--r-- | config/cpu/i386/cycles.h | 7 | ||||
-rw-r--r-- | config/cpu/ia64/atomicity.h | 10 | ||||
-rw-r--r-- | config/cpu/ia64/cycles.h | 7 | ||||
-rw-r--r-- | config/cpu/ia64/ia64intrin.h | 220 | ||||
-rw-r--r-- | config/cpu/m68k/atomicity.h | 109 | ||||
-rw-r--r-- | config/cpu/mips/atomicity.h | 62 | ||||
-rw-r--r-- | config/cpu/powerpc/atomicity.h | 58 | ||||
-rw-r--r-- | config/cpu/powerpc/cycles.h | 22 | ||||
-rw-r--r-- | config/cpu/s390/atomicity.h | 30 |
15 files changed, 346 insertions, 338 deletions
diff --git a/config/cpu/alpha/atomicity.h b/config/cpu/alpha/atomicity.h index cb071cd..66bd328 100644 --- a/config/cpu/alpha/atomicity.h +++ b/config/cpu/alpha/atomicity.h @@ -28,7 +28,7 @@ // the GNU General Public License. #ifndef _GLIBCXX_ATOMICITY_H -#define _GLIBCXX_ATOMICITY_H 1 +#define _GLIBCXX_ATOMICITY_H 1 /* @@@ With gas we can play nice .subsection games to get the non-predicted branch pointing forward. But Digital assemblers @@ -39,38 +39,38 @@ typedef int _Atomic_word; static inline _Atomic_word __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* __mem, int __val) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) { - register int __result, __tmp; + 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)); + __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; + return __result; } static inline void __attribute__ ((__unused__)) -__atomic_add(volatile _Atomic_word* __mem, int __val) +__atomic_add (volatile _Atomic_word* __mem, int __val) { - register _Atomic_word __result; + 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)); + __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/config/cpu/alpha/cycles.h b/config/cpu/alpha/cycles.h index dccbd04..7e2cf17 100644 --- a/config/cpu/alpha/cycles.h +++ b/config/cpu/alpha/cycles.h @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Paul Davis Code derived from various headers from the Linux kernel - + This program 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 of the License, or @@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + */ #ifndef __jack_cycles_h__ #define __jack_cycles_h__ @@ -27,7 +27,8 @@ typedef unsigned int cycles_t; static inline cycles_t get_cycles (void) { cycles_t ret; - __asm__ __volatile__ ("rpcc %0" : "=r"(ret)); + + __asm__ __volatile__ ("rpcc %0" : "=r" (ret)); return ret; } diff --git a/config/cpu/cris/atomicity.h b/config/cpu/cris/atomicity.h index fecb9dc..2fc1a8c 100644 --- a/config/cpu/cris/atomicity.h +++ b/config/cpu/cris/atomicity.h @@ -28,51 +28,51 @@ // the GNU General Public License. #ifndef _GLIBCXX_ATOMICITY_H -#define _GLIBCXX_ATOMICITY_H 1 +#define _GLIBCXX_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) +__exchange_and_add (_Atomic_word* __mem, int __val) { - int __tmp; - _Atomic_word __result; + 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)); + __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)); #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) - : "r9"); + __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) + : "r9"); #endif - return __result; + return __result; } static inline void __attribute__ ((__unused__)) -__atomic_add(_Atomic_word* __mem, int __val) +__atomic_add (_Atomic_word* __mem, int __val) { - __exchange_and_add(__mem, __val); + __exchange_and_add (__mem, __val); } #endif /* atomicity.h */ diff --git a/config/cpu/generic/atomicity.h b/config/cpu/generic/atomicity.h index 0b25100..b781c44 100644 --- a/config/cpu/generic/atomicity.h +++ b/config/cpu/generic/atomicity.h @@ -18,22 +18,22 @@ 02111-1307 USA. */ #ifndef _ATOMICITY_H -#define _ATOMICITY_H 1 +#define _ATOMICITY_H 1 typedef int _Atomic_word; -static inline _Atomic_word +static inline _Atomic_word __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* mem, int val) +__exchange_and_add (volatile _Atomic_word* mem, int val) { - return __sync_fetch_and_add(mem, val); + return __sync_fetch_and_add (mem, val); } static inline void __attribute__ ((__unused__)) -__atomic_add(volatile _Atomic_word* mem, int val) +__atomic_add (volatile _Atomic_word* mem, int val) { - __sync_add_and_fetch(mem, val); + __sync_add_and_fetch (mem, val); } #endif /* atomicity.h */ diff --git a/config/cpu/generic/cycles.h b/config/cpu/generic/cycles.h index b05fb0e..12ccb8f 100644 --- a/config/cpu/generic/cycles.h +++ b/config/cpu/generic/cycles.h @@ -1,6 +1,6 @@ /* Copyright (C) 2001 Paul Davis - + This program 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 of the License, or @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + */ #ifndef __jack_cycles_h__ #define __jack_cycles_h__ @@ -26,12 +26,13 @@ typedef long cycles_t; -static inline cycles_t get_cycles(void) +static inline cycles_t get_cycles (void) { - struct timespec time; - clock_gettime(CLOCK_REALTIME, &time); + struct timespec time; + + clock_gettime (CLOCK_REALTIME, &time); - return ((cycles_t) time.tv_sec * 1000000) + time.tv_nsec*1000; + return ((cycles_t)time.tv_sec * 1000000) + time.tv_nsec * 1000; } #endif /* __jack_cycles_h__ */ diff --git a/config/cpu/i386/atomicity.h b/config/cpu/i386/atomicity.h index 73be009..b9cad70 100644 --- a/config/cpu/i386/atomicity.h +++ b/config/cpu/i386/atomicity.h @@ -26,27 +26,28 @@ // the GNU General Public License. #ifndef _GLIBCXX_ATOMICITY_H -#define _GLIBCXX_ATOMICITY_H 1 +#define _GLIBCXX_ATOMICITY_H 1 typedef int _Atomic_word; -static inline _Atomic_word +static inline _Atomic_word __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* __mem, int __val) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) { - register _Atomic_word __result; - __asm__ __volatile__ ("lock; xaddl %0,%1" - : "=r" (__result), "=m" (*__mem) - : "0" (__val), "m" (*__mem)); - return __result; + register _Atomic_word __result; + + __asm__ __volatile__ ("lock; xaddl %0,%1" + : "=r" (__result), "=m" (*__mem) + : "0" (__val), "m" (*__mem)); + return __result; } static inline void __attribute__ ((__unused__)) -__atomic_add(volatile _Atomic_word* __mem, int __val) +__atomic_add (volatile _Atomic_word* __mem, int __val) { - __asm__ __volatile__ ("lock; addl %1,%0" - : "=m" (*__mem) : "ir" (__val), "m" (*__mem)); + __asm__ __volatile__ ("lock; addl %1,%0" + : "=m" (*__mem) : "ir" (__val), "m" (*__mem)); } #endif /* atomicity.h */ diff --git a/config/cpu/i386/cycles.h b/config/cpu/i386/cycles.h index f90c445..4a26560 100644 --- a/config/cpu/i386/cycles.h +++ b/config/cpu/i386/cycles.h @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Paul Davis Code derived from various headers from the Linux kernel - + This program 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 of the License, or @@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + */ #ifndef __jack_cycles_h__ #define __jack_cycles_h__ @@ -26,7 +26,8 @@ typedef unsigned long long cycles_t; static inline cycles_t get_cycles (void) { unsigned long long ret; - __asm__ __volatile__("rdtsc" : "=A" (ret)); + + __asm__ __volatile__ ("rdtsc" : "=A" (ret)); return ret; } diff --git a/config/cpu/ia64/atomicity.h b/config/cpu/ia64/atomicity.h index d326a13..8a581f2 100644 --- a/config/cpu/ia64/atomicity.h +++ b/config/cpu/ia64/atomicity.h @@ -34,18 +34,18 @@ typedef int _Atomic_word; -static inline _Atomic_word +static inline _Atomic_word __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* __mem, int __val) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) { - return __sync_fetch_and_add(__mem, __val); + return __sync_fetch_and_add (__mem, __val); } static inline void __attribute__ ((__unused__)) -__atomic_add(volatile _Atomic_word* __mem, int __val) +__atomic_add (volatile _Atomic_word* __mem, int __val) { - __sync_fetch_and_add(__mem, __val); + __sync_fetch_and_add (__mem, __val); } #endif /* atomicity.h */ diff --git a/config/cpu/ia64/cycles.h b/config/cpu/ia64/cycles.h index d927cce..4bd19ed 100644 --- a/config/cpu/ia64/cycles.h +++ b/config/cpu/ia64/cycles.h @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Paul Davis Code derived from various headers from the Linux kernel - + This program 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 of the License, or @@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + */ #ifndef __jack_cycles_h__ #define __jack_cycles_h__ @@ -28,7 +28,8 @@ static inline cycles_t get_cycles (void) { cycles_t ret; - __asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret)); + + __asm__ __volatile__ ("mov %0=ar.itc" : "=r" (ret)); return ret; } diff --git a/config/cpu/ia64/ia64intrin.h b/config/cpu/ia64/ia64intrin.h index 262dc20..3bdcf9d 100644 --- a/config/cpu/ia64/ia64intrin.h +++ b/config/cpu/ia64/ia64intrin.h @@ -7,121 +7,121 @@ extern "C" { #endif -extern void __sync_synchronize (void); +extern void __sync_synchronize(void); -extern int __sync_val_compare_and_swap_si (int *, int, int); -extern long __sync_val_compare_and_swap_di (long *, long, long); +extern int __sync_val_compare_and_swap_si(int *, int, int); +extern long __sync_val_compare_and_swap_di(long *, long, long); #define __sync_val_compare_and_swap(PTR, OLD, NEW) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) \ - __sync_val_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW)) \ - : (__typeof__(*(PTR))) \ - __sync_val_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW))) - -extern int __sync_bool_compare_and_swap_si (int *, int, int); -extern int __sync_bool_compare_and_swap_di (long *, long, long); + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR))) \ + __sync_val_compare_and_swap_si ((int*)(PTR), (int)(OLD), (int)(NEW)) \ + : (__typeof__(*(PTR))) \ + __sync_val_compare_and_swap_di ((long*)(PTR), (long)(OLD), (long)(NEW))) + +extern int __sync_bool_compare_and_swap_si(int *, int, int); +extern int __sync_bool_compare_and_swap_di(long *, long, long); #define __sync_bool_compare_and_swap(PTR, OLD, NEW) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? __sync_bool_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW)) \ - : __sync_bool_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW))) + ((sizeof(*(PTR)) == sizeof(int)) \ + ? __sync_bool_compare_and_swap_si ((int*)(PTR), (int)(OLD), (int)(NEW)) \ + : __sync_bool_compare_and_swap_di ((long*)(PTR), (long)(OLD), (long)(NEW))) -extern void __sync_lock_release_si (int *); -extern void __sync_lock_release_di (long *); +extern void __sync_lock_release_si(int *); +extern void __sync_lock_release_di(long *); #define __sync_lock_release(PTR) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? __sync_lock_release_si((int *)(PTR)) \ - : __sync_lock_release_di((long *)(PTR))) - -extern int __sync_lock_test_and_set_si (int *, int); -extern long __sync_lock_test_and_set_di (long *, long); -#define __sync_lock_test_and_set(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_lock_test_and_set_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_lock_test_and_set_di((long *)(PTR),(long)(VAL))) - -extern int __sync_fetch_and_add_si (int *, int); -extern long __sync_fetch_and_add_di (long *, long); -#define __sync_fetch_and_add(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_fetch_and_add_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_fetch_and_add_di((long *)(PTR),(long)(VAL))) - -extern int __sync_fetch_and_sub_si (int *, int); -extern long __sync_fetch_and_sub_di (long *, long); -#define __sync_fetch_and_sub(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_fetch_and_sub_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_fetch_and_sub_di((long *)(PTR),(long)(VAL))) - -extern int __sync_fetch_and_and_si (int *, int); -extern long __sync_fetch_and_and_di (long *, long); -#define __sync_fetch_and_and(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_fetch_and_and_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_fetch_and_and_di((long *)(PTR),(long)(VAL))) - -extern int __sync_fetch_and_or_si (int *, int); -extern long __sync_fetch_and_or_di (long *, long); -#define __sync_fetch_and_or(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_fetch_and_or_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_fetch_and_or_di((long *)(PTR),(long)(VAL))) - -extern int __sync_fetch_and_xor_si (int *, int); -extern long __sync_fetch_and_xor_di (long *, long); -#define __sync_fetch_and_xor(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_fetch_and_xor_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_fetch_and_xor_di((long *)(PTR),(long)(VAL))) - -extern int __sync_fetch_and_nand_si (int *, int); -extern long __sync_fetch_and_nand_di (long *, long); -#define __sync_fetch_and_nand(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_fetch_and_nand_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_fetch_and_nand_di((long *)(PTR),(long)(VAL))) - -extern int __sync_add_and_fetch_si (int *, int); -extern long __sync_add_and_fetch_di (long *, long); -#define __sync_add_and_fetch(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_add_and_fetch_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_add_and_fetch_di((long *)(PTR),(long)(VAL))) - -extern int __sync_sub_and_fetch_si (int *, int); -extern long __sync_sub_and_fetch_di (long *, long); -#define __sync_sub_and_fetch(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_sub_and_fetch_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_sub_and_fetch_di((long *)(PTR),(long)(VAL))) - -extern int __sync_and_and_fetch_si (int *, int); -extern long __sync_and_and_fetch_di (long *, long); -#define __sync_and_and_fetch(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_and_and_fetch_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_and_and_fetch_di((long *)(PTR),(long)(VAL))) - -extern int __sync_or_and_fetch_si (int *, int); -extern long __sync_or_and_fetch_di (long *, long); -#define __sync_or_and_fetch(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_or_and_fetch_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_or_and_fetch_di((long *)(PTR),(long)(VAL))) - -extern int __sync_xor_and_fetch_si (int *, int); -extern long __sync_xor_and_fetch_di (long *, long); -#define __sync_xor_and_fetch(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_xor_and_fetch_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_xor_and_fetch_di((long *)(PTR),(long)(VAL))) - -extern int __sync_nand_and_fetch_si (int *, int); -extern long __sync_nand_and_fetch_di (long *, long); -#define __sync_nand_and_fetch(PTR,VAL) \ - ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) __sync_nand_and_fetch_si((int *)(PTR),(int)(VAL)) \ - : (__typeof__(*(PTR))) __sync_nand_and_fetch_di((long *)(PTR),(long)(VAL))) + ((sizeof(*(PTR)) == sizeof(int)) \ + ? __sync_lock_release_si ((int*)(PTR)) \ + : __sync_lock_release_di ((long*)(PTR))) + +extern int __sync_lock_test_and_set_si(int *, int); +extern long __sync_lock_test_and_set_di(long *, long); +#define __sync_lock_test_and_set(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_lock_test_and_set_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_lock_test_and_set_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_fetch_and_add_si(int *, int); +extern long __sync_fetch_and_add_di(long *, long); +#define __sync_fetch_and_add(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_fetch_and_add_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_fetch_and_add_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_fetch_and_sub_si(int *, int); +extern long __sync_fetch_and_sub_di(long *, long); +#define __sync_fetch_and_sub(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_fetch_and_sub_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_fetch_and_sub_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_fetch_and_and_si(int *, int); +extern long __sync_fetch_and_and_di(long *, long); +#define __sync_fetch_and_and(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_fetch_and_and_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_fetch_and_and_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_fetch_and_or_si(int *, int); +extern long __sync_fetch_and_or_di(long *, long); +#define __sync_fetch_and_or(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_fetch_and_or_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_fetch_and_or_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_fetch_and_xor_si(int *, int); +extern long __sync_fetch_and_xor_di(long *, long); +#define __sync_fetch_and_xor(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_fetch_and_xor_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_fetch_and_xor_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_fetch_and_nand_si(int *, int); +extern long __sync_fetch_and_nand_di(long *, long); +#define __sync_fetch_and_nand(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_fetch_and_nand_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_fetch_and_nand_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_add_and_fetch_si(int *, int); +extern long __sync_add_and_fetch_di(long *, long); +#define __sync_add_and_fetch(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_add_and_fetch_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_add_and_fetch_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_sub_and_fetch_si(int *, int); +extern long __sync_sub_and_fetch_di(long *, long); +#define __sync_sub_and_fetch(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_sub_and_fetch_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_sub_and_fetch_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_and_and_fetch_si(int *, int); +extern long __sync_and_and_fetch_di(long *, long); +#define __sync_and_and_fetch(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_and_and_fetch_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_and_and_fetch_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_or_and_fetch_si(int *, int); +extern long __sync_or_and_fetch_di(long *, long); +#define __sync_or_and_fetch(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_or_and_fetch_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_or_and_fetch_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_xor_and_fetch_si(int *, int); +extern long __sync_xor_and_fetch_di(long *, long); +#define __sync_xor_and_fetch(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_xor_and_fetch_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_xor_and_fetch_di ((long*)(PTR), (long)(VAL))) + +extern int __sync_nand_and_fetch_si(int *, int); +extern long __sync_nand_and_fetch_di(long *, long); +#define __sync_nand_and_fetch(PTR, VAL) \ + ((sizeof(*(PTR)) == sizeof(int)) \ + ? (__typeof__(*(PTR)))__sync_nand_and_fetch_si ((int*)(PTR), (int)(VAL)) \ + : (__typeof__(*(PTR)))__sync_nand_and_fetch_di ((long*)(PTR), (long)(VAL))) #ifdef __cplusplus } diff --git a/config/cpu/m68k/atomicity.h b/config/cpu/m68k/atomicity.h index eb801de..8b224e2 100644 --- a/config/cpu/m68k/atomicity.h +++ b/config/cpu/m68k/atomicity.h @@ -28,112 +28,113 @@ // the GNU General Public License. #ifndef _GLIBCXX_ATOMICITY_H -#define _GLIBCXX_ATOMICITY_H 1 +#define _GLIBCXX_ATOMICITY_H 1 typedef int _Atomic_word; #if ( defined(__mc68020__) || defined(__mc68030__) \ - || defined(__mc68040__) || defined(__mc68060__) ) \ - && !defined(__mcpu32__) + || defined(__mc68040__) || defined(__mc68060__) ) \ + && !defined(__mcpu32__) // These variants support compare-and-swap. -static inline _Atomic_word +static inline _Atomic_word __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* __mem, int __val) +__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 %3,%1\n\t" - "cas%.l %0,%1,%2\n\t" - "jne 1b" - : "=d" (__result), "=&d" (__temp), "=m" (*__mem) - : "d" (__val), "0" (__result), "m" (*__mem)); - return __result; + register _Atomic_word __result = *__mem; + register _Atomic_word __temp; + + __asm__ __volatile__ ("1: move%.l %0,%1\n\t" + "add%.l %3,%1\n\t" + "cas%.l %0,%1,%2\n\t" + "jne 1b" + : "=d" (__result), "=&d" (__temp), "=m" (*__mem) + : "d" (__val), "0" (__result), "m" (*__mem)); + 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. - */ +/* + * 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) +__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)); + _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; + __result = *__mem; + *__mem = __result + __val; - __asm__ __volatile__ ("move%.w %0,%%sr" : : "d"(__level)); + __asm__ __volatile__ ("move%.w %0,%%sr" : : "d" (__level)); - return __result; + return __result; } #else template<int __inst> - struct __Atomicity_lock - { - static volatile unsigned char _S_atomicity_lock; - }; +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 +static inline _Atomic_word __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* __mem, int __val) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) { - _Atomic_word __result; + _Atomic_word __result; // bset with no immediate addressing (not SMP-safe) #if defined(__mcf5200__) || defined(__mcf5300__) - __asm__ __volatile__("1: bset.b #7,%0@\n\tjbne 1b" - : /* no outputs */ - : "a"(&__Atomicity_lock<0>::_S_atomicity_lock) - : "cc", "memory"); + __asm__ __volatile__ ("1: bset.b #7,%0@\n\tjbne 1b" + : /* no outputs */ + : "a" (&__Atomicity_lock<0>::_S_atomicity_lock) + : "cc", "memory"); // CPU32 and MCF5400 support test-and-set (SMP-safe). #elif defined(__mcpu32__) || defined(__mcf5400__) - __asm__ __volatile__("1: tas %0\n\tjbne 1b" - : "+m"(__Atomicity_lock<0>::_S_atomicity_lock) - : /* none */ - : "cc"); + __asm__ __volatile__ ("1: tas %0\n\tjbne 1b" + : "+m" (__Atomicity_lock<0>::_S_atomicity_lock) + : /* none */ + : "cc"); // Use bset with immediate addressing for 68000/68010 (not SMP-safe) // NOTE: TAS is available on the 68000, but unsupported by some Amiga // memory controllers. #else - __asm__ __volatile__("1: bset.b #7,%0\n\tjbne 1b" - : "+m"(__Atomicity_lock<0>::_S_atomicity_lock) - : /* none */ - : "cc"); + __asm__ __volatile__ ("1: bset.b #7,%0\n\tjbne 1b" + : "+m" (__Atomicity_lock<0>::_S_atomicity_lock) + : /* none */ + : "cc"); #endif - __result = *__mem; - *__mem = __result + __val; + __result = *__mem; + *__mem = __result + __val; - __Atomicity_lock<0>::_S_atomicity_lock = 0; + __Atomicity_lock<0>::_S_atomicity_lock = 0; - return __result; + return __result; } #endif /* TAS / BSET */ static inline void __attribute__ ((__unused__)) -__atomic_add(volatile _Atomic_word* __mem, int __val) +__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); + // Careful: using add.l with a memory destination is not + // architecturally guaranteed to be atomic. + (void)__exchange_and_add (__mem, __val); } #endif /* !_GLIBCXX_ATOMICITY_H */ diff --git a/config/cpu/mips/atomicity.h b/config/cpu/mips/atomicity.h index 3d0c7a1..be471af 100644 --- a/config/cpu/mips/atomicity.h +++ b/config/cpu/mips/atomicity.h @@ -34,50 +34,50 @@ typedef int _Atomic_word; static inline int __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* __mem, int __val) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) { - int __result, __tmp; + int __result, __tmp; - __asm__ __volatile__ - ("/* Inline exchange & add */\n\t" - "1:\n\t" - ".set push\n\t" + __asm__ __volatile__ + ("/* Inline exchange & add */\n\t" + "1:\n\t" + ".set push\n\t" #if _MIPS_SIM == _ABIO32 - ".set mips2\n\t" + ".set mips2\n\t" #endif - "ll %0,%3\n\t" - "addu %1,%4,%0\n\t" - "sc %1,%2\n\t" - ".set pop\n\t" - "beqz %1,1b\n\t" - "/* End exchange & add */" - : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) - : "m" (*__mem), "r"(__val)); + "ll %0,%3\n\t" + "addu %1,%4,%0\n\t" + "sc %1,%2\n\t" + ".set pop\n\t" + "beqz %1,1b\n\t" + "/* End exchange & add */" + : "=&r" (__result), "=&r" (__tmp), "=m" (*__mem) + : "m" (*__mem), "r" (__val)); - return __result; + return __result; } static inline void __attribute__ ((__unused__)) -__atomic_add(volatile _Atomic_word* __mem, int __val) +__atomic_add (volatile _Atomic_word* __mem, int __val) { - int __result; + int __result; - __asm__ __volatile__ - ("/* Inline atomic add */\n\t" - "1:\n\t" - ".set push\n\t" + __asm__ __volatile__ + ("/* Inline atomic add */\n\t" + "1:\n\t" + ".set push\n\t" #if _MIPS_SIM == _ABIO32 - ".set mips2\n\t" + ".set mips2\n\t" #endif - "ll %0,%2\n\t" - "addu %0,%3,%0\n\t" - "sc %0,%1\n\t" - ".set pop\n\t" - "beqz %0,1b\n\t" - "/* End atomic add */" - : "=&r"(__result), "=m"(*__mem) - : "m" (*__mem), "r"(__val)); + "ll %0,%2\n\t" + "addu %0,%3,%0\n\t" + "sc %0,%1\n\t" + ".set pop\n\t" + "beqz %0,1b\n\t" + "/* End atomic add */" + : "=&r" (__result), "=m" (*__mem) + : "m" (*__mem), "r" (__val)); } #endif /* atomicity.h */ diff --git a/config/cpu/powerpc/atomicity.h b/config/cpu/powerpc/atomicity.h index 3b44b7d..5a74a65 100644 --- a/config/cpu/powerpc/atomicity.h +++ b/config/cpu/powerpc/atomicity.h @@ -28,7 +28,7 @@ // the GNU General Public License. #ifndef _GLIBCXX_ATOMICITY_H -#define _GLIBCXX_ATOMICITY_H 1 +#define _GLIBCXX_ATOMICITY_H 1 #ifdef __PPC405__ #define _STWCX "sync \n\tstwcx. " @@ -40,39 +40,41 @@ typedef int _Atomic_word; static inline _Atomic_word __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* __mem, int __val) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) { - _Atomic_word __tmp, __res; - __asm__ __volatile__ ( - "/* Inline exchange & add */\n" - "0:\t" - "lwarx %0,0,%3 \n\t" - "add%I4 %1,%0,%4 \n\t" - _STWCX " %1,0,%3 \n\t" - "bne- 0b \n\t" - "/* End exchange & add */" - : "=&b"(__res), "=&r"(__tmp), "=m" (*__mem) - : "r" (__mem), "Ir"(__val), "m" (*__mem) - : "cr0"); - return __res; + _Atomic_word __tmp, __res; + + __asm__ __volatile__ ( + "/* Inline exchange & add */\n" + "0:\t" + "lwarx %0,0,%3 \n\t" + "add%I4 %1,%0,%4 \n\t" + _STWCX " %1,0,%3 \n\t" + "bne- 0b \n\t" + "/* End exchange & add */" + : "=&b" (__res), "=&r" (__tmp), "=m" (*__mem) + : "r" (__mem), "Ir" (__val), "m" (*__mem) + : "cr0"); + return __res; } static inline void __attribute__ ((__unused__)) -__atomic_add(volatile _Atomic_word* __mem, int __val) +__atomic_add (volatile _Atomic_word* __mem, int __val) { - _Atomic_word __tmp; - __asm__ __volatile__ ( - "/* Inline atomic add */\n" - "0:\t" - "lwarx %0,0,%2 \n\t" - "add%I3 %0,%0,%3 \n\t" - _STWCX " %0,0,%2 \n\t" - "bne- 0b \n\t" - "/* End atomic add */" - : "=&b"(__tmp), "=m" (*__mem) - : "r" (__mem), "Ir"(__val), "m" (*__mem) - : "cr0"); + _Atomic_word __tmp; + + __asm__ __volatile__ ( + "/* Inline atomic add */\n" + "0:\t" + "lwarx %0,0,%2 \n\t" + "add%I3 %0,%0,%3 \n\t" + _STWCX " %0,0,%2 \n\t" + "bne- 0b \n\t" + "/* End atomic add */" + : "=&b" (__tmp), "=m" (*__mem) + : "r" (__mem), "Ir" (__val), "m" (*__mem) + : "cr0"); } #endif /* atomicity.h */ diff --git a/config/cpu/powerpc/cycles.h b/config/cpu/powerpc/cycles.h index bdf9908..2b9097f 100644 --- a/config/cpu/powerpc/cycles.h +++ b/config/cpu/powerpc/cycles.h @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Paul Davis Code derived from various headers from the Linux kernel - + This program 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 of the License, or @@ -16,16 +16,16 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + */ #ifndef __jack_cycles_h__ #define __jack_cycles_h__ /* PowerPC */ -#define CPU_FTR_601 0x00000100 +#define CPU_FTR_601 0x00000100 #ifdef __powerpc64__ -#define CPU_FTR_CELL_TB_BUG 0x0000800000000000UL +#define CPU_FTR_CELL_TB_BUG 0x0000800000000000UL #endif /* __powerpc64__ */ typedef unsigned long cycles_t; @@ -34,13 +34,13 @@ typedef unsigned long cycles_t; extern cycles_t cacheflush_time; -static inline cycles_t get_cycles(void) +static inline cycles_t get_cycles (void) { cycles_t ret = 0; #ifdef __powerpc64__ #ifdef ENABLE_CELLBE - asm volatile( \ + asm volatile ( \ "90: mftb %0;\n" \ "97: cmpwi %0,0;\n" \ " beq- 90b;\n" \ @@ -54,11 +54,11 @@ static inline cycles_t get_cycles(void) " .llong 99b-98b\n" \ ".previous" \ : "=r" (ret) : "i" (CPU_FTR_CELL_TB_BUG)); -#else /* !ENABLE_CELLBE */ - __asm__ __volatile__("mftb %0" : "=r" (ret)); +#else /* !ENABLE_CELLBE */ + __asm__ __volatile__ ("mftb %0" : "=r" (ret)); #endif /* !ENABLE_CELLBE */ -#else /* !__powerpc64__ */ - __asm__ __volatile__( +#else /* !__powerpc64__ */ + __asm__ __volatile__ ( "98: mftb %0\n" "99:\n" ".section __ftr_fixup,\"a\"\n" @@ -68,7 +68,7 @@ static inline cycles_t get_cycles(void) " .long 99b\n" ".previous" : "=r" (ret) : "i" (CPU_FTR_601)); -#endif /* !__powerpc64__ */ +#endif /* !__powerpc64__ */ return ret; } diff --git a/config/cpu/s390/atomicity.h b/config/cpu/s390/atomicity.h index 8647c76..5d2b3b9 100644 --- a/config/cpu/s390/atomicity.h +++ b/config/cpu/s390/atomicity.h @@ -28,31 +28,31 @@ // the GNU General Public License. #ifndef _GLIBCXX_ATOMICITY_H -#define _GLIBCXX_ATOMICITY_H 1 +#define _GLIBCXX_ATOMICITY_H 1 typedef int _Atomic_word; -static inline _Atomic_word +static inline _Atomic_word __attribute__ ((__unused__)) -__exchange_and_add(volatile _Atomic_word* __mem, int __val) +__exchange_and_add (volatile _Atomic_word* __mem, int __val) { - register _Atomic_word __old_val, __new_val; - - __asm__ __volatile__ (" l %0,0(%3)\n" - "0: lr %1,%0\n" - " ar %1,%4\n" - " cs %0,%1,0(%3)\n" - " jl 0b" - : "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem) - : "a" (__mem), "d" (__val), "m" (*__mem) : "cc"); - return __old_val; + register _Atomic_word __old_val, __new_val; + + __asm__ __volatile__ (" l %0,0(%3)\n" + "0: lr %1,%0\n" + " ar %1,%4\n" + " cs %0,%1,0(%3)\n" + " jl 0b" + : "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem) + : "a" (__mem), "d" (__val), "m" (*__mem) : "cc"); + return __old_val; } static inline void __attribute__ ((__unused__)) -__atomic_add(volatile _Atomic_word* __mem, int __val) +__atomic_add (volatile _Atomic_word* __mem, int __val) { - __exchange_and_add(__mem, __val); + __exchange_and_add (__mem, __val); } #endif /* atomicity.h */ |