Make code more compatible with gcc. Change __atomic_store __atomic_load __atomic_exchange __atomic_compare_exchange Also add (include/stdatomic.h, lib/stdatomic.c): atomic_thread_fence atomic_signal_fence atomic_is_lock_free And gcc extensions (tcctok.h, tccgen.c, lib/stdatomic.c): __atomic_fetch_nand __atomic_and_fetch __atomic_sub_fetch __atomic_or_fetch __atomic_xor_fetch __atomic_and_fetch __atomic_nand_fetch Add new file lib/atomic.S with assembly code for __atomic_compare_exchange_n for arm/arm64/riscv. Also update lib/Makefile. Update testcode in 124_atomic_counter and 125_atomic_misc to test new functions. Also update tests/tests2/Makefile to run tests on arm/arm64/riscv.
		
			
				
	
	
		
			59 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
[test_atomic_compare_exchange]
 | 
						|
1 99 77
 | 
						|
0 80 80
 | 
						|
85 33 80
 | 
						|
90 66 80
 | 
						|
 | 
						|
[test_atomic_store]
 | 
						|
r = 12, i = 24
 | 
						|
 | 
						|
[test_atomic_store_pointer]
 | 
						|
*p = 2
 | 
						|
 | 
						|
[test_atomic_store_struct]
 | 
						|
1 2 3 4
 | 
						|
 | 
						|
[test_atomic_op]
 | 
						|
fetch_add: SUCCESS
 | 
						|
fetch_sub: SUCCESS
 | 
						|
fetch_or: SUCCESS
 | 
						|
fetch_xor: SUCCESS
 | 
						|
fetch_and: SUCCESS
 | 
						|
 | 
						|
[test_atomic_op2]
 | 
						|
fetch_add: SUCCESS
 | 
						|
fetch_sub: SUCCESS
 | 
						|
fetch_or: SUCCESS
 | 
						|
fetch_xor: SUCCESS
 | 
						|
fetch_and: SUCCESS
 | 
						|
fetch_nand: SUCCESS
 | 
						|
add_fetch: SUCCESS
 | 
						|
sub_fetch: SUCCESS
 | 
						|
or_fetch: SUCCESS
 | 
						|
xor_fetch: SUCCESS
 | 
						|
and_fetch: SUCCESS
 | 
						|
nand_fetch: SUCCESS
 | 
						|
 | 
						|
[test_atomic_thread_signal]
 | 
						|
1
 | 
						|
 | 
						|
[test_atomic_error_1]
 | 
						|
125_atomic_misc.c:176: error: pointer expected
 | 
						|
 | 
						|
[test_atomic_error_2]
 | 
						|
125_atomic_misc.c:183: error: integral or integer-sized pointer target type expected
 | 
						|
 | 
						|
[test_atomic_error_3]
 | 
						|
125_atomic_misc.c:190: error: integral or integer-sized pointer target type expected
 | 
						|
 | 
						|
[test_atomic_error_4]
 | 
						|
125_atomic_misc.c:198: error: pointer target type mismatch in argument 2
 | 
						|
 | 
						|
[test_atomic_warn_1]
 | 
						|
125_atomic_misc.c:206: warning: assignment makes integer from pointer without a cast
 | 
						|
 | 
						|
[test_atomic_warn_2]
 | 
						|
125_atomic_misc.c:216: warning: assignment from incompatible pointer type
 | 
						|
 | 
						|
[test_atomic_warn_3]
 | 
						|
125_atomic_misc.c:224: warning: assignment of read-only location
 |