Hi Attached is a patch to provide a number of missing 64-bit atomic functions. These are needed for the c89atomic library ( https://github.com/mackron/c89atomic), and have been tested with the test program provided with it.
Note that due to a bug in c89atomic, the code path for GCC 4.6 and earlier is being used with GCC 4.7, which fails due to the lack of __sync_lock_test_and_set_1, which appears to be more complicated to fix. This is worked around in https://github.com/mackron/c89atomic/pull/1 , however it is something to look out for in the future. Regards Cameron
Index: recipe/files/gcc/libunixlib/gcccompat/atomics.c =================================================================== --- recipe/files/gcc/libunixlib/gcccompat/atomics.c (revision 7440) +++ recipe/files/gcc/libunixlib/gcccompat/atomics.c (working copy) @@ -94,6 +94,7 @@ ATOMIC_EXCHANGE(1,uint8_t) ATOMIC_EXCHANGE(2,short) ATOMIC_EXCHANGE(4,uint32_t) +ATOMIC_EXCHANGE(8,uint64_t) /* This built-in function implements an atomic compare and exchange operation. * This compares the contents of *ptr with the contents of *expected and if equal, @@ -143,6 +144,7 @@ ATOMIC_COMPARE_AND_EXCHANGE(1,uint8_t) ATOMIC_COMPARE_AND_EXCHANGE(2,short) ATOMIC_COMPARE_AND_EXCHANGE(4,uint32_t) +ATOMIC_COMPARE_AND_EXCHANGE(8,uint64_t) #ifndef __ARM_EABI__ @@ -192,6 +194,12 @@ SYNC_FETCH_AND_OP(xor,^,4,int) SYNC_FETCH_AND_OP(and,&,4,int) +SYNC_FETCH_AND_OP(add,+,8,long long) +SYNC_FETCH_AND_OP(sub,-,8,long long) +SYNC_FETCH_AND_OP(or,|,8,long long) +SYNC_FETCH_AND_OP(xor,^,8,long long) +SYNC_FETCH_AND_OP(and,&,8,long long) + #endif /* These built-in functions perform the operation suggested by the name, @@ -233,6 +241,12 @@ SYNC_OP_AND_FETCH(xor,^,4,int) SYNC_OP_AND_FETCH(and,&,4,int) +SYNC_OP_AND_FETCH(add,+,8,long long) +SYNC_OP_AND_FETCH(sub,-,8,long long) +SYNC_OP_AND_FETCH(or,|,8,long long) +SYNC_OP_AND_FETCH(xor,^,8,long long) +SYNC_OP_AND_FETCH(and,&,8,long long) + /* These built-in functions perform an atomic compare and swap. That is, * if the current value of *ptr is oldval, then write newval into *ptr. * The “bool” version returns true if the comparison is successful and @@ -264,6 +278,7 @@ SYNC_BOOL_COMPARE_SWAP(1,char) SYNC_BOOL_COMPARE_SWAP(2,short) SYNC_BOOL_COMPARE_SWAP(4,int) +SYNC_BOOL_COMPARE_SWAP(8,long long) #define SYNC_VAL_COMPARE_SWAP(size, type) \ type \ @@ -287,6 +302,7 @@ SYNC_VAL_COMPARE_SWAP(1,char) SYNC_VAL_COMPARE_SWAP(2,short) SYNC_VAL_COMPARE_SWAP(4,int) +SYNC_VAL_COMPARE_SWAP(8,long long) /* This built-in function implements an atomic load operation. * It returns the contents of *ptr.
_______________________________________________ GCCSDK mailing list gcc@gccsdk.riscos.info Bugzilla: http://www.riscos.info/bugzilla/index.cgi List Info: http://www.riscos.info/mailman/listinfo/gcc Main Page: http://www.riscos.info/index.php/GCCSDK