From patchwork Tue Oct 31 00:47:32 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: 159909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2600332vqb; Mon, 30 Oct 2023 17:49:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqRfJVmYRkC6Go6uOTx/pHQoTb4XnVcQfuuwPKKDhNRu/chiQpJr3rQAUArovVL81QdHgy X-Received: by 2002:a05:622a:1a9b:b0:417:fd7e:2154 with SMTP id s27-20020a05622a1a9b00b00417fd7e2154mr14445657qtc.9.1698713373449; Mon, 30 Oct 2023 17:49:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698713373; cv=pass; d=google.com; s=arc-20160816; b=yQJ26gb4NFeZ1Hf79xA/2Zg3AsFfqkfcfhJghnDviOGcywhJrLq4DDTskdj5axawYS Va0GnULDe9ELiQ+vFEeXWoKOgTbDoz5jQb+j4dn0uwfF4X4VJYg2Hssxdfqe34WahPA2 d/q8QM0v8yWdTo/K6JzScWO24xlFj9tI6vZfiULy91ZB5d2GaEzPoWB9v+6/WzNmeUKd pEdyauQpWWVumNzqxOnB7ZJvZm6bVB8lLDFu717UhajSfCUlrNMHb2xcRED8IVD4JY8l hrYAPYGNnzkO4xn2J/yHMipNfywk9mZheFUMdKcGcCkmOLaS2j3ZFVd6Ma2eJyRKOc41 92NA== 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=Su2+nIevHfymuf6gGh9gvLBsAyfQOn7B+53zHZs10KM=; fh=AMD4FSz6cUc4n6xCKkDOe8Mgn0A5ubP59ONK3itePwA=; b=Y5ZbFyb6+5pb8FkONxe6h3mZfhBBK1hMA+GlB714/d9Lj6GvDgrWc1+Y/3QQ4PWMUL YlOlogFBhBRc2jo5eLvI/zOVSOvQjqf7Y4ZLfDK4KC6jN26bpDBG+CVYNupOYxTgheXj 70D/czQR0o3T/8keKXz4Ods3was2PPR+zkWI1AUw8IO8N32aF0K4kHDa4vmZ+WUkjhsd 9Bs6vCSyd1cDrg937Nt9t8dJakb5583HSD5+un1Gh5ANx9R+zKidf6wcR51jumkXyN4F ztcaLwfgeVwQ6HkoWBh9CoEastO3DyVVo/nx3Z5slFTCH6knbybGTzodev1qJhG52JMt aSDQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=xv62FWuK; arc=pass (i=1); 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id t1-20020ac85881000000b0041cb481b946si178041qta.389.2023.10.30.17.49.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 17:49:33 -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.20230601.gappssmtp.com header.s=20230601 header.b=xv62FWuK; arc=pass (i=1); 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 380F83858C20 for ; Tue, 31 Oct 2023 00:49:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id B59883858D1E for ; Tue, 31 Oct 2023 00:49:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B59883858D1E 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 B59883858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698713347; cv=none; b=baUTvai+HYSTIDgMnN2x2Bp51HaMNZaNdpUiL9DPB0BgaFFxpThqHoY2yILVJPog4eRNypnb+tWzBREKAZl1nKSv2yQIHcwuVza17aq1uwq1GifKHwWQGkcuVNT6WqipSEorOmdQzfJKkfoI831X5UuFoGCeN6mDi477GfClP8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698713347; c=relaxed/simple; bh=bkYNHVe0Pa3FsxTUNHfar4vHIsTjB++d/QLr3UJDrvI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=M3LpObo/Zcr5n9j6kzrzt98IKLBWXX+NCd8SnI2L48FZOL4iJoJSbk6G1ewku9okXZzwMK/+JAcISW+UInLb3jVWHod3J7n0OzJ+zObiTgi7sGvutx+qR5pMd50OIXk+ngCPET2XVVYzNMaFCc2JCCXmgn1pVWSPlWTyUL6rr9s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1cc1ee2d8dfso33857265ad.3 for ; Mon, 30 Oct 2023 17:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1698713340; x=1699318140; 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=Su2+nIevHfymuf6gGh9gvLBsAyfQOn7B+53zHZs10KM=; b=xv62FWuKX/FkJ3U5103qyDhCjlN9s026QFclqU0AfKuEIMtTEbMLLf96aoFZHFpDhj +lF7QraCDE/X1UJktCKDBmYvOQYkH/kdVy69RDMrz/S5805MHdne0AaPBJk9CJ+oHnzW AXqTRF9aIugPv0mGWZFudS+ooVpAEx8Vh6rLxWQ6ytqFrZYqmuUbSfxWsqqTe5HuWFgM ll8/t37ytPRkPWjeaIFb7zBQ78f9CGHEVtyIpUHvnrmvcMFGJV8i0d7nV7l46iSOPYOp o/JxQ+LQa60HKP4aNZrSdkvwwilkZ4n5bHBeV/bWB/egUcY2EjsHHiVT81v88r3KMzJg fyQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698713340; x=1699318140; 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=Su2+nIevHfymuf6gGh9gvLBsAyfQOn7B+53zHZs10KM=; b=t649UYrIrzGPi05WLutsJ10ngxEiYVl1CcZ+i0ZEauRBAltYewfjd2LdUo6IDDsyNF JmLywVgqSVBKsYa/nEAbfc9jWqJiJzKd7TQT5wNSdECgImNYIUI3P5XMizkho0dk6E2R qw/ddBUI/V+yo69NPaxj2Sf6jtaBC0wE2J33saAWywLNnMrWJg7mimXkAFKmJdri8ZV1 JfIbNmLpTuvH97pj2XcAKhv6rSs0XJiMEDh0I5wZTYWF2IUtsJ4syDECkQjQWs+Q27aA 0Umnn2h+69BDjP6AWB+nUrDPc873HvvwQgqe0CqoNZCNCSJGwFE9OvzwPAtO+3JSj9uE 9uyw== X-Gm-Message-State: AOJu0YxxN+ThGelM5zSAKbLXHi4zf0bcSUSyjwA2r7cvKqjHtIf1zEMi rQ/cg8ZK8D5klDbUmBynWOJGF79Tsxgx+LvfdoE= X-Received: by 2002:a17:902:c1cb:b0:1cc:29ed:96ae with SMTP id c11-20020a170902c1cb00b001cc29ed96aemr9706760plc.41.1698713339802; Mon, 30 Oct 2023 17:48:59 -0700 (PDT) Received: from patrick-ThinkPad-X1-Carbon-Gen-8.hq.rivosinc.com ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id n17-20020a170902d2d100b001c61e628e98sm104197plc.175.2023.10.30.17.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 17:48:59 -0700 (PDT) From: Patrick O'Neill To: gcc-patches@gcc.gnu.org Cc: Patrick O'Neill Subject: [PATCH] RISC-V: Enable ztso tests on rv32 Date: Mon, 30 Oct 2023 17:47:32 -0700 Message-ID: <20231031004732.1435165-1-patrick@rivosinc.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, 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: 1781230074273392583 X-GMAIL-MSGID: 1781230074273392583 This patch transitions the ztso testcases to use the testsuite infrastructure, enabling the tests on both rv64 and rv32 targets. gcc/testsuite/ChangeLog: * gcc.target/riscv/amo-table-ztso-amo-add-1.c: Add Ztso extension to dg-options for dg-do compile. * gcc.target/riscv/amo-table-ztso-amo-add-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-amo-add-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-amo-add-4.c: Ditto. * gcc.target/riscv/amo-table-ztso-amo-add-5.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-1.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-4.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-5.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-6.c: Ditto. * gcc.target/riscv/amo-table-ztso-compare-exchange-7.c: Ditto. * gcc.target/riscv/amo-table-ztso-fence-1.c: Ditto. * gcc.target/riscv/amo-table-ztso-fence-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-fence-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-fence-4.c: Ditto. * gcc.target/riscv/amo-table-ztso-fence-5.c: Ditto. * gcc.target/riscv/amo-table-ztso-load-1.c: Ditto. * gcc.target/riscv/amo-table-ztso-load-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-load-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-store-1.c: Ditto. * gcc.target/riscv/amo-table-ztso-store-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-store-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c: Ditto. * gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c: Ditto. * lib/target-supports.exp: Add testing infrastructure to require the Ztso extension or add it to an existing -march. Signed-off-by: Patrick O'Neill --- .../riscv/amo-table-ztso-amo-add-1.c | 3 ++- .../riscv/amo-table-ztso-amo-add-2.c | 3 ++- .../riscv/amo-table-ztso-amo-add-3.c | 3 ++- .../riscv/amo-table-ztso-amo-add-4.c | 3 ++- .../riscv/amo-table-ztso-amo-add-5.c | 3 ++- .../riscv/amo-table-ztso-compare-exchange-1.c | 2 +- .../riscv/amo-table-ztso-compare-exchange-2.c | 2 +- .../riscv/amo-table-ztso-compare-exchange-3.c | 2 +- .../riscv/amo-table-ztso-compare-exchange-4.c | 2 +- .../riscv/amo-table-ztso-compare-exchange-5.c | 2 +- .../riscv/amo-table-ztso-compare-exchange-6.c | 2 +- .../riscv/amo-table-ztso-compare-exchange-7.c | 2 +- .../gcc.target/riscv/amo-table-ztso-fence-1.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-fence-2.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-fence-3.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-fence-4.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-fence-5.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-load-1.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-load-2.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-load-3.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-store-1.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-store-2.c | 3 ++- .../gcc.target/riscv/amo-table-ztso-store-3.c | 3 ++- .../riscv/amo-table-ztso-subword-amo-add-1.c | 2 +- .../riscv/amo-table-ztso-subword-amo-add-2.c | 2 +- .../riscv/amo-table-ztso-subword-amo-add-3.c | 2 +- .../riscv/amo-table-ztso-subword-amo-add-4.c | 2 +- .../riscv/amo-table-ztso-subword-amo-add-5.c | 2 +- gcc/testsuite/lib/target-supports.exp | 23 +++++++++++++++++++ 29 files changed, 67 insertions(+), 28 deletions(-) -- 2.34.1 diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-1.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-1.c index a88d08eb3f4..65a4351025d 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-1.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-2.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-2.c index ebd240f9dd2..03da6b04de0 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-2.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that atomic op mappings the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-3.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-3.c index ee00d222ece..695306e9d6f 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-3.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-3.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-4.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-4.c index ff08811c5d7..e7e5ac7cc88 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-4.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-4.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-5.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-5.c index b129df4b607..457d0b12fbe 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-5.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-5.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-1.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-1.c index 9d5b8c2a5f6..dd6b5c24aa0 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-1.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that compare exchange mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-2.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-2.c index 57d6746ee22..b0bafa3296e 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-2.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that compare exchange mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-3.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-3.c index d0044106d36..78cb8aa9748 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-3.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that compare exchange mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-4.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-4.c index 6a53473e26b..0656b84c787 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-4.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that compare exchange mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-5.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-5.c index 80729091c73..33d486c26ca 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-5.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-5.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that compare exchange mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w.aqrl\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-6.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-6.c index 731f7f84af4..f8331bfcd0d 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-6.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-6.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that compare exchange mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-7.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-7.c index 3806d55da1d..b5c42e1df1d 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-7.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-7.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that compare exchange mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w.aqrl\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-1.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-1.c index 81f2f9fbbd6..ec008d25794 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-1.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-2.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-2.c index 8e868890bae..acef911573f 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-2.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-3.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-3.c index 5eb1aa7f472..6931ba0a799 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-3.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-3.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-4.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-4.c index 3df959a3eb0..b5a04294ad0 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-4.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-4.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-5.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-5.c index 731f9a34267..860fb978cbc 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-5.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-5.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that fence mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-1.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-1.c index b911a6e3207..631977985bd 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-1.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that load mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-2.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-2.c index 056506f6370..2c24f10fb44 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-2.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that load mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-3.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-3.c index 35a301f321d..7d2166d29c0 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-3.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-3.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that load mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-1.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-1.c index f0bda4b2420..29a770285ef 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-1.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that store mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-2.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-2.c index 45f73056aa4..fb82360ad33 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-2.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that store mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-3.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-3.c index 762468b248e..88d8432d8c9 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-3.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-3.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* Verify that store mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d -O3" } */ +/* { dg-options "-O3" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-skip-if "" { *-*-* } { "-g" "-flto"} } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c index e9ae506f32c..3ba69ebc325 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that subword atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c index f47922f13e4..4f38ed3015c 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that subword atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c index 296387ad07c..e5bcb127552 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that subword atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c index f919ede7303..316183c268b 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that subword atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w\t" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c index 2027a93218c..fc1aa8d94f1 100644 --- a/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c +++ b/gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* Verify that subword atomic op mappings match the Ztso suggested mapping. */ -/* { dg-options "-march=rv64id_ztso -mabi=lp64d" } */ +/* { dg-add-options riscv_ztso } */ /* { dg-final { scan-assembler-times "lr.w.aqrl\t" 1 } } */ /* { dg-final { scan-assembler-times "sc.w.rl\t" 1 } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f0b692a2e19..af0bf0c48d7 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1939,6 +1939,17 @@ proc check_effective_target_riscv_zfh { } { }] } +# Return 1 if the target arch supports the TSO memory ordering extension, +# 0 otherwise. Cache the result. + +proc check_effective_target_riscv_ztso { } { + return [check_no_compiler_messages riscv_ext_a assembly { + #ifndef __riscv_ztso + #error "Not __riscv_ztso" + #endif + }] +} + # Return 1 if we can execute code when using dg-add-options riscv_v proc check_effective_target_riscv_v_ok { } { @@ -2052,6 +2063,18 @@ proc add_options_for_riscv_zfh { flags } { return "$flags -march=[riscv_get_arch]_zfh" } +proc add_options_for_riscv_ztso { flags } { + if { [lsearch $flags -march=*] >= 0 } { + # If there are multiple -march flags, we have to adjust all of them. + set flags [regsub -all -- {(?:^|[[:space:]])-march=[[:alnum:]_.]*} $flags &_ztso ] + return [regsub -all -- {((?:^|[[:space:]])-march=[[:alnum:]_.]*_ztso[[:alnum:]_.]*)_ztso} $flags \\1 ] + } + if { [check_effective_target_riscv_ztso] } { + return "$flags" + } + return "$flags -march=[riscv_get_arch]_ztso" +} + # Return 1 if the target OS supports running SSE executables, 0 # otherwise. Cache the result.