From: chenglulu <chenglulu@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, gcc-patches@gcc.gnu.org
Cc: i@xen0n.name, xuchenghua@loongson.cn
Subject: Re: [PATCH] LoongArch: Use finer-grained DBAR hints
Date: Tue, 14 Nov 2023 10:26:22 +0800 [thread overview]
Message-ID: <01e49973-227f-f7aa-f1f9-25c4392dfb78@loongson.cn> (raw)
In-Reply-To: <20231113231837.369907-1-xry111@xry111.site>
[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]
在 2023/11/14 上午7:18, Xi Ruoyao 写道:
/* snip */
> (define_insn "mem_thread_fence_1"
> [(set (match_operand:BLK 0 "" "")
> (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))
> (match_operand:SI 1 "const_int_operand" "")] ;; model
> ""
> - "dbar\t0")
> + {
> + enum memmodel model = memmodel_base (INTVAL (operands[1]));
> +
> + switch (model)
> + {
> + case MEMMODEL_ACQUIRE:
> + case MEMMODEL_CONSUME:
Hi,
* Before calling this template, the function get_memmodel is called to
process memmodel, which has a piece of code:
*
/* Workaround for Bugzilla 59448. GCC doesn't track consume
properly, so be conservative and promote consume to acquire. */ if
(val == MEMMODEL_CONSUME) val = MEMMODEL_ACQUIRE;
*
* So I think MEMMODEL_CONSUME don't need to be processed here either.
Otherwise is OK.
* Thanks.
> + /* Consume is implemented using the stronger acquire memory order
> + because of a deficiency in C++11's semantics. */
> + return "dbar\t0b10100";
> + case MEMMODEL_RELEASE:
> + return "dbar\t0b10010";
> + case MEMMODEL_ACQ_REL:
> + case MEMMODEL_SEQ_CST:
> + return "dbar\t0b10000";
> + default:
> + /* GCC internal: "For the '__ATOMIC_RELAXED' model no instructions
> + need to be issued and this expansion is not invoked."
> + Other values should not be returned by memmodel_base. */
> + gcc_unreachable ();
> + }
> + })
>
> ;; Atomic memory operations.
>
next prev parent reply other threads:[~2023-11-14 2:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 23:18 Xi Ruoyao
2023-11-14 2:26 ` chenglulu [this message]
2023-11-14 8:34 ` Pushed: [PATCH v2] " Xi Ruoyao
2023-11-14 8:48 ` chenglulu
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=01e49973-227f-f7aa-f1f9-25c4392dfb78@loongson.cn \
--to=chenglulu@loongson.cn \
--cc=gcc-patches@gcc.gnu.org \
--cc=i@xen0n.name \
--cc=xry111@xry111.site \
--cc=xuchenghua@loongson.cn \
/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).