From: "Xuezheng Xu" <xuezhengxu@126.com>
To: gcc@gcc.gnu.org
Subject: [RISC-V] built-in atomic function implementation involving RISC-V memory model
Date: Wed, 22 Feb 2023 10:22:59 +0800 (CST) [thread overview]
Message-ID: <6820af44.21f8.18676ee61b5.Coremail.xuezhengxu@126.com> (raw)
[-- 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
reply other threads:[~2023-02-22 2:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6820af44.21f8.18676ee61b5.Coremail.xuezhengxu@126.com \
--to=xuezhengxu@126.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).