Re: [PATCH v2] RISCV: Add support for inlining subword atomics

2022-04-08 Thread Pan RZ

Hi Patrick,


We are more than delighted to hear that you'd like to implement inlining 
subword atomic load/store and exchange as well!



I searched for these macros in the gcc codebase, and it seems like the 
internal logic that defines ATOMIC_* builtin macros can be found at 
gcc/c-family/c-cppbuiltin.cc#L665-L796 (inside static void 
cpp_atomic_builtins), while is_always_lock_free is at 
libstdc++-v3/include/std/atomic#L99. I'm not 100% sure, though, due to 
my limited understanding of the codebase. Hope this information helps :-)



Yours sincerely,

Pan RZ (XieJiSS) @ PLCT Lab



Re: [PATCH v2] RISCV: Add support for inlining subword atomics

2022-04-07 Thread Pan RZ

Hi Patrick,

Glad to know that efforts have been made to add inlining subword atomic supports into gcc. 
The patch looks great so far, yet as Andreas Schwab has pointed out (at 
riscv-collab/riscv-gcc#337), looks like it only contains atomic fetch stuff. Just wondering 
do you have further plans to implement support for atomic store / exchange as well? Also, 
as a reminder, note that after adding store / exchange supports, some related macros like 
ATOMIC_BOOL_LOCK_FREE and ATOMIC_CHAR_LOCK_FREE's values (defined in ) may 
need to be set to true. Currently in RISC-V gcc, they are all defined as false. This may 
also need to be done for std::atomic::is_always_lock_free and 
std::atomic_is_lock_free(bool_var).

See:https://en.cppreference.com/w/cpp/atomic/atomic_is_lock_free  and
https://github.com/riscv-collab/riscv-gcc/issues/337#issuecomment-1086664815  


What's your opinion on this?

Best regards, RZ Pan (XieJiSS)