Message ID | 20230414170942.1695672-9-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 b10csp538744vqo; Fri, 14 Apr 2023 10:17:26 -0700 (PDT) X-Google-Smtp-Source: AKy350ZOm6oUcE79zRbfKDA2KbuGW37YRVJkI+VNU6TVyoo+Ap+dskyhILKHq9TTsI/bPnpyJ0wH X-Received: by 2002:aa7:dbd2:0:b0:504:de28:36fc with SMTP id v18-20020aa7dbd2000000b00504de2836fcmr5800521edt.38.1681492645871; Fri, 14 Apr 2023 10:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681492645; cv=none; d=google.com; s=arc-20160816; b=zsjZfmJkmdav8UDIhaTyKrC1xRHhyh9QoXQjTJkwCW38UI1qmQld/T6eYFGkVLzSKt 5/6Wq1BZr7HSJ2gih9BPF8nRwkcQcewQOyI+vK+3AShzcWp+lYekyUi7uFzFHLbob3Op spPulN8Iso3M9NIYApuizSPDVyasM4s98IilfCe2a1Y0wWBzTAKiP6YlSsH4YE3XRFxj 2xWaWCzl9BrR7ge7NKZYSJdIKcNRvUO5S1B6Qkeku1F54muoho05BDQJi6DErH16MRzc rgaRhE+JoPl0nku67vRu106ePUplR38xI2B6WOYGxI1892cf3mlxC9ADXHl1CrC2r+rP ap1Q== 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=VQ7bZtpi2cp1uLeZu12OoYkmqoLLJkZVj1Ye9cT2adU=; b=wdZ2E6TmVI0uJQYbThGiqGuKn4G8GjIIFOdJPX4lAjoJNn1iV1UFBLmPYiqEdcpKYv 4Fw+n2oy3vP+joYsqst8fuEmp9x9kOFL0w0QFAY3smroW9PB122xtpQqj1YaJRBeHvfl rfLI+oCGljvGq//VwcAxqTbgavyBkCFJy5q9xAfdBEcleuzQkkaAGKLpmnOkzj1IwH1x Egaus46AX37PHDAqHefdShdRbTca0B06v/uR9bbFXGbPc0eVgeUqXehTR9TW1YCJ4Xes 1Agk/7vJwI/0tfDFJHUdnLq+Vm7erVGPBXuz7tFs2tT0tccDv0D9xCVDxLgfILrYbEwK ZNRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=L4V1ZdyD; 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 e24-20020a056402149800b005048d0c211asi4615533edv.605.2023.04.14.10.17.25 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 10:17:25 -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=L4V1ZdyD; 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 904C33851C35 for <ouuuleilei@gmail.com>; Fri, 14 Apr 2023 17:13:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by sourceware.org (Postfix) with ESMTPS id 4326A3857350 for <gcc-patches@gcc.gnu.org>; Fri, 14 Apr 2023 17:10:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4326A3857350 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-x542.google.com with SMTP id 41be03b00d2f7-517bb01bac9so737849a12.0 for <gcc-patches@gcc.gnu.org>; Fri, 14 Apr 2023 10:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1681492256; x=1684084256; 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=VQ7bZtpi2cp1uLeZu12OoYkmqoLLJkZVj1Ye9cT2adU=; b=L4V1ZdyD79VT8Aixtu24KMduJ3RGVRWkvQT/e368vCYOrNv8BvWM4GfJ7R1yeYel9h lFFR8BmX+Z86MtLw7hsnxJobpefDLdbzIS7AouCmcUQgjFHBO0cNJPDTxbEWBg1xw9af AFIciXwcpbYc1yseRYzafte6ff43wAiMOpXLNqaXBYrNwn1ZQ8fgYeEXnb1weSVhga0i YTmlITNRDHwShu56VsiR5HLPkpkQaK4TlMjV1fssEBg7wW0fdO4RzBqMSt0+/1CyKsWy T3qnPqXzVHIiLmy2ArzOO7Dc/UqpMkPjLVhW635mU0CnQKxmgiuZ6rkpBtKDf7hOWOLk tC+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681492256; x=1684084256; 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=VQ7bZtpi2cp1uLeZu12OoYkmqoLLJkZVj1Ye9cT2adU=; b=AbmiLoGoC0zioCE+9dqK2PMkhiPo1/6kskd9Nhg4qVv1CKp/rP/vBKJrWbGpr6HMoI IZhfGWexwkI/iTVw0EVEfOVs8WVm5lQC1oKWQkp9QYFGdCMN0h3q+n7z3LP2I09PTnqu 10T89wfXPNdp9r3DMwEuJbDjmdUIp6WD8xsqUow7Lq6MX2mWY5y1K4/rlxGNnlc4E2Nm M761mx3D06x0VgqHY8ph/wvp5Hd3/EJOY2WE1A8BA+/9QT3g5pE399zTZ1m5Pq1nUAYN LiDGAKwmmwQj7ooR6GH0FWgE2LuTIyDUSzk4yxjb5VIIMwXu4QXX/InB3mwGmzZUAFbK 2HgA== X-Gm-Message-State: AAQBX9c1Asb2IIYZ28SqBE8ABY+ZDdJJbuY5CQkoJQteVCLWQWApa2ce ylp6APVpSNGKVfPBv67wlNSKR96zNw1bk+tebRNcTDNNCY8= X-Received: by 2002:a05:6a00:1250:b0:627:e342:7f0e with SMTP id u16-20020a056a00125000b00627e3427f0emr8908457pfi.30.1681492256039; Fri, 14 Apr 2023 10:10:56 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 10:10:54 -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 08/10] RISCV: Weaken mem_thread_fence Date: Fri, 14 Apr 2023 10:09:40 -0700 Message-Id: <20230414170942.1695672-9-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=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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?1762372273929861892?= X-GMAIL-MSGID: =?utf-8?q?1763172832513001527?= |
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 change brings atomic fences in line with table A.6 of the ISA
manual.
Relax mem_thread_fence according to the memmodel given.
2023-04-14 Patrick O'Neill <patrick@rivosinc.com>
* sync.md (mem_thread_fence_1): Change fence depending on the
given memory model.
Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
---
v3 Changelog:
* Consolidate tests in [PATCH v3 10/10]
* Remove helper functions
---
gcc/config/riscv/sync.md | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md index a31b8c4f28a..e91fa29da51 100644 --- a/gcc/config/riscv/sync.md +++ b/gcc/config/riscv/sync.md @@ -42,14 +42,24 @@ DONE; }) -;; Until the RISC-V memory model (hence its mapping from C++) is finalized, -;; conservatively emit a full FENCE. (define_insn "mem_thread_fence_1" [(set (match_operand:BLK 0 "" "") (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER)) (match_operand:SI 1 "const_int_operand" "")] ;; model "" - "fence\tiorw,iorw") + { + enum memmodel model = (enum memmodel) INTVAL (operands[1]); + model = memmodel_base (model); + if (model == MEMMODEL_SEQ_CST) + return "fence\trw,rw"; + else if (model == MEMMODEL_ACQ_REL) + return "fence.tso"; + else if (model == MEMMODEL_ACQUIRE) + return "fence\tr,rw"; + else if (model == MEMMODEL_RELEASE) + return "fence\trw,w"; + } + [(set (attr "length") (const_int 4))]) ;; Atomic memory operations.