Message ID | 20230410182348.2168356-4-patrick@rivosinc.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2076935vqo; Mon, 10 Apr 2023 11:30:52 -0700 (PDT) X-Google-Smtp-Source: AKy350afQCCdxeuXz8jnOrOqZu7bec03wJi041emmtl3VcF67XUbMjG8dQjdBYheU2LuFkRmTiCh X-Received: by 2002:a05:6402:524e:b0:500:2a9d:1870 with SMTP id t14-20020a056402524e00b005002a9d1870mr14937686edd.13.1681151451987; Mon, 10 Apr 2023 11:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681151451; cv=none; d=google.com; s=arc-20160816; b=ThfE6Y4ajU4mHAS+62yFKVr99g3V0kwP+Tco2R23ekVnBi/UD5bKqK+Y4hGwsj3O5Z yDJ9QudzPfLnk0KEGvYQBVzGk2LCtwhxhDdOU8EPwAEwynSNLN9cg8wn4zeTDNti9KiE nMufvf4g/TWKZ/67orcUrc109+RIO8lAkG4Ol4c/+Zql56dwXhiKKne7KWM5DP09CYni H8/btPVhd8a7gBLqGO/JDjReaaEwO84iSsRN4500wNPzwPvCtap/3q2dSZFiEsBl2R5j 1xo1oPj6TjnBqmdlKU3AYPEfc25ikX05x7RpfzidwmkKeHEv6/AZJhGAGHVf0842zmA/ JsBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=CSSVRusvRjGNWa3aTcqDC/2XDQQ2EwZJbnhNXOwlq9I=; b=FfOL+p+1VG1iu3DRgDPhnc4YOaKd8rvSiZq1SwSu41KUajWrJamPtWfVb8oso/7AaM cxVnJThAfMcnZsNOSMR2qJOAMMpTO7WIX62z2HFvvfcsvJMh0Pcxm3c4QoEU/6vBoBO/ xa4fnAO46gA3D/BgTVM4TwuIsp3VRUZX8+I+xR6N8nJlmt4231iE0oxC4oSb1oux9cRI R2SOEt8DJL1DBL7ltHN63thGIQ5HgDdHjgxsm1O+1lveNfgqEp4k6a1zTpAeAyw5OYly hrTXdQpOWW3iSx1WJYd+CXLf/1oF978UW/q/pA2M3ueg6xYSQ6+lzT8n/jcQUcn69bya YdvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b="ramEyY/3"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i11-20020aa7dd0b000000b004fe96b95bbbsi9148280edv.570.2023.04.10.11.30.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 11:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b="ramEyY/3"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 330F1388216F for <ouuuleilei@gmail.com>; Mon, 10 Apr 2023 18:28:24 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by sourceware.org (Postfix) with ESMTPS id A14343858438 for <gcc-patches@gcc.gnu.org>; Mon, 10 Apr 2023 18:26:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A14343858438 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pg1-x544.google.com with SMTP id 41be03b00d2f7-5144a9c11c7so558661a12.2 for <gcc-patches@gcc.gnu.org>; Mon, 10 Apr 2023 11:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1681151213; x=1683743213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CSSVRusvRjGNWa3aTcqDC/2XDQQ2EwZJbnhNXOwlq9I=; b=ramEyY/3hDRrfxsqh1dgEJwSX0WL1orQMsnW0270c/FcPVPDCQOlWYajKbd8+SpHy0 ZRDichZdU75hpMKoaVEn/wT8j/C25+1Q6rgqIVDVcZDvuIpK7ICkKgAZuQ58/49PPvYO 90T1Hpy1wUQVQUoB9IWRJ9TvsorHJ/Jlc2DKQRBLe6mMWk1lwpFIeFXVu8vRSNeorUMC Xy1JEBkIWZAvHG//iBWRdITBm0b7etS1eerzROc95qwIgyN1ztKti5t6j8+61HtTaMV7 OBgkNcoJqbkABdRUB/Dm4MMrUta4UaDf69SJk66CCaQ2BL0uhEMvX+W1pZOkD6fUTlRV 79QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681151213; x=1683743213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CSSVRusvRjGNWa3aTcqDC/2XDQQ2EwZJbnhNXOwlq9I=; b=e+PJXE/QfqFIEb25Fxz/UinUSZl832GVxluTJWOfDfiD8iKc+sbidaLaBOiWueJSuX IweuEO2RHGr2k7JmuRR/oZativW4+Fh3qiPVlSoKmG/HU8HyabGyqpudoC3LqTefqqOk agEvBk6KEoqtur8EpJ9ux53HWkN6AvwzjFQZYYAkkMaNqo1igEOtciW8IagzBJ5Di3vw nM8WtZMEhsnAX8c8upetcpXTkXb/l6Yd7j+6CoGOEoO54BxVr0cDhQ0rX2khszZUEX5J k86iA8gW4X1hyQoOogdXs8yU7Ny6uekyWBk1Npzz6+Oxwz8LHpFPaKqaeWTx2YFczXP8 xIJw== X-Gm-Message-State: AAQBX9egpMRjfHX9B8zsAvHx1pl6YLuN1WfjDkcvzySkSVNTPI9FA4Vg 9+0Myg4uCTnfpYWa9D8HBQEwPArSXGRqKZIqxUPB1VNfQPQ= X-Received: by 2002:a62:1a8d:0:b0:636:f899:46a0 with SMTP id a135-20020a621a8d000000b00636f89946a0mr4724685pfa.15.1681151213555; Mon, 10 Apr 2023 11:26:53 -0700 (PDT) Received: from patrick-ThinkPad-X1-Carbon-Gen-8.hq.rivosinc.com ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id d2-20020aa78e42000000b00627f054a3cdsm4478977pfr.31.2023.04.10.11.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 11:26:53 -0700 (PDT) From: Patrick O'Neill <patrick@rivosinc.com> To: gcc-patches@gcc.gnu.org Cc: palmer@rivosinc.com, gnu-toolchain@rivosinc.com, vineetg@rivosinc.com, andrew@sifive.com, kito.cheng@sifive.com, dlustig@nvidia.com, jefferyalaw@gmail.com, cmuellner@gcc.gnu.org, andrea@rivosinc.com, hboehm@google.com, Patrick O'Neill <patrick@rivosinc.com> Subject: [PATCH v3 03/10] RISCV: Enforce atomic compare_exchange SEQ_CST Date: Mon, 10 Apr 2023 11:23:41 -0700 Message-Id: <20230410182348.2168356-4-patrick@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230410182348.2168356-1-patrick@rivosinc.com> References: <20230405210118.1969283-1-patrick@rivosinc.com> <20230410182348.2168356-1-patrick@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762372088044742713?= X-GMAIL-MSGID: =?utf-8?q?1762815065087085226?= |
Series |
RISCV: Implement ISA Manual Table A.6 Mappings
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Patrick O'Neill
April 10, 2023, 6:23 p.m. UTC
This patch enforces SEQ_CST for atomic compare_exchange ops.
Replace Fence/LR.aq/SC.aq pairs with SEQ_CST LR.aqrl/SC.rl pairs
recommended by table A.6 of the ISA manual.
2023-04-10 Patrick O'Neill <patrick@rivosinc.com>
* sync.md: Change FENCE/LR.aq/SC.aq into sequentially
consistent LR.aqrl/SC.rl pair.
Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
---
gcc/config/riscv/sync.md | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md index c932ef87b9d..de42245981b 100644 --- a/gcc/config/riscv/sync.md +++ b/gcc/config/riscv/sync.md @@ -115,9 +115,16 @@ UNSPEC_COMPARE_AND_SWAP)) (clobber (match_scratch:GPR 6 "=&r"))] "TARGET_ATOMIC" - "%F5 1: lr.<amo>%A5 %0,%1; bne %0,%z2,1f; sc.<amo>%A4 %6,%z3,%1; bnez %6,1b; 1:" + { + return "1:\;" + "lr.<amo>.aqrl\t%0,%1\;" + "bne\t%0,%z2,1f\;" + "sc.<amo>.rl\t%6,%z3,%1\;" + "bnez\t%6,1b\;" + "1:"; + } [(set_attr "type" "atomic") - (set (attr "length") (const_int 20))]) + (set (attr "length") (const_int 16))]) (define_expand "atomic_compare_and_swap<mode>" [(match_operand:SI 0 "register_operand" "") ;; bool output