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: Joseph Myers <joseph at codesourcery dot com>
- To: Palmer Dabbelt <palmer at dabbelt dot com>
- Cc: <libc-alpha at sourceware dot org>, <patches at groups dot riscv dot org>
- Date: Mon, 1 Jan 2018 17:11:54 +0000
- 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>
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?
> +#define atomic_full_barrier() __sync_synchronize()
Missing space before '(' in call to __sync_synchronize.
> +# 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.
--
Joseph S. Myers
joseph@codesourcery.com