diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2016-03-01 15:21:09 +0100 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2016-03-01 15:21:09 +0100 |
commit | 91d965d80c34fafc7573d520006c7b597ef2c5f5 (patch) | |
tree | f678bebfae0039e177d9bbdee9864595decbe27c /src/osd/eigccppc.h | |
parent | 0b4723c8cc522d08c8267d8b1bb0863768a76c6e (diff) |
remove asm part for atomic implementations (nw)
Diffstat (limited to 'src/osd/eigccppc.h')
-rw-r--r-- | src/osd/eigccppc.h | 187 |
1 files changed, 0 insertions, 187 deletions
diff --git a/src/osd/eigccppc.h b/src/osd/eigccppc.h index dacf6b5efc3..d9cd2ee1828 100644 --- a/src/osd/eigccppc.h +++ b/src/osd/eigccppc.h @@ -285,193 +285,6 @@ _count_leading_ones(UINT32 value) } - -/*************************************************************************** - INLINE SYNCHRONIZATION FUNCTIONS -***************************************************************************/ - -/*------------------------------------------------- - compare_exchange32 - compare the 'compare' - value against the memory at 'ptr'; if equal, - swap in the 'exchange' value. Regardless, - return the previous value at 'ptr'. --------------------------------------------------*/ - -#define compare_exchange32 _compare_exchange32 -static inline INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE -_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) -{ - INT32 result; - - __asm__ __volatile__ ( - "1: lwarx %[result], 0, %[ptr] \n" - " cmpw %[compare], %[result] \n" - " bne 2f \n" - " stwcx. %[exchange], 0, %[ptr] \n" - " bne- 1b \n" - " lwsync \n" - "2: " - : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ - , [result] "=&r" (result) - : [ptr] "r" (ptr) - , [exchange] "r" (exchange) - , [compare] "r" (compare) - : "cr0" - ); - - return result; -} - - -/*------------------------------------------------- - compare_exchange64 - compare the 'compare' - value against the memory at 'ptr'; if equal, - swap in the 'exchange' value. Regardless, - return the previous value at 'ptr'. --------------------------------------------------*/ - -#if defined(__ppc64__) || defined(__PPC64__) -#define compare_exchange64 _compare_exchange64 -static inline INT64 ATTR_NONNULL(1) ATTR_FORCE_INLINE -_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) -{ - INT64 result; - - __asm__ __volatile__ ( - "1: ldarx %[result], 0, %[ptr] \n" - " cmpd %[compare], %[result] \n" - " bne 2f \n" - " stdcx. %[exchange], 0, %[ptr] \n" - " bne- 1b \n" - " lwsync \n" - "2: " - : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ - , [result] "=&r" (result) - : [ptr] "r" (ptr) - , [exchange] "r" (exchange) - , [compare] "r" (compare) - : "cr0" - ); - - return result; -} -#endif - - -/*------------------------------------------------- - atomic_exchange32 - atomically exchange the - exchange value with the memory at 'ptr', - returning the original value. --------------------------------------------------*/ - -#define atomic_exchange32 _atomic_exchange32 -static inline INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE -_atomic_exchange32(INT32 volatile *ptr, INT32 exchange) -{ - INT32 result; - - __asm__ __volatile__ ( - "1: lwarx %[result], 0, %[ptr] \n" - " stwcx. %[exchange], 0, %[ptr] \n" - " bne- 1b \n" - " lwsync \n" - : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ - , [result] "=&r" (result) - : [ptr] "r" (ptr) - , [exchange] "r" (exchange) - : "cr0" - ); - - return result; -} - - -/*------------------------------------------------- - atomic_add32 - atomically add the delta value - to the memory at 'ptr', returning the final - result. --------------------------------------------------*/ - -#define atomic_add32 _atomic_add32 -static inline INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE -_atomic_add32(INT32 volatile *ptr, INT32 delta) -{ - INT32 result; - - __asm__ __volatile__ ( - "1: lwarx %[result], 0, %[ptr] \n" - " add %[result], %[result], %[delta] \n" - " stwcx. %[result], 0, %[ptr] \n" - " bne- 1b \n" - " lwsync \n" - : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ - , [result] "=&b" (result) - : [ptr] "r" (ptr) - , [delta] "r" (delta) - : "cr0" - ); - - return result; -} - - -/*------------------------------------------------- - atomic_increment32 - atomically increment the - 32-bit value in memory at 'ptr', returning the - final result. --------------------------------------------------*/ - -#define atomic_increment32 _atomic_increment32 -static inline INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE -_atomic_increment32(INT32 volatile *ptr) -{ - INT32 result; - - __asm__ __volatile__ ( - "1: lwarx %[result], 0, %[ptr] \n" - " addi %[result], %[result], 1 \n" - " stwcx. %[result], 0, %[ptr] \n" - " bne- 1b \n" - " lwsync \n" - : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ - , [result] "=&b" (result) - : [ptr] "r" (ptr) - : "cr0" - ); - - return result; -} - - -/*------------------------------------------------- - atomic_decrement32 - atomically decrement the - 32-bit value in memory at 'ptr', returning the - final result. --------------------------------------------------*/ - -#define atomic_decrement32 _atomic_decrement32 -static inline INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE -_atomic_decrement32(INT32 volatile *ptr) -{ - INT32 result; - - __asm__ __volatile__ ( - "1: lwarx %[result], 0, %[ptr] \n" - " addi %[result], %[result], -1 \n" - " stwcx. %[result], 0, %[ptr] \n" - " bne- 1b \n" - " lwsync \n" - : [dummy] "+m" (*ptr) /* Lets GCC know that *ptr will be read/written in case it's not marked volatile */ - , [result] "=&b" (result) - : [ptr] "r" (ptr) - : "cr0" - ); - - return result; -} - - - /*************************************************************************** INLINE TIMING FUNCTIONS ***************************************************************************/ |