This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 14/19] RISC-V: Atomic and Locking Routines
- From: Darius Rad <darius at bluespec dot com>
- To: Joseph Myers <joseph at codesourcery dot com>, Palmer Dabbelt <palmer at dabbelt dot com>
- Cc: libc-alpha at sourceware dot org, patches at groups dot riscv dot org
- Date: Thu, 4 Jan 2018 13:51:56 -0500
- Subject: Re: [PATCH v3 14/19] RISC-V: Atomic and Locking Routines
- Authentication-results: sourceware.org; auth=none
- References: <20171227060534.3998-1-palmer@dabbelt.com> <20171227060534.3998-15-palmer@dabbelt.com> <alpine.DEB.2.20.1801011709150.2695@digraph.polyomino.org.uk>
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.
>