Message ID | 20230414170942.1695672-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 b10csp536370vqo; Fri, 14 Apr 2023 10:13:52 -0700 (PDT) X-Google-Smtp-Source: AKy350auhx/HtgCzLnkXnWrdvfoC1dYe47JFvmOeZUjpXydmigbCHJFqBHdzMJ0f1aBFAzVJ2ESj X-Received: by 2002:a17:906:a185:b0:94d:cebe:691 with SMTP id s5-20020a170906a18500b0094dcebe0691mr6760954ejy.69.1681492432489; Fri, 14 Apr 2023 10:13:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681492432; cv=none; d=google.com; s=arc-20160816; b=kJUe6+XsFj7eCZxXUiFu3rWSgnzWWWKFyIm0DST0Ch5ODPEzJjXEKhgs0Ewatp7mwH k7BrZgJh5WE1qWUADmtW2yIcfReV7c0FI/i/RtwCl7gntsm7TLgN35Fq0jCEd14VZQ3h adgtGJ2NYqIZ+tjRbD9KP67ajWnPIsU6PQg6gfN0BBajOb6vlen2Na7tMzNE1QaZIfVZ n2Jzno6bf1zOiIuvwI37SqIrZpFb97pUImGxYlHpNgAscGwrX/DWynoTt793Q9NEGgc/ YPm+d8HMZPrNGj4Q0j8hBSR6aRE3MnbyFNyIv0bah/4KSkrxTlM6ZR8zG/eOMHAqGLEb 5HsA== 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=3/vkZhQ8PDYCEjjETm6ZrVYW+wtecAJ3RegcZLRRolU=; b=PegIxsrk4bxvGD0H6k+BweXBDEXb1jy8JPF4ko5Wdk6LyP9u3UTM3W+DVgYKeL8K1J Vc6VuwHiaO+34EQQqH2gu821an7Qv3uMPYhlxfNXu+cqzSPW4bLIsUoOTzM0fmpw7qpi P7ABOEbmIVl2IDY+0A/o3+LiQFcukai+I5vpffDj/hBHhKDugq6Sh90q/tVOGriqU9Ux PdIlkPaeX94HebUt29FKdcM5rvb74wwTBF+kCTkMBa8tkrKBIQW+tNvHJZxFR8AkbjNe 9uOF7qyr9d83aTBkLTtQmsXVvPIONnBEpYUw1vj/4ZlZIh+cG9qG/YMwIs/gULF7uwgm q43g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=mTBxqUvf; 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 k2-20020a056402048200b005021f0d5758si4933802edv.671.2023.04.14.10.13.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 10:13:52 -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.20221208.gappssmtp.com header.s=20221208 header.b=mTBxqUvf; 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 EE213388201D for <ouuuleilei@gmail.com>; Fri, 14 Apr 2023 17:11:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by sourceware.org (Postfix) with ESMTPS id A25973858409 for <gcc-patches@gcc.gnu.org>; Fri, 14 Apr 2023 17:10:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A25973858409 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-x642.google.com with SMTP id kh6so17353608plb.0 for <gcc-patches@gcc.gnu.org>; Fri, 14 Apr 2023 10:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1681492243; x=1684084243; 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=3/vkZhQ8PDYCEjjETm6ZrVYW+wtecAJ3RegcZLRRolU=; b=mTBxqUvfUP8KwQb19uMUml+/Ss+2wJHzTatnZSsxQalWi4xANkQZwkeIit1rYTSJjY DIOTOwhD4/WigcyOBxybXO+JHkzfV9DWi7EJihn7DgiN43m9ZEJU5Y2kRzEnZQ5z9QHL juZrU2ztMfc4ZmCWPFZ6p7sNJUbe3mL3H9i/rIK28zYo0SQ0deuOkKXKhOacgANzdhkq yXCOPmNJQ1d41j52f3dfMMR6VKt3m25za6Ii3x1WiXiHwStf0R4TExiilwSSJENjWEoU M8oiomVUsNTPQG8CRGfNZxZ9/tVV0munXQmTQXp10IJVD2hXUFVNLAfFCA/xwmT1kvJe Ei4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681492243; x=1684084243; 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=3/vkZhQ8PDYCEjjETm6ZrVYW+wtecAJ3RegcZLRRolU=; b=RHpapwshK3tsqM8RE1KFiilGGMwElB/6mejlKlqFWLyndepJ7cuQaRKjYR+oqiJpmu w/559L949MLxwf1N72e7pe1LqoMG3bF98V8+/IZcgWJdqf8eoRpqCPRUgZCxqMVoYUK5 ewkHNS38kjpAqdXf2upiv5/q7X+8FSIz5ycciS7m0IkvGMxb+wJsB7yxBp6HDj+yzF88 MtWaCNi+emyDVWtFSbWHD246sRyHT/fFRUayHca15m8Ivx6CyK37MCb4yC1zgSm3NJUw SpLu/by9maB84AWMbc5veWs1kh5kfoTSybNLtpfKpWSE7W/qBlM3AATxMRGj3uJnHM5Z z0UQ== X-Gm-Message-State: AAQBX9cSt3vSkx08hjNNrsMu5f4uP5zcNS9GzbDPMKLxgBIMIXnTCiuI d/ogGQpY9USQS63LTQ1s29RgrpjTzWZw5azjcVsl01Es9Lc= X-Received: by 2002:a05:6a20:3c8c:b0:ec:843a:6388 with SMTP id b12-20020a056a203c8c00b000ec843a6388mr6497927pzj.26.1681492243515; Fri, 14 Apr 2023 10:10:43 -0700 (PDT) Received: from patrick-ThinkPad-X1-Carbon-Gen-8.hq.rivosinc.com ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id 12-20020aa7924c000000b006258dd63a3fsm3271902pfp.56.2023.04.14.10.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 10:10:42 -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 v4 03/10] RISCV: Enforce atomic compare_exchange SEQ_CST Date: Fri, 14 Apr 2023 10:09:35 -0700 Message-Id: <20230414170942.1695672-4-patrick@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414170942.1695672-1-patrick@rivosinc.com> References: <20230410182348.2168356-1-patrick@rivosinc.com> <20230414170942.1695672-1-patrick@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.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=ham 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?1763172609038012782?= |
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 14, 2023, 5:09 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-14 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