From patchwork Mon Apr 10 18:23:40 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: 81596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2076298vqo; Mon, 10 Apr 2023 11:29:44 -0700 (PDT) X-Google-Smtp-Source: AKy350alpb0+ykuQCup2KmhfnDCdpEzyPcmU2tC/ezenVyaSwvm8Na/2TtOnM4qLkdXnUvV3KC48 X-Received: by 2002:a05:6402:4302:b0:504:ab52:fab8 with SMTP id m2-20020a056402430200b00504ab52fab8mr2726747edc.10.1681151384703; Mon, 10 Apr 2023 11:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681151384; cv=none; d=google.com; s=arc-20160816; b=iichJJ2SsowymW8U0SKTdLgrGH81TgBD87ggQ0aEvaaCuBXjPGn07cvaNCbJitTQRf DOlmeVQbZLQwkjpNVyLp8VUN3ZD96DM13f1O6Dg0113TzhDrGvSdgUFv46wpNcFZQvjP u6N6mkCudA+qH+UgpDSKKcTMfoCzYES++ALtqthXssiwC44yjUqj8ZjxRQnsEt8V+vk7 SHw8E4k78i5riFmad9DlOOHbTIJgim/6XXI4uLya7+MC7NRVS2dD9h+Jdq13yTESgQku 5vnmJoZHo6/gAtDpETu395/nYPRazmuqjaWs2fCZaIZgqgosRo4/IIsx0qLhPy+Xi5J2 32Cw== 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=mpiz+IroUbuQUn0qqwRGeBpz9rfAJCoFpiN82cMSkOM=; b=aliD9IncpKCmqRM4MIzKHPkLBRMYAc6liIUNFrk/e+xSnKyYNfJ0S8ZAhSHgJXmCFg Bmx/m7IuFpOE4WLlyEXmhVENUJfiYoOt/SUblBi0VVfFE6t0AJPfIDk7g5ml48a7Gojk p+4dExZ3wVRKOc1Wgit6scN9qGdEVNtS9xrjB7k0kJzYS1VIr4cnHuhX26vwLFjNzK7K ttXW1dpuxDzW6TFtEbWlYR2fYSPYTWeqKb4xmmpysTEY8yB0YlPIN7TuBDTZWeGjr8zc r5Wfl5bMJ2xZeVUfugmLgQwkGdv7OfMSVpb3EO04XXovlcoSI+CYt/XDdb2VJ/4F99We NbcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=V82Redk8; 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 bi9-20020a170906a24900b0093118f34390si9585693ejb.769.2023.04.10.11.29.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 11:29:44 -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.20210112.gappssmtp.com header.s=20210112 header.b=V82Redk8; 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 CFE113875409 for ; Mon, 10 Apr 2023 18:27:53 +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 2025B3858C1F for ; Mon, 10 Apr 2023 18:26:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2025B3858C1F 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 ke16so5314368plb.6 for ; Mon, 10 Apr 2023 11:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1681151212; x=1683743212; 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=mpiz+IroUbuQUn0qqwRGeBpz9rfAJCoFpiN82cMSkOM=; b=V82Redk8Gb2ZIKXTpKZSIWz7RqaiA+PdJdAdG+7sw1b5Fs++iXV7wdokMtQL/G0d/U X1ubT2+illeKc7MWaV/In60NdVhxTMfXOQ2LqN0Z0G4gn+aJgXhSKQMhyTMnADrORjQC VGhn5D9KvRNznpEzHL0zI8xYnZ1KSJWBm6hwnY5qqA1RB8t7WQe09x6WroO/tNWVE0XN JyKpIGJGKp0h6o7KIfczjC7Ioy02xSQhxhgVmuMSIpXY6Z72ohw9wf8hOSO+Gy+NhjhZ 9mS+dgPGLzf/sBJccUF8MV/1GL8lkcffBp0DvY48AKJjTKSEcFQCrZxvlPljsekCpJrL rHGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681151212; x=1683743212; 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=mpiz+IroUbuQUn0qqwRGeBpz9rfAJCoFpiN82cMSkOM=; b=j0TjN/HsJ1DCBZKF58IDsJ4FsntStbTtLSJ2XmK7c4hLjydxJ8XoKbyculf8pPklJe 3CjC4doL+/toKnrRWDOlwRp8SMrmu/24rLapcQYfaT1vaKKFcHZddf+nKtf4wduuBaIW 6OlOr6ETBR3IOvoI1WotRrA5eAKWEXcJ1XOvsUD3O8F8MXs6m+Ts3CBZ16pShgfLgDmN OG9PsYbvLrjVkzEoljNjPXdC9LeVyUPpnhdNizHqu5w+oC6+DXqMmrzGQFUEHkZ/BKox ICfbj9SnUktdnmGhJIrZmMjcQMZ8XLYR8iCShhAYPvJcDuhj46mtZar+shTXnLheA8Ad ZvwQ== X-Gm-Message-State: AAQBX9fLbZPd9bcec5P/44yXrJLqScH4ueCTmVIf1MvIBRzvvXUVHS9P uyvRwKYkohEbnc7qFqomseIDyndYXkUT/iYBb9R2Bh22dmk= X-Received: by 2002:a05:6a20:a91f:b0:d5:9216:9182 with SMTP id cd31-20020a056a20a91f00b000d592169182mr8363476pzb.9.1681151212023; Mon, 10 Apr 2023 11:26:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 11:26:51 -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, jefferyalaw@gmail.com, cmuellner@gcc.gnu.org, andrea@rivosinc.com, hboehm@google.com, Patrick O'Neill Subject: [PATCH v3 02/10] RISCV: Enforce Libatomic LR/SC SEQ_CST Date: Mon, 10 Apr 2023 11:23:40 -0700 Message-Id: <20230410182348.2168356-3-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 X-Spam-Status: No, score=-12.2 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=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 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?1762371993405256455?= X-GMAIL-MSGID: =?utf-8?q?1762814994306252419?= 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-10 Patrick O'Neill * atomic.c: Change LR.aq/SC.rl pairs into sequentially consistent LR.aqrl/SC.rl pair. 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 69f53623509..5f895939b0b 100644 --- a/libgcc/config/riscv/atomic.c +++ b/libgcc/config/riscv/atomic.c @@ -39,7 +39,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" \ @@ -73,7 +73,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" \