From patchwork Mon Jul 3 11:07:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christoph_M=C3=BCllner?= X-Patchwork-Id: 115311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp437505vqx; Mon, 3 Jul 2023 04:08:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlHb0AmDO/6T9EQrwpWye2eajhF/uCkOuAgwaYAhwOf8dauAHauWe0U/8e6SwK7OKbdOzvob X-Received: by 2002:aa7:d40f:0:b0:51e:164c:b67e with SMTP id z15-20020aa7d40f000000b0051e164cb67emr1090578edq.0.1688382512426; Mon, 03 Jul 2023 04:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688382512; cv=none; d=google.com; s=arc-20160816; b=0c3p9E+SRK+fV3OZCj66jyvcI+iJGwdo/jnA/W3m9jrqLHQdVzUluGjfJe3ip1Czlh kGd7A/gChePDpfP8ZYUhtumoJuhtgGSijXENKgN9f9noXh4ce+oCTqOrDe/JdlzIk2QA +d/1tThwe3YiZ6Xe4oOyONgkRXSGXXYhIawCIZ4dR9pCwCOozqZs6SU33GSHpnhnlvmE PdpQvf1KHBsnhv5nC9rSKzgHiqH+7+/EK1n7k1oVgxAv1ND6Xej/Wvv6hhHeViMJ2+je cLj6BJmzxlGf7zwqP1Nr0y4JktFcAa6hCebd9sDnLQba90qbognB2LG4QrrK3pp5nFZ0 dQkA== 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:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=py5ISWfvqBhsB/P7IbX/15y/Mt8bLQ4DPOXRvcK9LnA=; fh=dxVEuucHo4OwiOFCXSg26wsCJ9MOEFJeK0sitzyyLqg=; b=I8Wt3UQTvolHJieA47R0B1LS2S/4NyHIHI/s/j6tv7Or1pwl4C4KxYi/smdnfWoCOT vRY39QEA/1y1B9fA8mTXeAkITKXER1aBWCZE4QXPdiyEPn86mM7UTR3gO+MR9KHzB8VH 7lO8nnqZacwWZZf/S+3jrPn5FPLkzvaDVHA96K+FA7nbevxe8ig92IKznfjbJI1EeJgc XdoCSp5DOYP7uNQCD86mtQTipn1LXEBthPBsDhFuUW94rBlgZcRzoufADRJNobvVHoOS aDK6KFlSebcEbCiW7izNRMyW2tXHPB+PgJLv6/bkIBW7WgrQBSCLXeDPvQg/+mEfc48G geEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=hwm0DDY6; 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 i14-20020a50fc0e000000b0051dec563f99si4402668edr.73.2023.07.03.04.08.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 04:08:32 -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=@vrull.eu header.s=google header.b=hwm0DDY6; 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 52F313857020 for ; Mon, 3 Jul 2023 11:08:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 47F613858C52 for ; Mon, 3 Jul 2023 11:07:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47F613858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-991da766865so522591566b.0 for ; Mon, 03 Jul 2023 04:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1688382466; x=1690974466; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=py5ISWfvqBhsB/P7IbX/15y/Mt8bLQ4DPOXRvcK9LnA=; b=hwm0DDY6z3sbMU0p8Odcu4Rb9OZVVq69mQkd6bxgzEIBSeMCJvLg6btyEIiqqtPsEZ FFBUU+pNexxylSa4Nyix2eRN7JCG6giqs8vLhrruzN+tHqYfCOSeKyYUsN4shjCobMrj L9QeMgy8oD7X7qoCsOAtN/hkoW4d42/cfVjmTmBTt47SH5cCIBhAkkWnEIGRnI2kVVpG AsJ1JTqoyogbh+hlGzow8MMxNzDJU2KrlVRNowrVdiQ1+jpWGUa5BPpz+FtA97bmiImh YlJzN5z83vL3aJeScB/sG+OIpwdaPui2R/vn3Wir0kQsjhyjc9jPyNAgVZOkI1JxEF7l G/7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688382466; x=1690974466; 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=py5ISWfvqBhsB/P7IbX/15y/Mt8bLQ4DPOXRvcK9LnA=; b=RoztJrTJVaLlmVNV5NwWNohVCyMavGm5/OZ/w1MT53VNCicVLbexd2MW9Da7NYphG2 TXqQ0pbWtmQFxLLNtqZPXz9imVh4VbazBxu3ZlgZ7CN2YF9AP5ibfkkbufIUurMEDw/v 7WcEmrqhJ+0pXLYzxZVGhVBfACdegnQjNCK/YjhRP4Vho1B/swsnqTEXqPl8GWUJHQDP LuI+gN58PO2H64jw7TTAm8bICpTCluzuT9uH2bt6U7WszR0+NbxGzJaVh21H9n1OEw9x AwL79+SnPNigf9fyrQaaBG73a8X0E8/vZK7GnpXNhieyMJegmBnkAJStdzZ5+77iLEYV UA/Q== X-Gm-Message-State: ABy/qLZhkOeoa9ihMKpadTzWIqPCAQ2johEuuj/ZzcLJm+I40UMrhXWG oAU1mFO/T2+P9OA24nUf+m0nxk6wd3NY4+uHrqs= X-Received: by 2002:a17:906:298d:b0:988:6491:98e1 with SMTP id x13-20020a170906298d00b00988649198e1mr6888361eje.42.1688382466463; Mon, 03 Jul 2023 04:07:46 -0700 (PDT) Received: from beast.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id lr3-20020a170906fb8300b00973f1cd586fsm11908023ejb.1.2023.07.03.04.07.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 04:07:45 -0700 (PDT) From: Christoph Muellner To: gcc-patches@gcc.gnu.org, Kito Cheng , Jeff Law , Jim Wilson , Palmer Dabbelt , Andrew Waterman , Philipp Tomsich Cc: Nelson Chu , Nathan Huckleberry , nhuck@pmull.org, =?utf-8?q?Christoph_M=C3=BCllner?= Subject: [PATCH v2] RISC-V: Add support for vector crypto extensions Date: Mon, 3 Jul 2023 13:07:42 +0200 Message-ID: <20230703110742.3134160-1-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_MANYTO, KAM_SHORT, 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?1770397381227099089?= X-GMAIL-MSGID: =?utf-8?q?1770397381227099089?= From: Christoph Müllner This series adds basic support for the vector crypto extensions: * Zvbb * Zvbc * Zvkg * Zvkned * Zvkhn[a,b] * Zvksed * Zvksh * Zvkn * Zvknc * Zvkng * Zvks * Zvksc * Zvksg * Zvkt This patch is based on the v20230620 version of the Vector Cryptography specification. The specification is frozen and can be found here: https://github.com/riscv/riscv-crypto/releases/tag/v20230620 Binutils support has been merged upstream a few days ago. All extensions come with tests for the feature test macros. gcc/ChangeLog: * common/config/riscv/riscv-common.cc: Add support for zvbb, zvbc, zvkg, zvkned, zvknha, zvknhb, zvksed, zvksh, zvkn, zvknc, zvkng, zvks, zvksc, zvksg, zvkt and the implied subsets. * config/riscv/arch-canonicalize: Add canonicalization info for zvkn, zvknc, zvkng, zvks, zvksc, zvksg. * config/riscv/riscv-opts.h (MASK_ZVBB): New macro. (MASK_ZVBC): Likewise. (TARGET_ZVBB): Likewise. (TARGET_ZVBC): Likewise. (MASK_ZVKG): Likewise. (MASK_ZVKNED): Likewise. (MASK_ZVKNHA): Likewise. (MASK_ZVKNHB): Likewise. (MASK_ZVKSED): Likewise. (MASK_ZVKSH): Likewise. (MASK_ZVKN): Likewise. (MASK_ZVKNC): Likewise. (MASK_ZVKNG): Likewise. (MASK_ZVKS): Likewise. (MASK_ZVKSC): Likewise. (MASK_ZVKSG): Likewise. (MASK_ZVKT): Likewise. (TARGET_ZVKG): Likewise. (TARGET_ZVKNED): Likewise. (TARGET_ZVKNHA): Likewise. (TARGET_ZVKNHB): Likewise. (TARGET_ZVKSED): Likewise. (TARGET_ZVKSH): Likewise. (TARGET_ZVKN): Likewise. (TARGET_ZVKNC): Likewise. (TARGET_ZVKNG): Likewise. (TARGET_ZVKS): Likewise. (TARGET_ZVKSC): Likewise. (TARGET_ZVKSG): Likewise. (TARGET_ZVKT): Likewise. * config/riscv/riscv.opt: Introduction of riscv_zv{b,k}_subext. gcc/testsuite/ChangeLog: * gcc.target/riscv/zvbb.c: New test. * gcc.target/riscv/zvbc.c: New test. * gcc.target/riscv/zvkg.c: New test. * gcc.target/riscv/zvkn-1.c: New test. * gcc.target/riscv/zvkn.c: New test. * gcc.target/riscv/zvknc-1.c: New test. * gcc.target/riscv/zvknc-2.c: New test. * gcc.target/riscv/zvknc.c: New test. * gcc.target/riscv/zvkned.c: New test. * gcc.target/riscv/zvkng-1.c: New test. * gcc.target/riscv/zvkng-2.c: New test. * gcc.target/riscv/zvkng.c: New test. * gcc.target/riscv/zvknha.c: New test. * gcc.target/riscv/zvknhb.c: New test. * gcc.target/riscv/zvks-1.c: New test. * gcc.target/riscv/zvks.c: New test. * gcc.target/riscv/zvksc-1.c: New test. * gcc.target/riscv/zvksc-2.c: New test. * gcc.target/riscv/zvksc.c: New test. * gcc.target/riscv/zvksed.c: New test. * gcc.target/riscv/zvksg-1.c: New test. * gcc.target/riscv/zvksg-2.c: New test. * gcc.target/riscv/zvksg.c: New test. * gcc.target/riscv/zvksh.c: New test. * gcc.target/riscv/zvkt.c: New test. Signed-off-by: Christoph Müllner --- Changes for v2: - Update patch for specification version v20230620 gcc/common/config/riscv/riscv-common.cc | 55 ++++++++++++++++++++++++ gcc/config/riscv/arch-canonicalize | 7 +++ gcc/config/riscv/riscv-opts.h | 34 +++++++++++++++ gcc/config/riscv/riscv.opt | 6 +++ gcc/testsuite/gcc.target/riscv/zvbb.c | 13 ++++++ gcc/testsuite/gcc.target/riscv/zvbc.c | 13 ++++++ gcc/testsuite/gcc.target/riscv/zvkg.c | 13 ++++++ gcc/testsuite/gcc.target/riscv/zvkn-1.c | 29 +++++++++++++ gcc/testsuite/gcc.target/riscv/zvkn.c | 29 +++++++++++++ gcc/testsuite/gcc.target/riscv/zvknc-1.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvknc-2.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvknc.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvkned.c | 13 ++++++ gcc/testsuite/gcc.target/riscv/zvkng-1.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvkng-2.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvkng.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvknha.c | 13 ++++++ gcc/testsuite/gcc.target/riscv/zvknhb.c | 13 ++++++ gcc/testsuite/gcc.target/riscv/zvks-1.c | 29 +++++++++++++ gcc/testsuite/gcc.target/riscv/zvks.c | 29 +++++++++++++ gcc/testsuite/gcc.target/riscv/zvksc-1.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvksc-2.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvksc.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvksed.c | 13 ++++++ gcc/testsuite/gcc.target/riscv/zvksg-1.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvksg-2.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvksg.c | 37 ++++++++++++++++ gcc/testsuite/gcc.target/riscv/zvksh.c | 13 ++++++ gcc/testsuite/gcc.target/riscv/zvkt.c | 13 ++++++ 29 files changed, 779 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/zvbb.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvbc.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvkg.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvkn-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvkn.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvknc-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvknc-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvknc.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvkned.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvkng-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvkng-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvkng.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvknha.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvknhb.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvks-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvks.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvksc-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvksc-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvksc.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvksed.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvksg-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvksg-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvksg.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvksh.c create mode 100644 gcc/testsuite/gcc.target/riscv/zvkt.c diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 3247d526c0a..6091d8f281b 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -102,6 +102,23 @@ static const riscv_implied_info_t riscv_implied_info[] = {"zvl32768b", "zvl16384b"}, {"zvl65536b", "zvl32768b"}, + {"zvkn", "zvkned"}, + {"zvkn", "zvknhb"}, + {"zvkn", "zvbb"}, + {"zvkn", "zvkt"}, + {"zvknc", "zvkn"}, + {"zvknc", "zvbc"}, + {"zvkng", "zvkn"}, + {"zvkng", "zvkg"}, + {"zvks", "zvksed"}, + {"zvks", "zvksh"}, + {"zvks", "zvbb"}, + {"zvks", "zvkt"}, + {"zvksc", "zvks"}, + {"zvksc", "zvbc"}, + {"zvksg", "zvks"}, + {"zvksg", "zvkg"}, + {"zfh", "zfhmin"}, {"zfhmin", "f"}, {"zvfhmin", "zve32f"}, @@ -204,6 +221,22 @@ static const struct riscv_ext_version riscv_ext_version_table[] = {"zve64f", ISA_SPEC_CLASS_NONE, 1, 0}, {"zve64d", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvbb", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvbc", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvkg", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvkned", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvknha", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvknhb", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvksed", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvksh", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvkn", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvknc", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvkng", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvks", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvksc", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvksg", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvkt", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvl32b", ISA_SPEC_CLASS_NONE, 1, 0}, {"zvl64b", ISA_SPEC_CLASS_NONE, 1, 0}, {"zvl128b", ISA_SPEC_CLASS_NONE, 1, 0}, @@ -250,6 +283,12 @@ static const struct riscv_ext_version riscv_combine_info[] = {"zk", ISA_SPEC_CLASS_NONE, 1, 0}, {"zkn", ISA_SPEC_CLASS_NONE, 1, 0}, {"zks", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvkn", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvknc", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvkng", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvks", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvksc", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zvksg", ISA_SPEC_CLASS_NONE, 1, 0}, /* Terminate the list. */ {NULL, ISA_SPEC_CLASS_NONE, 0, 0} }; @@ -1251,6 +1290,22 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] = {"zvfhmin", &gcc_options::x_riscv_vector_elen_flags, MASK_VECTOR_ELEN_FP_16}, {"zvfh", &gcc_options::x_riscv_vector_elen_flags, MASK_VECTOR_ELEN_FP_16}, + {"zvbb", &gcc_options::x_riscv_zvb_subext, MASK_ZVBB}, + {"zvbc", &gcc_options::x_riscv_zvb_subext, MASK_ZVBC}, + {"zvkg", &gcc_options::x_riscv_zvk_subext, MASK_ZVKG}, + {"zvkned", &gcc_options::x_riscv_zvk_subext, MASK_ZVKNED}, + {"zvknha", &gcc_options::x_riscv_zvk_subext, MASK_ZVKNHA}, + {"zvknhb", &gcc_options::x_riscv_zvk_subext, MASK_ZVKNHB}, + {"zvksed", &gcc_options::x_riscv_zvk_subext, MASK_ZVKSED}, + {"zvksh", &gcc_options::x_riscv_zvk_subext, MASK_ZVKSH}, + {"zvkn", &gcc_options::x_riscv_zvk_subext, MASK_ZVKN}, + {"zvknc", &gcc_options::x_riscv_zvk_subext, MASK_ZVKNC}, + {"zvkng", &gcc_options::x_riscv_zvk_subext, MASK_ZVKNG}, + {"zvks", &gcc_options::x_riscv_zvk_subext, MASK_ZVKS}, + {"zvksc", &gcc_options::x_riscv_zvk_subext, MASK_ZVKSC}, + {"zvksg", &gcc_options::x_riscv_zvk_subext, MASK_ZVKSG}, + {"zvkt", &gcc_options::x_riscv_zvk_subext, MASK_ZVKT}, + {"zvl32b", &gcc_options::x_riscv_zvl_flags, MASK_ZVL32B}, {"zvl64b", &gcc_options::x_riscv_zvl_flags, MASK_ZVL64B}, {"zvl128b", &gcc_options::x_riscv_zvl_flags, MASK_ZVL128B}, diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize index 490226beb0b..bbb9261bd87 100755 --- a/gcc/config/riscv/arch-canonicalize +++ b/gcc/config/riscv/arch-canonicalize @@ -68,6 +68,13 @@ IMPLIED_EXT = { "zvl16384b" : ["zvl8192b"], "zvl32768b" : ["zvl16384b"], "zvl65536b" : ["zvl32768b"], + + "zvkn" : ["zvkned", "zvknhb", "zvbb", "zvkt"], + "zvknc" : ["zvkn", "zvbc"], + "zvkng" : ["zvkn", "zvkg"], + "zvks" : ["zvksed", "zvksh", "zvbb", "zvkt"], + "zvksc" : ["zvks", "zvbc"], + "zvksg" : ["zvks", "zvkg"], } def arch_canonicalize(arch, isa_spec): diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index 208a557b8ff..cfcf608ea62 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -168,6 +168,40 @@ enum riscv_entity #define TARGET_VECTOR_ELEN_FP_16 \ ((riscv_vector_elen_flags & MASK_VECTOR_ELEN_FP_16) != 0) +#define MASK_ZVBB (1 << 0) +#define MASK_ZVBC (1 << 1) + +#define TARGET_ZVBB ((riscv_zvb_subext & MASK_ZVBB) != 0) +#define TARGET_ZVBC ((riscv_zvb_subext & MASK_ZVBC) != 0) + +#define MASK_ZVKG (1 << 0) +#define MASK_ZVKNED (1 << 1) +#define MASK_ZVKNHA (1 << 2) +#define MASK_ZVKNHB (1 << 3) +#define MASK_ZVKSED (1 << 4) +#define MASK_ZVKSH (1 << 5) +#define MASK_ZVKN (1 << 6) +#define MASK_ZVKNC (1 << 7) +#define MASK_ZVKNG (1 << 8) +#define MASK_ZVKS (1 << 9) +#define MASK_ZVKSC (1 << 10) +#define MASK_ZVKSG (1 << 11) +#define MASK_ZVKT (1 << 12) + +#define TARGET_ZVKG ((riscv_zvk_subext & MASK_ZVKG) != 0) +#define TARGET_ZVKNED ((riscv_zvk_subext & MASK_ZVKNED) != 0) +#define TARGET_ZVKNHA ((riscv_zvk_subext & MASK_ZVKNHA) != 0) +#define TARGET_ZVKNHB ((riscv_zvk_subext & MASK_ZVKNHB) != 0) +#define TARGET_ZVKSED ((riscv_zvk_subext & MASK_ZVKSED) != 0) +#define TARGET_ZVKSH ((riscv_zvk_subext & MASK_ZVKSH) != 0) +#define TARGET_ZVKN ((riscv_zvk_subext & MASK_ZVKN) != 0) +#define TARGET_ZVKNC ((riscv_zvk_subext & MASK_ZVKNC) != 0) +#define TARGET_ZVKNG ((riscv_zvk_subext & MASK_ZVKNG) != 0) +#define TARGET_ZVKS ((riscv_zvk_subext & MASK_ZVKS) != 0) +#define TARGET_ZVKSC ((riscv_zvk_subext & MASK_ZVKSC) != 0) +#define TARGET_ZVKSG ((riscv_zvk_subext & MASK_ZVKSG) != 0) +#define TARGET_ZVKT ((riscv_zvk_subext & MASK_ZVKT) != 0) + #define MASK_ZVL32B (1 << 0) #define MASK_ZVL64B (1 << 1) #define MASK_ZVL128B (1 << 2) diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt index 63d4710cb15..dd062f1c8bd 100644 --- a/gcc/config/riscv/riscv.opt +++ b/gcc/config/riscv/riscv.opt @@ -223,6 +223,12 @@ int riscv_vector_elen_flags TargetVariable int riscv_zvl_flags +TargetVariable +int riscv_zvb_subext + +TargetVariable +int riscv_zvk_subext + TargetVariable int riscv_zicmo_subext diff --git a/gcc/testsuite/gcc.target/riscv/zvbb.c b/gcc/testsuite/gcc.target/riscv/zvbb.c new file mode 100644 index 00000000000..b592f56f6cf --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvbb.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvbb" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvbb" { target { rv32 } } } */ + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvbc.c b/gcc/testsuite/gcc.target/riscv/zvbc.c new file mode 100644 index 00000000000..37239fa91b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvbc.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvbc" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvbc" { target { rv32 } } } */ + +#ifndef __riscv_zvbc +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvkg.c b/gcc/testsuite/gcc.target/riscv/zvkg.c new file mode 100644 index 00000000000..1e2a05aa1d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvkg.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkg" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkg" { target { rv32 } } } */ + +#ifndef __riscv_zvkg +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvkn-1.c b/gcc/testsuite/gcc.target/riscv/zvkn-1.c new file mode 100644 index 00000000000..83935b06832 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvkn-1.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkned_zvknhb_zvbb_zvkt" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkned_zvknhb_zvbb_zvkt" { target { rv32 } } } */ + +#ifndef __riscv_zvkn +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvkn.c b/gcc/testsuite/gcc.target/riscv/zvkn.c new file mode 100644 index 00000000000..af3db40c8f6 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvkn.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkn" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkn" { target { rv32 } } } */ + +#ifndef __riscv_zvkn +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvknc-1.c b/gcc/testsuite/gcc.target/riscv/zvknc-1.c new file mode 100644 index 00000000000..eca27670895 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvknc-1.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkned_zvknhb_zvbb_zvkt_zvbc" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkned_zvknhb_zvbb_zvkt_zvbc" { target { rv32 } } } */ + +#ifndef __riscv_zvknc +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkn +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbc +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvknc-2.c b/gcc/testsuite/gcc.target/riscv/zvknc-2.c new file mode 100644 index 00000000000..e77343a27f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvknc-2.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkn_zvbc" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkn_zvbc" { target { rv32 } } } */ + +#ifndef __riscv_zvknc +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkn +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbc +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvknc.c b/gcc/testsuite/gcc.target/riscv/zvknc.c new file mode 100644 index 00000000000..10bd471da45 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvknc.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvknc" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvknc" { target { rv32 } } } */ + +#ifndef __riscv_zvknc +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkn +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbc +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvkned.c b/gcc/testsuite/gcc.target/riscv/zvkned.c new file mode 100644 index 00000000000..fcdc4b45761 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvkned.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkned" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkned" { target { rv32 } } } */ + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvkng-1.c b/gcc/testsuite/gcc.target/riscv/zvkng-1.c new file mode 100644 index 00000000000..f4f3cc8e417 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvkng-1.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkned_zvknhb_zvbb_zvkt_zvkg" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkned_zvknhb_zvbb_zvkt_zvkg" { target { rv32 } } } */ + +#ifndef __riscv_zvkng +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkn +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkg +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvkng-2.c b/gcc/testsuite/gcc.target/riscv/zvkng-2.c new file mode 100644 index 00000000000..2631c1a1c25 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvkng-2.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkn_zvkg" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkn_zvkg" { target { rv32 } } } */ + +#ifndef __riscv_zvkng +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkn +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkg +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvkng.c b/gcc/testsuite/gcc.target/riscv/zvkng.c new file mode 100644 index 00000000000..e6c950e9323 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvkng.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkng" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkng" { target { rv32 } } } */ + +#ifndef __riscv_zvkng +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkn +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkned +#error Feature macro not defined +#endif + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkg +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvknha.c b/gcc/testsuite/gcc.target/riscv/zvknha.c new file mode 100644 index 00000000000..1275f9d11c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvknha.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvknha" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvknha" { target { rv32 } } } */ + +#ifndef __riscv_zvknha +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvknhb.c b/gcc/testsuite/gcc.target/riscv/zvknhb.c new file mode 100644 index 00000000000..669ff019149 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvknhb.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvknhb" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvknhb" { target { rv32 } } } */ + +#ifndef __riscv_zvknhb +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvks-1.c b/gcc/testsuite/gcc.target/riscv/zvks-1.c new file mode 100644 index 00000000000..28ad26af1c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvks-1.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvksed_zvksh_zvbb_zvkt" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvksed_zvksh_zvbb_zvkt" { target { rv32 } } } */ + +#ifndef __riscv_zvks +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvks.c b/gcc/testsuite/gcc.target/riscv/zvks.c new file mode 100644 index 00000000000..a48c9186d5e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvks.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvks" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvks" { target { rv32 } } } */ + +#ifndef __riscv_zvks +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvksc-1.c b/gcc/testsuite/gcc.target/riscv/zvksc-1.c new file mode 100644 index 00000000000..72d9676e68c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvksc-1.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvksed_zvksh_zvbb_zvkt_zvbc" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvksed_zvksh_zvbb_zvkt_zvbc" { target { rv32 } } } */ + +#ifndef __riscv_zvksc +#error Feature macro not defined +#endif + +#ifndef __riscv_zvks +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbc +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvksc-2.c b/gcc/testsuite/gcc.target/riscv/zvksc-2.c new file mode 100644 index 00000000000..c78b4fe9077 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvksc-2.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvks_zvbc" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvks_zvbc" { target { rv32 } } } */ + +#ifndef __riscv_zvksc +#error Feature macro not defined +#endif + +#ifndef __riscv_zvks +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbc +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvksc.c b/gcc/testsuite/gcc.target/riscv/zvksc.c new file mode 100644 index 00000000000..fb61561a2af --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvksc.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvksc" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvksc" { target { rv32 } } } */ + +#ifndef __riscv_zvksc +#error Feature macro not defined +#endif + +#ifndef __riscv_zvks +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbc +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvksed.c b/gcc/testsuite/gcc.target/riscv/zvksed.c new file mode 100644 index 00000000000..439b546bb8a --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvksed.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvksed" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvksed" { target { rv32 } } } */ + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvksg-1.c b/gcc/testsuite/gcc.target/riscv/zvksg-1.c new file mode 100644 index 00000000000..8cbd0331168 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvksg-1.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvksed_zvksh_zvbb_zvkt_zvkg" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvksed_zvksh_zvbb_zvkt_zvkg" { target { rv32 } } } */ + +#ifndef __riscv_zvksg +#error Feature macro not defined +#endif + +#ifndef __riscv_zvks +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkg +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvksg-2.c b/gcc/testsuite/gcc.target/riscv/zvksg-2.c new file mode 100644 index 00000000000..d56c47e897c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvksg-2.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvks_zvkg" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvks_zvkg" { target { rv32 } } } */ + +#ifndef __riscv_zvksg +#error Feature macro not defined +#endif + +#ifndef __riscv_zvks +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkg +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvksg.c b/gcc/testsuite/gcc.target/riscv/zvksg.c new file mode 100644 index 00000000000..44dffb41395 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvksg.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvksg" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvksg" { target { rv32 } } } */ + +#ifndef __riscv_zvksg +#error Feature macro not defined +#endif + +#ifndef __riscv_zvks +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksed +#error Feature macro not defined +#endif + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +#ifndef __riscv_zvbb +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +#ifndef __riscv_zvkg +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvksh.c b/gcc/testsuite/gcc.target/riscv/zvksh.c new file mode 100644 index 00000000000..5359ca50281 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvksh.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvksh" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvksh" { target { rv32 } } } */ + +#ifndef __riscv_zvksh +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/riscv/zvkt.c b/gcc/testsuite/gcc.target/riscv/zvkt.c new file mode 100644 index 00000000000..49822b75738 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zvkt.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zvkt" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zvkt" { target { rv32 } } } */ + +#ifndef __riscv_zvkt +#error Feature macro not defined +#endif + +int +foo (int a) +{ + return a; +}