From patchwork Wed Apr 5 21:01:11 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: 79941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp588889vqo; Wed, 5 Apr 2023 14:04:37 -0700 (PDT) X-Google-Smtp-Source: AKy350YeqOzzpitJ6hy+HGplhJcSSMBoEYlAC+RqAbzhCVi3vXTyf4jM1sofQLBKNj6WrHSSTcSo X-Received: by 2002:a05:6402:1a49:b0:501:fe46:480b with SMTP id bf9-20020a0564021a4900b00501fe46480bmr2587927edb.15.1680728677282; Wed, 05 Apr 2023 14:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680728677; cv=none; d=google.com; s=arc-20160816; b=mT1FCbP8qdbHW2rydFQmxtZQj/ZEaOvis0yurKZbHepKUpJ9Xf/JP8rt2aP29auB1X ovBv5fUv9BUkblcpV8q2Y/yILb4LTyqPxSz0ygN1I6cIM9zfu3WAaBm9F15UdeWsFsnD daeYov8aC5Gd8fjCmwUuDL5HJXYbL/CKPmN2VqpCFHrl3nFZKUpVwA2s6vLEzfNgN+5i +JtcCTfghs1a1giHjaNXDhnJ1nWvYug3iHdzlEoHnh5k91v95A6oj8XjZzgSYyaxd+f0 ESzXinozw6IwFVaVsyHUDDqQh5eD+jFnjhNcZAzW6KsLBZk3YqaAjy5O4SiHDbHxP4vm MetQ== 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=n5FQTpZaxHilKAGb6OfRk4pW/BvnhnTDroWu/BcWn/s=; b=a+WcgDuC4CY48no6fXhn1p8Uu59PdhnmqT6Iqe2Ur9N3NSMMEDBrCkwcCt1ilBLTvg PHILsNBsttDwwIK8WpUmn8bPAoPNtaiK+OB1dfvxcF/1TY7T5AQE2cblrDdUzq7i/dtg 9PzqyYQmvRyuduF19bo9+BEiLBwQHNwRKQulkHHz8wtxJMHciomBUhHsPm2lSxAoinSp ZukU1Ym/scDspWuokP2UszwETPgGXT9RkMrmgWRDwomWnAkO7hB2UhNjIbGqLy4e1OCX bvtj57lM5q60UVQwiV3NopZaeHEsEAeY6Li8Ogfscn1c/8OkhBUzxvFx+rOcAffDrNmX gh/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=mU38Qo6+; 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s16-20020a056402015000b004fc995b3385si1503726edu.634.2023.04.05.14.04.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 14:04:37 -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.20210112.gappssmtp.com header.s=20210112 header.b=mU38Qo6+; 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 4E7733857712 for ; Wed, 5 Apr 2023 21:03:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 612653858C2B for ; Wed, 5 Apr 2023 21:03:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 612653858C2B 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-pj1-x102b.google.com with SMTP id f6-20020a17090ac28600b0023b9bf9eb63so38570150pjt.5 for ; Wed, 05 Apr 2023 14:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1680728580; x=1683320580; 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=n5FQTpZaxHilKAGb6OfRk4pW/BvnhnTDroWu/BcWn/s=; b=mU38Qo6+kuyODzverRqfk8L4i1ByiLRDdHNcgVF3SUFG0muUq4jXndY4+gJ4wAq+DF VUMxa/yGV/VUCRGeLm4LfRwgd79L4pZWRe/JcltYpM7FH/RADgGhpHAcRFjBnFgyfmOh /JJw+DK2BhqDcwxpqmNQUaWyDjCGqxeNfrr5TtR6R8wPypD2kETDhecTACXXN8YustKq sp4z10MzZ0kTo/ilPsr6dfiBmxzCjts+8uvg7qx/lXpQSVf+x3kSdbY+ngSfgJG+7+Zf /Kowj++jt2GfQXGfNxIJCFn9MwQJ3GAl4XHYNV/BKHDYNoCenK7MzHAlh1V8JCqy4Zpd Ysmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680728580; x=1683320580; 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=n5FQTpZaxHilKAGb6OfRk4pW/BvnhnTDroWu/BcWn/s=; b=CoKO3u1aV6EL3vlVa+RNYKZOpGgwfXFnzGQbWRz9qf1WDyetJiFnnJkkPannu6b5zv AOyABjmKKxn7owXha39R62gy1xQMm6Xu2evHWiAYzXwApues9Z8pWOHU4zIKB1FN4pbF ptJVriu1+Qgt+dDVz7g4tuvbm3wX/t8QxsoFn6E7Gdtt4NdHXS/yr40pVY6Wm5WVazHV xcsHfcpy5Gbdwgl5RyxtO2ezRLNCbnuWVF7s7aiXo2mA+BKPFLac5hLLageoF20xOp+T 9m9eGtjcclBcpdqmJ5REM+GW6c7zzn+gyQhP6QVim7ujX86KSZQU0uVfVLP5owTbERc0 AGGA== X-Gm-Message-State: AAQBX9dwTZIThI2CQVm5OszhYhY4MzcNmro3Vq9vqRLNagxuatIT5amH lCRKvgIixIh71nRTD07F+JjNdq1p1af4+uBGmbk/jDl0 X-Received: by 2002:a17:90b:1c02:b0:23f:78d6:b5cc with SMTP id oc2-20020a17090b1c0200b0023f78d6b5ccmr7914934pjb.38.1680728580203; Wed, 05 Apr 2023 14:03:00 -0700 (PDT) Received: from patrick-ThinkPad-X1-Carbon-Gen-8.hq.rivosinc.com ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id e6-20020a17090a77c600b002342ccc8280sm1809477pjs.6.2023.04.05.14.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 14:02:59 -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, jeffreyalaw@gmail.com, cmuellner@gcc.gnu.org, andrea@rivosinc.com, Patrick O'Neill Subject: [PATCH v2 1/8] RISCV: Eliminate SYNC memory models Date: Wed, 5 Apr 2023 14:01:11 -0700 Message-Id: <20230405210118.1969283-2-patrick@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230405210118.1969283-1-patrick@rivosinc.com> References: <20220407182918.294892-1-patrick@rivosinc.com> <20230405210118.1969283-1-patrick@rivosinc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 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?1762371753488530894?= Remove references to MEMMODEL_SYNC_* models by converting via memmodel_base(). 2023-04-05 Patrick O'Neill * atomic.c: 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;