From patchwork Thu Apr 27 16:22:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick O'Neill X-Patchwork-Id: 88314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp390287vqo; Thu, 27 Apr 2023 09:29:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6vR0BcSv9qvlN55UHasbfUgMmGUloi3eNe3Q1avRfIOaJ3CYMpNo/++pZS7DFWNGWlP4nY X-Received: by 2002:a17:906:99c5:b0:94e:9a73:1637 with SMTP id s5-20020a17090699c500b0094e9a731637mr2160002ejn.75.1682612945324; Thu, 27 Apr 2023 09:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682612945; cv=none; d=google.com; s=arc-20160816; b=qzipv5aBPLPB/x5poGOt5RFfxxsEo40dD1T/yQSxyyKeYdlLOyfjV4aaegDNKjzL1N Y6Md0c+fmWO3+Y8tmhDwAe7u6pS5XI4pezczwCBMHK2Wcri/kTNRLii52TnLN1DKOCpt Cpex9+jZdval9iEIQmRaEgLBYHJzaHIpUeCs4NIgemDcQYsaVu6644JFGv9J97hlLlUy lX4IwoO2mlu6HBS251yR+vJAGkf9u+sGfUL9i5AeAGZWlh2/YCzq/wUvsOkDDji1QW12 hJsjctyH7fZbxIlMqsPAfl3lA/d/bDz2CpmJOr0b2cBU6VXG7HLKcavO6KxENLO9veSU vLNw== 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=GpkEHnwd8AiRKPTc0a347tmJp8ty3YVj6SX6sNF0Z/Y=; b=EGCak6g30WcuMWKd+VuOack9upwJ51ZOgAFfIvZJPsYecmk34yC4BD3oz1qkunVLIu AZu+bCS/T5V5qp2me/61di2j0odtDB84JGFnSt75mFDpz7FmrPBm0XdjYDS7pHaGEkdu rmmR8G1EUFa2T5/Jh2Mk8qfTF6Up7MMjbg0Wr45rY0OYFXcgqyo8jR6B+JhE/hqBzPPL 5kaBH2Bqv+2riur1FB2iQNBfWIHainb9oGIEloW/FpjsDU6RZ4mAVViIlBYBkrRmzWrD Y6naaPRrxW4wx/C27C9plJzVWWWQVAoy++nU0lMOnXsV6XXfYKFmMBRTSNiXXeM2Txov Hzhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=p3gTODaG; 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 e8-20020a170906080800b0094f73dc4c68si13233929ejd.47.2023.04.27.09.29.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 09:29:05 -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=p3gTODaG; 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 E1227385AC39 for ; Thu, 27 Apr 2023 16:25:21 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by sourceware.org (Postfix) with ESMTPS id A69C73856DE6 for ; Thu, 27 Apr 2023 16:24:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A69C73856DE6 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-x643.google.com with SMTP id d9443c01a7336-1a66e7a52d3so65928435ad.0 for ; Thu, 27 Apr 2023 09:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1682612651; x=1685204651; 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=GpkEHnwd8AiRKPTc0a347tmJp8ty3YVj6SX6sNF0Z/Y=; b=p3gTODaGHqRH89Tv4hTJ9qTNfr6KlBBUqSFT3reoSD+hcBR4SV2nFcdtPnQ/i/ZS2Q fZNmrN7dEBm7c/TYILPF01Qq2g/i0Ic/xYvFifSdFOuO6YyA01lZmAiTec3ONyHJvR6x 0S+T1Uug6Oy6lGMeocTquOEnd5aml5+vqrjlxCPkttRiWvJwhV6k/d/G8dNHhQGEbn2P +fJkXTXIMtFAB6ByuAWm6ZKQn3qb/OeEOHUoAyBWRheAYQDvJ9zgyKm6DXO+HFOAd2PC rIrtTjTg2z3K2v1Ll1MyfC+cHIz+RmBq3wlNvnXEzWpwNmVEVBr07uoB6ajBJNHR3PK0 QG/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682612651; x=1685204651; 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=GpkEHnwd8AiRKPTc0a347tmJp8ty3YVj6SX6sNF0Z/Y=; b=cLgqCw4L+z+shk1CJxQ4uozeHP4BekmN4nv7o7b4zPuKiviJN0u3fnFGKgI/T5Ln4a jnNGH3nSTbXVtwg89TPYIeEsyK7HYzlbqT61NnxSbKHdCKwlXBsTxrHZ3xpGW3IWGOOb O40oH9An0wvx3NNoPkgQiwfXhxCF3f8dCp1NCFG0QYtf5aNKrgP9DNG2MYGT4lktXa8e VmHKioEU5txNPuICze6Qx9LZb7Th+m5vpU5iFFntxhABBFiDry3C+2+qeo+woOTMtzRo cNMYA9rr9hIfwXZ6pdFj5M+W5t3M/dScXT3MKmwr8w/b5mM8KdjhOycpxz4O177ZNDxL aSkw== X-Gm-Message-State: AC+VfDzTZWhiXosWpMqKxvhVVSzsIwfZHFnSAYc+qUECH2yWIsMmx4Pc oXgIDG8MQNpFGlz7cn91dDSzNd0m2unr/N+K4ChzXEzZZfg= X-Received: by 2002:a17:902:f684:b0:1a9:20d6:3c3f with SMTP id l4-20020a170902f68400b001a920d63c3fmr2296006plg.55.1682612651496; Thu, 27 Apr 2023 09:24:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 09:24:11 -0700 (PDT) From: Patrick O'Neill 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 Subject: [PATCH v5 02/11] RISC-V: Enforce Libatomic LR/SC SEQ_CST Date: Thu, 27 Apr 2023 09:22:52 -0700 Message-Id: <20230427162301.1151333-3-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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764347551646325784?= X-GMAIL-MSGID: =?utf-8?q?1764347551646325784?= Replace LR.aq/SC.rl pairs with the SEQ_CST LR.aqrl/SC.rl pairs recommended by table A.6 of the ISA manual. 2023-04-27 Patrick O'Neill libgcc/ChangeLog: * config/riscv/atomic.c: Change LR.aq/SC.rl pairs into sequentially consistent LR.aqrl/SC.rl pairs. Signed-off-by: Patrick O'Neill --- libgcc/config/riscv/atomic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgcc/config/riscv/atomic.c b/libgcc/config/riscv/atomic.c index 573d163ea04..bd2b033132b 100644 --- a/libgcc/config/riscv/atomic.c +++ b/libgcc/config/riscv/atomic.c @@ -41,7 +41,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see unsigned old, tmp1, tmp2; \ \ asm volatile ("1:\n\t" \ - "lr.w.aq %[old], %[mem]\n\t" \ + "lr.w.aqrl %[old], %[mem]\n\t" \ #insn " %[tmp1], %[old], %[value]\n\t" \ invert \ "and %[tmp1], %[tmp1], %[mask]\n\t" \ @@ -75,7 +75,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see unsigned old, tmp1; \ \ asm volatile ("1:\n\t" \ - "lr.w.aq %[old], %[mem]\n\t" \ + "lr.w.aqrl %[old], %[mem]\n\t" \ "and %[tmp1], %[old], %[mask]\n\t" \ "bne %[tmp1], %[o], 1f\n\t" \ "and %[tmp1], %[old], %[not_mask]\n\t" \