From: Andrew Stubbs <ams@baylibre.com>
To: Thomas Schwinge <tschwinge@baylibre.com>, gcc-patches@gcc.gnu.org
Subject: Re: GCN, RDNA 3: Adjust 'sync_compare_and_swap<mode>_lds_insn'
Date: Wed, 31 Jan 2024 11:31:00 +0000 [thread overview]
Message-ID: <4ebcbae0-1d49-4226-aee8-192c9c738b4b@baylibre.com> (raw)
In-Reply-To: <87plxhlrgr.fsf@euler.schwinge.ddns.net>
On 31/01/2024 10:36, Thomas Schwinge wrote:
> Hi!
>
> OK to push "GCN, RDNA 3: Adjust 'sync_compare_and_swap<mode>_lds_insn'",
> see attached?
>
> In pre-RDNA 3 ISA manuals, there are notes for 'DS_CMPST_[...]', like:
>
> Caution, the order of src and cmp are the *opposite* of the BUFFER_ATOMIC_CMPSWAP opcode.
>
> ..., and conversely in the RDNA 3 ISA manual, for 'DS_CMPSTORE_[...]':
>
> In this architecture the order of src and cmp agree with the BUFFER_ATOMIC_CMPSWAP opcode.
>
> Is my understanding correct, that this isn't something we have to worry
> about at the GCC machine description level; that's resolved at the
> assembler level?
Right, the IR uses GCC's operand order and has nothing to do with the
assembler syntax; the output template does the mapping.
> --- a/gcc/config/gcn/gcn.md
> +++ b/gcc/config/gcn/gcn.md
> @@ -2095,7 +2095,12 @@
> (match_operand:SIDI 3 "register_operand" " v")]
> UNSPECV_ATOMIC))]
> ""
> - "ds_cmpst_rtn_b<bitsize> %0, %1, %2, %3\;s_waitcnt\tlgkmcnt(0)"
> + {
> + if (TARGET_RDNA3)
> + return "ds_cmpstore_rtn_b<bitsize> %0, %1, %2, %3\;s_waitcnt\tlgkmcnt(0)";
> + else
> + return "ds_cmpst_rtn_b<bitsize> %0, %1, %2, %3\;s_waitcnt\tlgkmcnt(0)";
> + }
> [(set_attr "type" "ds")
> (set_attr "length" "12")])
I think you need to swap %2 and %3 in the new format. ds_cmpst matches
GCC operand order, but ds_cmpstore has "cmp" and "src" reversed.
Andrew
next prev parent reply other threads:[~2024-01-31 11:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 10:36 Thomas Schwinge
2024-01-31 11:31 ` Andrew Stubbs [this message]
2024-02-01 11:36 ` Thomas Schwinge
2024-02-01 11:40 ` Andrew Stubbs
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=4ebcbae0-1d49-4226-aee8-192c9c738b4b@baylibre.com \
--to=ams@baylibre.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=tschwinge@baylibre.com \
/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).