[PATCH v2 09/15] RISC-V: Atomic and Locking Routines

Joseph Myers joseph@codesourcery.com
Wed Dec 20 17:08:00 GMT 2017


On Tue, 19 Dec 2017, Palmer Dabbelt wrote:

> This patch implements various atomic and locking routines on RISC-V,
> either via the A extension (when present) or via a Linux system call
> that does a compare-and-exchange.  This contains both the library
> routines and the syscall wrapper.

You said in the introduction that the 'A' extension would be required for 
Linux.  I think you need to update the patch description - *and* the patch 
itself - to reflect that.

> diff --git a/sysdeps/riscv/rv64/rvd/s_roundeven.c b/sysdeps/riscv/rv64/rvd/s_roundeven.c

Does not belong in this patch.

> diff --git a/sysdeps/riscv/rv64/rvf/s_llrintf.c b/sysdeps/riscv/rv64/rvf/s_llrintf.c

Likewise.

> +#ifdef __riscv_atomic
> +
> +#define __HAVE_64B_ATOMICS (__riscv_xlen >= 64)
> +#define USE_ATOMIC_COMPILER_BUILTINS 1
> +#define ATOMIC_EXCHANGE_USES_CAS 0

Missing preprocessor indentation.

> +/* Miscellaneous. */
> +
> +#define asm_amo(which, ordering, mem, value) ({ 		\

Likewise, in this part of the file.

> +#else /* __riscv_atomic */

And this part of the file should now just have a #error.  (Giving an error 
for non-A at configure time would be a good idea as well, so the bad 
configuration gets detected as early as possible.)

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list