From patchwork Tue Oct 31 00:49:28 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: 159910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2601246vqb; Mon, 30 Oct 2023 17:52:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHu+zEUTXWgVOvYhiXItDl4MfaQg8RwNX/nqWajb11+FDDW2OhDlwCis2QGLvPMXpbJPpsn X-Received: by 2002:a9d:7d0c:0:b0:6b7:52ce:ff38 with SMTP id v12-20020a9d7d0c000000b006b752ceff38mr11354993otn.16.1698713558598; Mon, 30 Oct 2023 17:52:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698713558; cv=pass; d=google.com; s=arc-20160816; b=YqYSxhIxshfCftMma4brXCX2Bv1Hg/C7NweiE6qh0zLq+fW8jNrQQJFmN883v5Di0n b4Ts3YagmpD+sMvGjbbAdDDN/1P7U5VMlZE/CAOfufZRz+/empjivJVxn4kzg4PIG5bg iiXqxWvMZFistQ2DOfsxt0O6QbHJ0ZfbgpMuv6IdTKEtmh9WbdA2xq6k/hJj9ICxMI8a 0a5g1uUeA+qkLSZjmLu5eLYSwr9W24x4bZzJ/MLxoCYBU3iHPVbZONglXugoIRiU+ytx /GZiY8XfQxmj1tnyCaRnxtRERqMGzyFKePulFucIK7CchBGijxOqXQbMjCR0vWbhCT+C Sx1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=+TofWZ20RsQj/NI6DA7VskIHyWGVZ8i9o8pKEhQ1T58=; fh=AMD4FSz6cUc4n6xCKkDOe8Mgn0A5ubP59ONK3itePwA=; b=OZfpbgsR/8oy08NBpJTPWSyZCReeO9msZ03QNgm6ChRNNAtP1Y8TEOvEZrjxYjVHRE c6/ZJqaUBbEGYILJuruMtVnLdk3+t2SvB8MAHjzJjKhRKj3S4QV1DcM0bHO8ZbNWinSa ruPxK/cfZDGUPuD2xkb79/qSbQWbiRKL5T6+WvL8dB87KwFrJZFUmLW7ZiO6F/f3swhy lLrRIz7jGHlS59+Tj1Rsii8/d0YVsM68fdyeHGuX+yG9vYxvBOJtWcfTZa0Xse6wcyT4 T3BW9+4rzz5LR/aT5XqeurVw8UMvtwUXdywNj7+U9RysQzmg26VKMzsX2jUWwAb0+OsT VBwg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=ZH7dGX8C; arc=pass (i=1); 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f18-20020a05622a105200b0041975795c17si170853qte.230.2023.10.30.17.52.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 17:52:38 -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.20230601.gappssmtp.com header.s=20230601 header.b=ZH7dGX8C; arc=pass (i=1); 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 64C00385840D for ; Tue, 31 Oct 2023 00:52:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 4D7B23858D1E for ; Tue, 31 Oct 2023 00:52:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D7B23858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4D7B23858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698713532; cv=none; b=abJJ7t5ftBmz1KLrgeVz1ZHjd7hfw4oMggSMqjPAjc7MDjsl47Vr4jmzmH2pnZjpH2+GG1kLSoNGtbgcGQcHP6D2mJMJiEJyD4DbSyEyTQRS2ZTpMe+xBvKMQLSmduwnzBi+qgBc6+y/w7X01s+/QPsN1jDSNt2nZORN5SKVK0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698713532; c=relaxed/simple; bh=Xt8tf9rJwrt+jTrYUY0vnUWu6JYDW+EW/Fp9MU+fRd8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=sIk+bxM1nP55YYli55aL5BC6Z23/6WwdLvokmgyXVxmbfRWK7FReJJW8s4mJFJjt9nK2+eEEfa9/+Llsnr5rjUEl0C6renmiiEqJtUkglwmBO3cbu4SJpi3CD2xE+KjjkXtMh2e5bQXp/yc+d1I+L8TEf0kpOXIl8cjEEpDcQ8Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-28014fed9efso2203728a91.0 for ; Mon, 30 Oct 2023 17:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1698713528; x=1699318328; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+TofWZ20RsQj/NI6DA7VskIHyWGVZ8i9o8pKEhQ1T58=; b=ZH7dGX8CMZe1+sZPwRmLVQrvTD+QLNJRab4FZKzLTfR74yJidtG3r7sgvqp3PaZnJJ 4L5sW5PqQtDAzWAs5FET524fpWNGM+9cU5+qGaKitt65rWaaxu76KeTFVXrnZ9u0zli8 4XhMt8iHXoaAOSc1zx2F7tXQBp6tOXnO71ilHKn+LGPydr/Scap02nrq8PahON9Gjlsy Yxdc+ciPd8GOGKhilBf976kgk3Nc7Hvu+c7FEKopIFctIaMvzxFw47XMUzwE/0gBQayg 3jk8xqIGLaL+DpeC77t8necCOAR0Mi53okmEyJ8YNeb4zSzzKutrRRGoZES6ji1mU9O6 vmfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698713528; x=1699318328; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+TofWZ20RsQj/NI6DA7VskIHyWGVZ8i9o8pKEhQ1T58=; b=txIuKkJ1IbGBkvOdtzX11bbkHRxl29GMENXVbRl7Jbqg0liyKQtOJ9wee7QCav6Gq7 42nhhD95+gWQ52QhGP/yFVEgMO3bA35wna87Qh1he673j7axc0Ub1JH55lMBMpyvrwur tCfj0crAXKNWT0cH4LyJhISontAp3QY2VN836xpRFtGeBSGH/Hl42GgYwioIcK2g8st5 vlYKKtyNnbqx5Re31n1FVPBk1YRcqNKoRhROnZ8Hn2QyOCfsZGtfWNgCbANFeTN/eBCM C4IHg2fsZ9P7muv/w5ARwhuk6e0JuWsMm0gwkQDUMfCluVOXA/ShRKvnzGMc0CayMrms Qyew== X-Gm-Message-State: AOJu0YzG8BbYQOSGhvxbOjAN9QarEk0EKyQSfaiZYN2ClzpLDmr3DNY0 iViZMgQmmK+GMneBRRlD6lNKqhudNLL4o+1eNAE= X-Received: by 2002:a17:90a:1a17:b0:280:2c55:77c5 with SMTP id 23-20020a17090a1a1700b002802c5577c5mr4661526pjk.46.1698713528406; Mon, 30 Oct 2023 17:52:08 -0700 (PDT) Received: from patrick-ThinkPad-X1-Carbon-Gen-8.hq.rivosinc.com ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id 9-20020a17090a004900b0027782f611d1sm89335pjb.36.2023.10.30.17.52.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 17:52:08 -0700 (PDT) From: Patrick O'Neill To: gcc-patches@gcc.gnu.org Cc: Patrick O'Neill Subject: [PATCH 1/2] RISC-V: Let non-atomic targets use optimized amo loads/stores Date: Mon, 30 Oct 2023 17:49:28 -0700 Message-ID: <20231031004929.1435217-1-patrick@rivosinc.com> X-Mailer: git-send-email 2.42.0 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781230268765397002 X-GMAIL-MSGID: 1781230268765397002 Non-atomic targets are currently prevented from using the optimized fencing for seq_cst load/seq_cst store. This patch removes that constraint. gcc/ChangeLog: * config/riscv/sync-rvwmo.md (atomic_load_rvwmo): Remove TARGET_ATOMIC constraint (atomic_store_rvwmo): Ditto. * config/riscv/sync-ztso.md (atomic_load_ztso): Ditto. (atomic_store_ztso): Ditto. * config/riscv/sync.md (atomic_load): Ditto. (atomic_store): Ditto. Signed-off-by: Patrick O'Neill --- gcc/config/riscv/sync-rvwmo.md | 4 ++-- gcc/config/riscv/sync-ztso.md | 4 ++-- gcc/config/riscv/sync.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) -- 2.34.1 diff --git a/gcc/config/riscv/sync-rvwmo.md b/gcc/config/riscv/sync-rvwmo.md index cb641ea9ec3..c35eae15334 100644 --- a/gcc/config/riscv/sync-rvwmo.md +++ b/gcc/config/riscv/sync-rvwmo.md @@ -52,7 +52,7 @@ [(match_operand:GPR 1 "memory_operand" "A") (match_operand:SI 2 "const_int_operand")] ;; model UNSPEC_ATOMIC_LOAD))] - "TARGET_ATOMIC && !TARGET_ZTSO" + "!TARGET_ZTSO" { enum memmodel model = (enum memmodel) INTVAL (operands[2]); model = memmodel_base (model); @@ -78,7 +78,7 @@ [(match_operand:GPR 1 "reg_or_0_operand" "rJ") (match_operand:SI 2 "const_int_operand")] ;; model UNSPEC_ATOMIC_STORE))] - "TARGET_ATOMIC && !TARGET_ZTSO" + "!TARGET_ZTSO" { enum memmodel model = (enum memmodel) INTVAL (operands[2]); model = memmodel_base (model); diff --git a/gcc/config/riscv/sync-ztso.md b/gcc/config/riscv/sync-ztso.md index 7bb15b7ab8c..6fdfa912a2c 100644 --- a/gcc/config/riscv/sync-ztso.md +++ b/gcc/config/riscv/sync-ztso.md @@ -46,7 +46,7 @@ [(match_operand:GPR 1 "memory_operand" "A") (match_operand:SI 2 "const_int_operand")] ;; model UNSPEC_ATOMIC_LOAD))] - "TARGET_ATOMIC && TARGET_ZTSO" + "TARGET_ZTSO" { enum memmodel model = (enum memmodel) INTVAL (operands[2]); model = memmodel_base (model); @@ -66,7 +66,7 @@ [(match_operand:GPR 1 "reg_or_0_operand" "rJ") (match_operand:SI 2 "const_int_operand")] ;; model UNSPEC_ATOMIC_STORE))] - "TARGET_ATOMIC && TARGET_ZTSO" + "TARGET_ZTSO" { enum memmodel model = (enum memmodel) INTVAL (operands[2]); model = memmodel_base (model); diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md index 6ff3493b5ce..ec9d4b4f59e 100644 --- a/gcc/config/riscv/sync.md +++ b/gcc/config/riscv/sync.md @@ -60,7 +60,7 @@ [(match_operand:GPR 0 "register_operand") (match_operand:GPR 1 "memory_operand") (match_operand:SI 2 "const_int_operand")] ;; model - "TARGET_ATOMIC" + "" { if (TARGET_ZTSO) emit_insn (gen_atomic_load_ztso (operands[0], operands[1], @@ -75,7 +75,7 @@ [(match_operand:GPR 0 "memory_operand") (match_operand:GPR 1 "reg_or_0_operand") (match_operand:SI 2 "const_int_operand")] ;; model - "TARGET_ATOMIC" + "" { if (TARGET_ZTSO) emit_insn (gen_atomic_store_ztso (operands[0], operands[1],