* [RISC-V] built-in atomic function implementation involving RISC-V memory model
@ 2023-02-22 2:22 Xuezheng Xu
0 siblings, 0 replies; only message in thread
From: Xuezheng Xu @ 2023-02-22 2:22 UTC (permalink / raw)
To: gcc
[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]
Hi,
As stated in the comments of riscv_print_operand (the latest version of gcc/config/riscv/riscv.cc), the RISCV-specific operand code 'A', which is used in the implementation of 'atomic_cas_value_strong' in sync.md, is the atomic operation suffix for memory model OP.
However, only '.aq' is considered in the current implementation:
case 'A':
if (riscv_memmodel_needs_amo_acquire ((enum memmodel) INTVAL (op)))
fputs (".aq", file);
break;
Currently, we cannot add '.rl' to the function like atomic_compare_exchange_weak_release in glibc.
I think we should also take '.rl' & '.aqrl' into consideration. The correct implementation in my understanding should be:
case 'A':
if (riscv_memmodel_needs_amo_acquire_release ((enum memmodel) INTVAL (op)))
fputs (".aqrl", file);
else if (riscv_memmodel_needs_amo_acquire ((enum memmodel) INTVAL (op)))
fputs (".aq", file);
else if (riscv_memmodel_needs_amo_release ((enum memmodel) INTVAL (op)))
fputs (".rl", file);
break;
Did I get it wrong? I'd appreciate it if you could explain it for me.
Thanks
Xuezheng
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-22 2:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 2:22 [RISC-V] built-in atomic function implementation involving RISC-V memory model Xuezheng Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).