From patchwork Mon Apr 10 18:23:39 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: 81592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2075434vqo; Mon, 10 Apr 2023 11:27:52 -0700 (PDT) X-Google-Smtp-Source: AKy350axgj9GkQ0BD/vIo/M1N5RGQlOM1q0LRAvM9hrEvotLXjRYHL0T81Eh/YtQ8iThUw88Ja/W X-Received: by 2002:a17:907:783:b0:94d:e00a:e5fe with SMTP id xd3-20020a170907078300b0094de00ae5femr1190705ejb.13.1681151272076; Mon, 10 Apr 2023 11:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681151272; cv=none; d=google.com; s=arc-20160816; b=O47Hi2OW5GoOGyFbRNvDxK0QZCW9YJpMmlPAZ1RZ3S2hKQxlVwE9cBrWhR4DEbqaML lije8HgERRvGqOZpXuoFAYW9SFwscFYDZPHc9c0E0OBXA0sVHljKnkCyQxacgfkuj3qC tZghzm2WZWUCBn4e9LD92gqKzqA+I0UDCRUJCfBLOENX9OkEhDq1xx2xZwZfGiQHSsqO ohVgGIGqQtG9A8rf7K/PHnCGWig4HmDmB+JKZwJSgpLCEW0UDunVMvUZlc1Ub+59cEhl GPlfX0wSDScqc+g9CWJ3KBQegGZYsWn9IOkKakQTw8b55QUiD2GMfkApBzRdc+OmYFvx V7zg== 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=FRg34zs7ALW78QTM62O4OJBG500WdPkSLdXgvqHAWKo=; b=yWVbwEAkjSPsrPbZNaT+S3dXXUFYw8p0DvuNX7HZxWImN9mZT4+1Jc8SvwYx/lCku0 juqLL8EVUC8w9Fa4kuGonK+NM2NG6+3CRWgUJBib20Sng0l4yvmJX1OcOIgBIL2Z2NEw hwzSI73oN49RirUAj26ik3ZSFoGuGi6FGikZ49Y4HimXIxhbLwN9E+Gf7r6j+egLUZR4 6HCmHSBFdqqAHpLObW5Q/57Bby1THdiAkd/Wmq0d1YuYsHe81p/YxCXGRy1o+f6Z19W8 H/6+lHhn5l5+xIV/akdxDG2u52r0vTj8v8I/9mq0pqcOySVf8Sp1X6FPYpXfWAZdjjVr 4rAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=5tbji6eR; 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 i19-20020a170906091300b008d0378ec19fsi8065398ejd.650.2023.04.10.11.27.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 11:27:52 -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=5tbji6eR; 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 3920C3855598 for ; Mon, 10 Apr 2023 18:27:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id CC1993858C62 for ; Mon, 10 Apr 2023 18:26:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC1993858C62 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-x630.google.com with SMTP id n14so30495205plc.8 for ; Mon, 10 Apr 2023 11:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1681151210; x=1683743210; 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=FRg34zs7ALW78QTM62O4OJBG500WdPkSLdXgvqHAWKo=; b=5tbji6eRpYG5xLG/fMtqRVnStPTXAUmDXsD8hawWm8snlsmvDhY3Y6lH6jPUIg5J6o KlTQUDGkW8kARYPa5TTOv826nt69iu7pi8Yc/xP2jguOreFnoNY2nGchc1nRdY10/4kC 90EmQQEmYFW7zJHTx9PbuvIqyswdp9BceGd748VQu3WTsNcP1EDp90IbwZSziJ8VpVqy k3MXQ4OY3oysKsAFqEzc5EnRQYRD8AKBzS02nRq2atwdX6kRWumgo9UyGuiGvKfwMDu8 rT829b3LDDZRjl0OT/tZlRdKVxLw9yoGCBUWlHbw1yH5GTgksWZQvvnExX8xraEwEFdK o/Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681151210; x=1683743210; 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=FRg34zs7ALW78QTM62O4OJBG500WdPkSLdXgvqHAWKo=; b=Zlualvg56bpkHYDUMjU2avkYcpoMvKmWzn9s4ItiE8Z6krGJlRA9Cf6IPfm5yzEyQX 0lDuZPxsTepgoE5Em1PyPOp0zDneT/NfLwfuOyzHHPpWjwpRVjkQwyNLXhDMkwBddTG8 bZ32s9t6KBy3NSFhhLD5qMQnaRM6YyZASt7GDTzf4v/pqe6RTxItDvUPoZTEI2o65vJK p75+zKpuEUNKrAvSsM/ppe896EDepqfoDLI12Oro1jN0ObGojRRynde55sFS6UxpolFX VRI537QCvFhbNIEz5wOxS+tGBE7ao8mTVlf3ghqTusXE2r3pw7icHHNJk9SvVjUcXqL3 7KXA== X-Gm-Message-State: AAQBX9dvPUL5pETdeyRwTfRxScQ03ImeWhmcFmpTTNvd6W49dvDZ+yeL 02P3hyFCbBQPJJ5ow1GbEYqSgTBnb0POIQMM1LTW5dEX X-Received: by 2002:a05:6a20:45e:b0:d5:f7f5:85e4 with SMTP id b30-20020a056a20045e00b000d5f7f585e4mr10833318pzb.22.1681151210720; Mon, 10 Apr 2023 11:26:50 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 11:26:50 -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 01/10] RISCV: Eliminate SYNC memory models Date: Mon, 10 Apr 2023 11:23:39 -0700 Message-Id: <20230410182348.2168356-2-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=-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 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?1762814876495773016?= Remove references to MEMMODEL_SYNC_* models by converting via memmodel_base(). 2023-04-10 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 76eee4a55e9..8f5636c93ed 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;