From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 5D5FF3858D33; Thu, 1 Feb 2024 11:32:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D5FF3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706787131; bh=NiBG3GCMx/UMg6evcv25UywZxx8w1V3AjgxCYq9h6pk=; h=From:To:Subject:Date:From; b=bHbIn9VfpIk/G8nUlvTRPHyzxKipD6auQzL0WbLCLr/rfJpZlP3mlJvA2mlf93lBh RZLL/adhDGJCkmDDRZFLEpgZru4ba3fGOjTy8x898b3yhZ4mOOA5lPkpdBuM6Da01q /l4T2wwVwxsPDOMYtbZaq396J1IVnYUBCYfXEIJA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8685] GCN, RDNA 3: Adjust 'sync_compare_and_swap_lds_insn' X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/master X-Git-Oldrev: 75f49cf82e06971b066b4f440256004775603752 X-Git-Newrev: 6c2a40f4f4577f5d0f7bd1cfda48a5701b75744c Message-Id: <20240201113211.5D5FF3858D33@sourceware.org> Date: Thu, 1 Feb 2024 11:32:11 +0000 (GMT) List-Id: https://gcc.gnu.org/g:6c2a40f4f4577f5d0f7bd1cfda48a5701b75744c commit r14-8685-g6c2a40f4f4577f5d0f7bd1cfda48a5701b75744c Author: Thomas Schwinge Date: Wed Jan 31 10:19:00 2024 +0100 GCN, RDNA 3: Adjust 'sync_compare_and_swap_lds_insn' For OpenACC/GCN '-march=gfx1100', a lot of libgomp OpenACC test cases FAIL: /tmp/ccGfLJ8a.mkoffload.2.s:406:2: error: instruction not supported on this GPU ds_cmpst_rtn_b32 v0, v0, v4, v3 ^ In RDNA 3, 'ds_cmpst_[...]' has been replaced by 'ds_cmpstore_[...]', and the notes for 'ds_cmpst_[...]' in pre-RDNA 3 ISA manuals: Caution, the order of src and cmp are the *opposite* of the BUFFER_ATOMIC_CMPSWAP opcode. ..., have been resolved for 'ds_cmpstore_[...]' in the RDNA 3 ISA manual: In this architecture the order of src and cmp agree with the BUFFER_ATOMIC_CMPSWAP opcode. ..., and therefore '%2', '%3' now swapped with regards to GCC operand order. Most of the affected libgomp OpenACC test cases then PASS their execution test. gcc/ * config/gcn/gcn.md (sync_compare_and_swap_lds_insn) [TARGET_RDNA3]: Adjust. Diff: --- gcc/config/gcn/gcn.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md index 1f3c692b7a67..925e2cea4895 100644 --- a/gcc/config/gcn/gcn.md +++ b/gcc/config/gcn/gcn.md @@ -2074,7 +2074,12 @@ (match_operand:SIDI 3 "register_operand" " v")] UNSPECV_ATOMIC))] "" - "ds_cmpst_rtn_b %0, %1, %2, %3\;s_waitcnt\tlgkmcnt(0)" + { + if (TARGET_RDNA3) + return "ds_cmpstore_rtn_b %0, %1, %3, %2\;s_waitcnt\tlgkmcnt(0)"; + else + return "ds_cmpst_rtn_b %0, %1, %2, %3\;s_waitcnt\tlgkmcnt(0)"; + } [(set_attr "type" "ds") (set_attr "length" "12")])