This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 14/19] RISC-V: Atomic and Locking Routines


On 01/01/2018 12:11 PM, Joseph Myers wrote:
> On Tue, 26 Dec 2017, Palmer Dabbelt wrote:
> 
>> diff --git a/sysdeps/unix/sysv/linux/riscv/atomic-machine.h b/sysdeps/unix/sysv/linux/riscv/atomic-machine.h
> 
>> +#include <inttypes.h>
> 
> Do you really need inttypes.h here, or just stdint.h?
> 

This doesn't need inttypes.h, stdint.h should be sufficient.  I'll fix it.

>> +#define atomic_full_barrier() __sync_synchronize()
> 
> Missing space before '(' in call to __sync_synchronize.
> 

Thank, I'll fix this and the other formatting issues noted.

>> +# define asm_amo(which, ordering, mem, value) ({ 		\
>> +  __atomic_check_size(mem);					\
>> +  typeof(*mem) __tmp; 						\
>> +  if (sizeof(__tmp) == 4)					\
>> +    asm volatile (which ".w" ordering "\t%0, %z2, %1"		\
>> +		  : "=r"(__tmp), "+A"(*(mem))			\
>> +		  : "rJ"(value));				\
>> +  else if (sizeof(__tmp) == 8)					\
>> +    asm volatile (which ".d" ordering "\t%0, %z2, %1"		\
>> +		  : "=r"(__tmp), "+A"(*(mem))			\
>> +		  : "rJ"(value));				\
>> +  else								\
>> +    abort();							\
>> +  __tmp; })
> 
> Lots of missing spaces before '(' there, after __atomic_check_size, 
> typeof, sizeof, abort, strings in asms.
> 
>> +# define atomic_max(mem, value) asm_amo("amomaxu", ".aq", mem, value)
>> +# define atomic_min(mem, value) asm_amo("amominu", ".aq", mem, value)
> 
> Missing spaces in calls to asm_amo.
> 
>> +# define atomic_bit_test_set(mem, bit)                   \
>> +  ({ typeof(*mem) __mask = (typeof(*mem))1 << (bit);    \
>> +     asm_amo("amoor", ".aq", mem, __mask) & __mask; })
>> +
>> +# define catomic_exchange_and_add(mem, value)		\
>> +  atomic_exchange_and_add(mem, value)
>> +# define catomic_max(mem, value) atomic_max(mem, value)
> 
> More missing spaces in calls to typeof, asm_amo, atomic_exchange_and_add, 
> atomic_max.
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]