Message ID | 20230427162301.1151333-5-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 b10csp389002vqo; Thu, 27 Apr 2023 09:26:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6U6XENlrIsRDQWZ6PNgZhVPT6YeFS/HukTvWWOUlphhFoky6AcStpU07hh2jy/D/UDoiLi X-Received: by 2002:a50:fc08:0:b0:506:87fd:7c77 with SMTP id i8-20020a50fc08000000b0050687fd7c77mr2323226edr.8.1682612794412; Thu, 27 Apr 2023 09:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682612794; cv=none; d=google.com; s=arc-20160816; b=uKj71ap3UJArtexwQSL3oLRW6MCo9hH3r9HBEoVgaJr71nXEg+gzeHOMlUqysq3DhU kV1RyxSDrUEGifG09X+JxSDpaaK2n4/UQTGQ2NVd9gemWnB3HgEPeIWV5VFImwZJYAGl BDL5L905zUY0ISvFJZpfQ6NLIaKQzFXtftFAICSMktQ3sMc7pbWfhwFXtueU42znsB9Z +TlldQxoUOERqguwKai1b4Diy/YeL96VYnXcTjDBzDtrdnu+/RwKO7t7IzHdZcYjQnFn 9oT7etVl9l2z0Aj+ZWAF1yxNrU12huxPsC1Nc9JRLWSEybu6iZ15dcT+Y1pbKjfD7n+4 q/PQ== 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=3WX4PyACZXCjj/SabLqf6nUx4PsGAAJsQWdBIB/iEwA=; b=p3Mfewym17HLRXxr7trq/B/lCTAXnqU5jxC+nq2ycp0Si3LX1QQde98L/pxgGluBrM pC7oIYOGNBDJpCvkL1rVmVatBh0QZEbb5B6mTUn/zDCt/mRFQxZFc5HlF5pqaUHyf86q 0DB0GkhRpNlT7H6120xsCKNAfcF7qUqmYuumufopTDMjVL/TvELfLJGurHgtGU+hr23C 4Xzgq6vygDTL1vf8TQ5L0NqjLzxWONhw2V1qdb13kKjiWFIg9SHt3cfrYfiDcasdP1uo 8tGonNJpA785VKplYmFM0vgeT+E6R3y003GR66kpI8ualERIa94y15pBIJq+Uhb3LMcz 1tZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=dgK17+NT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g3-20020a056402180300b00506a23a8032si14945185edy.488.2023.04.27.09.26.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 09:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=dgK17+NT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 E08163881D3B for <ouuuleilei@gmail.com>; Thu, 27 Apr 2023 16:24:45 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by sourceware.org (Postfix) with ESMTPS id 63F023857835 for <gcc-patches@gcc.gnu.org>; Thu, 27 Apr 2023 16:24:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63F023857835 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-pl1-x644.google.com with SMTP id d9443c01a7336-1a6670671e3so72003115ad.0 for <gcc-patches@gcc.gnu.org>; Thu, 27 Apr 2023 09:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1682612654; x=1685204654; 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=3WX4PyACZXCjj/SabLqf6nUx4PsGAAJsQWdBIB/iEwA=; b=dgK17+NT1pEp8YnQLg2wdUzhefVRKzfcVjDEoZTXIfibdxo94wBc1GghYdzYaQShJ1 v/hF3ip3PM3/LIADOqhSpkP1AZfIFcGn/YYrlCWj5vZMkOm7yIUWgpVxECCcDbO3++rQ SXkNIyn7lCeButOeyCWByI0AwDJeD0l1qrhqTL2qV69U92xe4WMfiXoVSUHNnyDuFgG2 zELCcsGF1yesHVpncGIIfFlmjiM3KZDjz2e0aAwiXksH6KAUPgQuaQQitDPapH7lwT+b MqLrjwun2WsX5NtLECYCQ1i0wYqzo4fBgmZWjST7/HA9qrSxbQL3unaJlXxWqZCnr6/x +0qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682612654; x=1685204654; 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=3WX4PyACZXCjj/SabLqf6nUx4PsGAAJsQWdBIB/iEwA=; b=lJz6vlHbnj3zmsm2OVHTxILnSD7w6kIFL1roWyXIAjEA7bO9heL9bsfcYiH1VQRok8 N5wmFzStuwN2QZN93qF5rhlXwrs6bHhylWNTxYn+Hg3YPzjso2eywyc1Tz72yfFN5Tym iPppSeQnG2Uv9lxAYe3CwP5953F6XoVM7Z+B32DQBsmxcylNkJdlOlyGZ/jy5+BaL9UE COwJomG/eVfbH23UoQNwfdZ6B38VW1mzvIgUTa0AESsOaCn0nLKyNDDI9c76gJ98Aqtt KdsHgquc5SQCeVn5WTs3ET1ujJJRp984ZGGnQU2lkogXWCEmkVvEy0wRdnBnSBvRSQ8H 66rA== X-Gm-Message-State: AC+VfDwBmRLDJbiG4wcy0+df+8JKqLuJHeAy7zlULfLXU3fWPc4STcix f91r0QBbdtioUBB19CUaa+kSUHcvrTHIMNoeT60w3JDeOyU= X-Received: by 2002:a17:902:e74c:b0:1a4:f295:32fa with SMTP id p12-20020a170902e74c00b001a4f29532famr2551831plf.15.1682612654316; Thu, 27 Apr 2023 09:24:14 -0700 (PDT) Received: from patrick-ThinkPad-X1-Carbon-Gen-8.hq.rivosinc.com ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id n19-20020a170902969300b001a6db2bef16sm11815906plp.303.2023.04.27.09.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 09:24:13 -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, cmuellner@gcc.gnu.org, andrea@rivosinc.com, hboehm@google.com, jeffreyalaw@gmail.com, Patrick O'Neill <patrick@rivosinc.com> Subject: [PATCH v5 04/11] RISC-V: Enforce atomic compare_exchange SEQ_CST Date: Thu, 27 Apr 2023 09:22:54 -0700 Message-Id: <20230427162301.1151333-5-patrick@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230427162301.1151333-1-patrick@rivosinc.com> References: <20230414170942.1695672-1-patrick@rivosinc.com> <20230427162301.1151333-1-patrick@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.5 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, T_SCC_BODY_TEXT_LINE 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?1764347393674991321?= X-GMAIL-MSGID: =?utf-8?q?1764347393674991321?= |
Series |
RISC-V: 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 27, 2023, 4:22 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-27 Patrick O'Neill <patrick@rivosinc.com>
gcc/ChangeLog:
* config/riscv/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(-)
Comments
On 4/27/23 10:22, Patrick O'Neill wrote: > 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-27 Patrick O'Neill <patrick@rivosinc.com> > > gcc/ChangeLog: > > * config/riscv/sync.md: Change FENCE/LR.aq/SC.aq into > sequentially consistent LR.aqrl/SC.rl pair. OK. Note that generally you should note which pattern you're changing in a ChangeLog entry, similar to how we note the function being changed. So something like this might be better: * config/riscv/sync.md (atomic_cas_value_strong<mode>): ... Jeff
On 4/28/23 10:23, Jeff Law wrote: > > > On 4/27/23 10:22, Patrick O'Neill wrote: >> 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-27 Patrick O'Neill <patrick@rivosinc.com> >> >> gcc/ChangeLog: >> >> * config/riscv/sync.md: Change FENCE/LR.aq/SC.aq into >> sequentially consistent LR.aqrl/SC.rl pair. > OK. Note that generally you should note which pattern you're changing > in a ChangeLog entry, similar to how we note the function being > changed. So something like this might be better: > > * config/riscv/sync.md (atomic_cas_value_strong<mode>): ... > > Jeff Edited ChangeLog and committed: gcc/ChangeLog: * config/riscv/sync.md (atomic_cas_value_strong<mode>): Change FENCE/LR.aq/SC.aq into sequentially consistent LR.aqrl/SC.rl pair. Patrick
diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md index 0c83ef04607..5620d6ffa58 100644 --- a/gcc/config/riscv/sync.md +++ b/gcc/config/riscv/sync.md @@ -297,9 +297,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