From patchwork Fri Apr 14 17:09:33 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: 83523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp534963vqo; Fri, 14 Apr 2023 10:11:56 -0700 (PDT) X-Google-Smtp-Source: AKy350YgJwtGiIwiYmvWPDIJ4TtZ2FSElyA4/p60NOKOVo+vz1v37UoNqPj4+5s3AlNB9KIeWYOR X-Received: by 2002:aa7:c399:0:b0:504:b60a:e7e8 with SMTP id k25-20020aa7c399000000b00504b60ae7e8mr6659886edq.20.1681492316244; Fri, 14 Apr 2023 10:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681492316; cv=none; d=google.com; s=arc-20160816; b=QOT3raNMiJhJ16yfgReg3DGfCjpMV96y+xb/ek3eb51BiCaFPPV9tVaqacgOSG5fE8 nEEp2BylFGMfrLXRU9GM03a13P5oFQtoc/d4EhdnUdJFP9sh3B3lifeAMEc1UHwxqFLZ +dSyYhKGYCtULVpT5MS7Vg6otK92isZ08byB8fRxzN1rrwPwu2flHivWcZ1Nv5H/gWek vE+Izv+nfWt28lbIMZM1/pCi4BRvt6b1jrIsO0UgnfpL818jpCKh0ZOCowq0KRknt99Q QYIJ5O5O999FrIrXpAOyESDzBSy16cq1tzsW2w+mSoZ8FIJuhk2/2K9AAuWA6pvRPQ8b iByw== 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=x7xn2Gtn3wHA6T6RcHJrKbMsiY34n3kVCnZVQNzuOEw=; b=g36BF+k92azR5pEWeFoItTcRzWk8wkbE5epteXhie+pMZHqt0cUCgUpvqZwdXb+U85 +yE0EMQjyC4GaV7m/CtS6xtBkqJiKUlILFvJRHYaV4TnHqZ2bYSdqnwD8HZGYcDarFCB U93LfsqtVepvxWg9zEpwoL2/etEcN9MKKRzzzhWwZr0v+UOlo2fHCoJ/e0wqOAfuOplO QqlH/jMPB3K/Nh5sDG9TSIKFrxiFcL3GCBRTysD2lwLyD+DOvfczDTTi4y6IWYVz0L4O v5MkCKBYYIJl5f5jqVVUbGzLEv3zFAPpFDrDUrSc5Y6xPV0KhScWq5VDjVQOPChxDI4U goEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=nTO9BeuL; 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 f26-20020a50ee9a000000b0050493007972si4615813edr.308.2023.04.14.10.11.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 10:11:56 -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=nTO9BeuL; 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 E3D603857719 for ; Fri, 14 Apr 2023 17:11:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 04C463858C66 for ; Fri, 14 Apr 2023 17:10:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 04C463858C66 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-pf1-x42b.google.com with SMTP id d2e1a72fcca58-63b51fd2972so420709b3a.3 for ; Fri, 14 Apr 2023 10:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1681492238; x=1684084238; 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=x7xn2Gtn3wHA6T6RcHJrKbMsiY34n3kVCnZVQNzuOEw=; b=nTO9BeuLacejANHIJgHefW0R22/yE1cBVS8YT/02yefh7BAKTgmZzgdj2bygrUCSvq B8hBr7BsE+ohuiSpgMX77q2b57CS2i8JjaEd/+1vLEUAwhh9Y7s3kAQufasE5VKhuCvB g1U1Rlg6VxrZb8eQWbTnqids1TFvlaqRJnbzn7eQCTsD+0osRBSX9NbevESVI9ZsrZ0I /Qcu/iMzOQXmXIoTL0jeR7iaW72mGNoOACniDl0gXxxpY2ORDgqJDpu58FxcKvNWTq+s Xd2rysh2VL/3elg0irTQCMNa+yo+U6vy+vK4na2f+v2ms15+bvD7R11FZo8DfE959hJk 3QkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681492238; x=1684084238; 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=x7xn2Gtn3wHA6T6RcHJrKbMsiY34n3kVCnZVQNzuOEw=; b=eyeqOX3PuaMpqkA12FPE24wKhjYg5K8cbci11QBF8BwzmL/koKZspyHUCZGDrB5DQf KVoWkpBzMvUwqimW0HLSy3nif1Bk9deM6Wq7J14+nNjCKCGKCYYE8ZaZh7yh+y6yNotr NsKz24qke0XFVeQxTo4lIq+MHc+iMFHZCcuZ3/dE5iGUSLHXrMGbRwvngUfxru1ujX7h IhUGaanYonLWOuuvz0J/OoSF+tSVzgPgq6hDgWNSwDun1gsqSDyd5Slq5sTyRt/nBtER jOHoWBj/+dwmHvZd3FCi5n88RJr8nBWzAgBNTb8FfEzi1Q9HPCSiVyQVa1rkYK3mxY+u 5DDg== X-Gm-Message-State: AAQBX9eIvNiVTKr8OI3oknjhiAWI8eWZW92Ym7PNFnOzfQAW3+guxIFI I1gMek31yZFfYISsnEls9zRCdWjtupQQtaxe5b3yaOrt X-Received: by 2002:a05:6a00:21d5:b0:638:7c22:6fd with SMTP id t21-20020a056a0021d500b006387c2206fdmr8707995pfj.1.1681492237799; Fri, 14 Apr 2023 10:10:37 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 10:10:35 -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 v4 01/10] RISCV: Eliminate SYNC memory models Date: Fri, 14 Apr 2023 10:09:33 -0700 Message-Id: <20230414170942.1695672-2-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 X-Spam-Status: No, score=-10.5 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=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?1762371753488530894?= X-GMAIL-MSGID: =?utf-8?q?1763172487369607060?= Remove references to MEMMODEL_SYNC_* models by converting via memmodel_base(). 2023-04-14 Patrick O'Neill * riscv.cc: Remove MEMMODEL_SYNC_* cases and sanitize memmodel input with memmodel_base Signed-off-by: Patrick O'Neill --- gcc/config/riscv/riscv.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 5f542932d13..2226241217d 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -4288,14 +4288,11 @@ riscv_memmodel_needs_amo_acquire (enum memmodel model) { case MEMMODEL_ACQ_REL: case MEMMODEL_SEQ_CST: - case MEMMODEL_SYNC_SEQ_CST: case MEMMODEL_ACQUIRE: case MEMMODEL_CONSUME: - case MEMMODEL_SYNC_ACQUIRE: return true; case MEMMODEL_RELEASE: - case MEMMODEL_SYNC_RELEASE: case MEMMODEL_RELAXED: return false; @@ -4314,14 +4311,11 @@ riscv_memmodel_needs_release_fence (enum memmodel model) { case MEMMODEL_ACQ_REL: case MEMMODEL_SEQ_CST: - case MEMMODEL_SYNC_SEQ_CST: case MEMMODEL_RELEASE: - case MEMMODEL_SYNC_RELEASE: return true; case MEMMODEL_ACQUIRE: case MEMMODEL_CONSUME: - case MEMMODEL_SYNC_ACQUIRE: case MEMMODEL_RELAXED: return false; @@ -4360,6 +4354,7 @@ riscv_print_operand (FILE *file, rtx op, int letter) } machine_mode mode = GET_MODE (op); enum rtx_code code = GET_CODE (op); + const enum memmodel model = memmodel_base (INTVAL (op)); switch (letter) { @@ -4497,12 +4492,12 @@ riscv_print_operand (FILE *file, rtx op, int letter) break; case 'A': - if (riscv_memmodel_needs_amo_acquire ((enum memmodel) INTVAL (op))) + if (riscv_memmodel_needs_amo_acquire (model)) fputs (".aq", file); break; case 'F': - if (riscv_memmodel_needs_release_fence ((enum memmodel) INTVAL (op))) + if (riscv_memmodel_needs_release_fence (model)) fputs ("fence iorw,ow; ", file); break;