Message ID | 20231220122055.343-1-cooper.joshua@linux.alibaba.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2596107dyi; Wed, 20 Dec 2023 04:22:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHd66YGvfa2UpIYHP/KtpnHCSqKaqZW5LA78P4OkWyOPNl1vPgsI0IidAeUdimzkG7xzvAj X-Received: by 2002:a05:622a:a:b0:427:8376:a2b with SMTP id x10-20020a05622a000a00b0042783760a2bmr2053849qtw.119.1703074921437; Wed, 20 Dec 2023 04:22:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703074921; cv=pass; d=google.com; s=arc-20160816; b=vtD9W9Xp+/gZ8y7FWQCRvtK7/YGJk7uq87vn0i58dlAdoAfOlHl3++/aygsLQxdLeC X1aJCnyyPH87JC5cD1gnPT4v2WgxhM6GxvzRRsXNdEZQNr4iOLMPzx44Q23Rwch2+BUN nmJQUkPcMahQS6srYi5POh+ASwdFn/4mgxOI0fN3aj/CMK+OHXKGvexYrBZYWv5F9t2S yTqizPzupxYGz8ICOIuFHkEyUbtskOujCicATDbZG7pe6HfMjaysG61SzO/7+wi3Pa7/ 6j4onaU2xa5vcfN+TOrP9/+jiC1cWa9Bhe8FMqJt7hhhuJcjsA4QV5qBCHN32HVvNmpS Ugkw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:arc-filter:dmarc-filter:delivered-to; bh=Cbmcu641rtetPE8DFR93MLASnfd1Dv9p+joPO8pGhNs=; fh=TRVAIDsvPpet1cO/KeaYdiXE7OYydCC57sZbOkt55RI=; b=pluhnhDnJOJWAOKr0TiUA+67wODkiN37SGTdqbGr/9dx7FWua15YU0kXwAEiNAiBGY PW/ZKPsqytL/V6D7jWz4xIPlRFq/smeQPjqKbtftlk1Hve+Aihpt1l2PLd0JstXv2CkA HENHxMgiavAtD/MPgNRCQuc69YajcWk4FJKOiWufMxXQPKYKDBisGKmCmSojSIm5Uxtv uEwpl2uwSa3QoxxKZn4LqTruT5z2BL6SIEpXx+Mg2pdg6Q1nWmKJKNMqkN9Bby7JSkCE GlBYHNi/Y33GC2u/5q6Ncd/YTDrjCxczUY72dyyxUM8oWLMSQJgz1RIw12geHJrDPkPQ Pugw== ARC-Authentication-Results: i=2; mx.google.com; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d14-20020ac85ace000000b00425f05f63e9si1906415qtd.68.2023.12.20.04.22.01 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 04:22:01 -0800 (PST) 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; 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 28E2A3861012 for <ouuuleilei@gmail.com>; Wed, 20 Dec 2023 12:22:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by sourceware.org (Postfix) with ESMTPS id 10C763858C2C for <gcc-patches@gcc.gnu.org>; Wed, 20 Dec 2023 12:21:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10C763858C2C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.alibaba.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 10C763858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=115.124.30.97 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703074898; cv=none; b=qiEEI5L9XU+PBZ0fqhYdC/wrzgWrVHpp4kVNs86Tqf7UiAkLm7ZciJS/EGPP7PIiJ7siPC1LBOfLiwrPI8buONZVFCFZDoh5uALablKZ4tnoo4w+EUsRUq7X+ra1SDlN+lHr89TQDdmusVseUxtt7j/1QJVnc0Mktdqop/iL27M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703074898; c=relaxed/simple; bh=FmcS22HJSVGJzh/PZNhgnecjEhuewHRnPv+KAsVkBBk=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=feJuBcO7VShl3cluaquN3XEZSzK7oM8iHy3SO/m39RlqjtVlbMPSC7408SPPEle+fCQMlpHTXuUwI14rtIPH0kFg82BVNHT886vkxAWwncBz8HpIw2GC9yPoDu9lt5kEZ03UlSRGkwOp0yoBjp6oTD3brtpyCsx4SqdiPbhKjq0= ARC-Authentication-Results: i=1; server2.sourceware.org X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R141e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046051; MF=cooper.joshua@linux.alibaba.com; NM=1; PH=DS; RN=11; SR=0; TI=SMTPD_---0VyuPMyS_1703074886; Received: from localhost.localdomain(mailfrom:cooper.joshua@linux.alibaba.com fp:SMTPD_---0VyuPMyS_1703074886) by smtp.aliyun-inc.com; Wed, 20 Dec 2023 20:21:31 +0800 From: "Jun Sha (Joshua)" <cooper.joshua@linux.alibaba.com> To: gcc-patches@gcc.gnu.org Cc: jim.wilson.gcc@gmail.com, palmer@dabbelt.com, andrew@sifive.com, philipp.tomsich@vrull.eu, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu, juzhe.zhong@rivai.ai, "Jun Sha (Joshua)" <cooper.joshua@linux.alibaba.com>, Jin Ma <jinma@linux.alibaba.com>, Xianmiao Qu <cooper.qu@linux.alibaba.com> Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension Date: Wed, 20 Dec 2023 20:20:55 +0800 Message-Id: <20231220122055.343-1-cooper.joshua@linux.alibaba.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20231118042258.3545-1-cooper.joshua@linux.alibaba.com> References: <20231118042258.3545-1-cooper.joshua@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785803488546091385 X-GMAIL-MSGID: 1785803488546091385 |
Series |
RISC-V: Support XTheadVector extension
|
|
Message
joshua
Dec. 20, 2023, 12:20 p.m. UTC
This patch series presents gcc implementation of the XTheadVector extension [1]. [1] https://github.com/T-head-Semi/thead-extension-spec/ For some vector patterns that cannot be avoided, we use "!TARGET_XTHEADVECTOR" to disable them in order not to generate instructions that xtheadvector does not support, causing 36 changes in vector.md. For the th. prefix issue, we use current_output_insn and the ASM_OUTPUT_OPCODE hook instead of directly modifying patterns in vector.md. We have run the GCC test suite and can confirm that there are no regressions. All the test results can be found in the following links, Run without xtheadvector: https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html Run with xtheadvector: https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html Furthermore, we have run the tests in https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples, and all the tests passed. Co-authored-by: Jin Ma <jinma@linux.alibaba.com> Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com> Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu> RISC-V: Refactor riscv-vector-builtins-bases.cc RISC-V: Split csr_operand in predicates.md for vector patterns RISC-V: Introduce XTheadVector as a subset of V1.0.0 RISC-V: Adds the prefix "th." for the instructions of XTheadVector RISC-V: Handle differences between XTheadvector and Vector RISC-V: Add support for xtheadvector-specific intrinsics --- gcc/common/config/riscv/riscv-common.cc | 23 + gcc/config.gcc | 4 +- gcc/config/riscv/autovec.md | 2 +- gcc/config/riscv/predicates.md | 8 +- gcc/config/riscv/riscv-c.cc | 8 +- gcc/config/riscv/riscv-protos.h | 1 + gcc/config/riscv/riscv-string.cc | 3 + gcc/config/riscv/riscv-v.cc | 13 +- .../riscv/riscv-vector-builtins-bases.cc | 18 +- .../riscv/riscv-vector-builtins-bases.h | 19 + .../riscv/riscv-vector-builtins-shapes.cc | 149 + .../riscv/riscv-vector-builtins-shapes.h | 3 + .../riscv/riscv-vector-builtins-types.def | 120 + gcc/config/riscv/riscv-vector-builtins.cc | 315 +- gcc/config/riscv/riscv-vector-builtins.h | 5 +- gcc/config/riscv/riscv-vector-switch.def | 150 +- gcc/config/riscv/riscv.cc | 46 +- gcc/config/riscv/riscv.h | 4 + gcc/config/riscv/riscv.opt | 2 + gcc/config/riscv/riscv_th_vector.h | 49 + gcc/config/riscv/t-riscv | 16 + .../riscv/thead-vector-builtins-functions.def | 659 ++++ gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++ gcc/config/riscv/thead-vector-builtins.h | 123 + gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++ gcc/config/riscv/vector-iterators.md | 186 +- gcc/config/riscv/vector.md | 44 +- .../riscv/predef-__riscv_th_v_intrinsic.c | 11 + .../gcc.target/riscv/rvv/base/abi-1.c | 2 +- .../gcc.target/riscv/rvv/base/pragma-1.c | 2 +- .../gcc.target/riscv/rvv/xtheadvector.c | 13 + .../riscv/rvv/xtheadvector/prefix.c | 12 + .../riscv/rvv/xtheadvector/vlb-vsb.c | 68 + .../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 + .../riscv/rvv/xtheadvector/vlh-vsh.c | 68 + .../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 + .../riscv/rvv/xtheadvector/vlw-vsw.c | 68 + .../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 + gcc/testsuite/lib/target-supports.exp | 12 + 39 files changed, 5931 insertions(+), 213 deletions(-) create mode 100644 gcc/config/riscv/riscv_th_vector.h create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def create mode 100644 gcc/config/riscv/thead-vector-builtins.cc create mode 100644 gcc/config/riscv/thead-vector-builtins.h create mode 100644 gcc/config/riscv/thead-vector.md create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c
Comments
>> So rather than looking at the mode, would it make more sense to have an >> attribute (or re-use an existing attribute) to identify which opcodes >> are going to need prefixing? We've got access to the INSN via >> current_output_insn. So we can lookup attributes trivially. Yes, I totally aggree with Jeff's idea. We have addes many attributes for each RVV instructions. For example, VSETVL PASS is highly depending on those attribute to do the optimizations. Btw, I have review the full patch and I am gonna give more comprehensive comments in cover letter. juzhe.zhong@rivai.ai From: Jeff Law Date: 2023-12-21 02:22 To: Jun Sha (Joshua); gcc-patches CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; juzhe.zhong; Jin Ma; Xianmiao Qu Subject: Re: [PATCH v3 4/6] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. On 12/20/23 05:32, Jun Sha (Joshua) wrote: > This patch adds th. prefix to all XTheadVector instructions by > implementing new assembly output functions. > > gcc/ChangeLog: > > * config/riscv/riscv-protos.h > (riscv_asm_output_opcode): New function. > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > Co-authored-by: Jin Ma <jinma@linux.alibaba.com> > Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com> > Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu> > --- > gcc/config/riscv/riscv-protos.h | 1 + > gcc/config/riscv/riscv.cc | 26 +++++++++++++++++++ > gcc/config/riscv/riscv.h | 4 +++ > .../riscv/rvv/xtheadvector/prefix.c | 12 +++++++++ > 4 files changed, 43 insertions(+) > create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h > index eaee53ce94e..f0eee71a18a 100644 > --- a/gcc/config/riscv/riscv-protos.h > +++ b/gcc/config/riscv/riscv-protos.h > @@ -101,6 +101,7 @@ struct riscv_address_info { > }; > > /* Routines implemented in riscv.cc. */ > +extern void riscv_asm_output_opcode(FILE *asm_out_file, const char *p); > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > extern int riscv_float_const_rtx_index_for_fli (rtx); > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > index 8ae65760b6e..d3010bed8d8 100644 > --- a/gcc/config/riscv/riscv.cc > +++ b/gcc/config/riscv/riscv.cc > @@ -5595,6 +5595,32 @@ riscv_get_v_regno_alignment (machine_mode mode) > return lmul; > } > > +void > +riscv_asm_output_opcode(FILE *asm_out_file, const char *p) Needs a function comment. There's several examples in this file you can use to see the style we commonly use. And a minor formatting nit, always put a space between a function name and an open paren. > +{ > + if (!TARGET_XTHEADVECTOR) > + return; > + > + if (current_output_insn == NULL_RTX) > + return; > + > + /* We need to handle the 'vset' special case here since it cannot > + be controlled by vector mode. */ > + if (!strncmp (p, "vset", 4)) > + { > + fputs ("th.", asm_out_file); > + return; > + } > + > + subrtx_iterator::array_type array; > + FOR_EACH_SUBRTX (iter, array, PATTERN (current_output_insn), ALL) > + if (*iter && riscv_v_ext_mode_p (GET_MODE (*iter)) && p[0] == 'v') > + { > + fputs ("th.", asm_out_file); > + return; > + } > +} So rather than looking at the mode, would it make more sense to have an attribute (or re-use an existing attribute) to identify which opcodes are going to need prefixing? We've got access to the INSN via current_output_insn. So we can lookup attributes trivially. This is a question, not a demand -- I'm looking for a solution that's going to be reliable with minimal effort going forward. jeff
Hi, Joshua.
Thanks for working hard on clean up codes and support tons of work on theadvector.
After fully review this patch, I understand you have 3 kinds of theadvector intrinsics from the codebase of current RVV1.0 GCC.
1). instructions that can leverage all current codes of RVV1.0 intrinsic with simply adding "th." prefix directly.
2). instructions that leverage current MD patterns but with some tweak and patterns copy since they are not simply added "th.".
3). new instructions that current RVV1.0 doesn't have like vlb instructions.
Overal, 1) and 3) look reasonable to me. But 2) need me some time to figure out the better way to do that (Current this patch with copying patterns is not approach I like)
So, I hope you can break this big patch into 3 different series patches.
1. Support partial theadvector instructions which leverage directly from current RVV1.0 with simple adding "th." prefix.
2. Support totally different name theadvector instructions but share same patterns as RVV1.0 instructions.
3. Support new headvector instructions like vlib...etc.
I think 1 and 3 separate patches can be quickly merged after my more details reviewed and approved in the following patches you send like V4 ?.
For 2, it's a bit more complicate, but I think we can support like ARM and other targets, use ASM targethook to rewrite the whole string of the instructions.
For example, like strided load/store, you can know this instructions from attribute:
(set_attr "type" "vlds")
juzhe.zhong@rivai.ai
From: Jun Sha (Joshua)
Date: 2023-12-20 20:20
To: gcc-patches
CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner; juzhe.zhong; Jun Sha (Joshua); Jin Ma; Xianmiao Qu
Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
This patch series presents gcc implementation of the XTheadVector
extension [1].
[1] https://github.com/T-head-Semi/thead-extension-spec/
For some vector patterns that cannot be avoided, we use
"!TARGET_XTHEADVECTOR" to disable them in order not to
generate instructions that xtheadvector does not support,
causing 36 changes in vector.md.
For the th. prefix issue, we use current_output_insn and
the ASM_OUTPUT_OPCODE hook instead of directly modifying
patterns in vector.md.
We have run the GCC test suite and can confirm that there
are no regressions.
All the test results can be found in the following links,
Run without xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html
Run with xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html
Furthermore, we have run the tests in
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples,
and all the tests passed.
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
RISC-V: Refactor riscv-vector-builtins-bases.cc
RISC-V: Split csr_operand in predicates.md for vector patterns
RISC-V: Introduce XTheadVector as a subset of V1.0.0
RISC-V: Adds the prefix "th." for the instructions of XTheadVector
RISC-V: Handle differences between XTheadvector and Vector
RISC-V: Add support for xtheadvector-specific intrinsics
---
gcc/common/config/riscv/riscv-common.cc | 23 +
gcc/config.gcc | 4 +-
gcc/config/riscv/autovec.md | 2 +-
gcc/config/riscv/predicates.md | 8 +-
gcc/config/riscv/riscv-c.cc | 8 +-
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv-string.cc | 3 +
gcc/config/riscv/riscv-v.cc | 13 +-
.../riscv/riscv-vector-builtins-bases.cc | 18 +-
.../riscv/riscv-vector-builtins-bases.h | 19 +
.../riscv/riscv-vector-builtins-shapes.cc | 149 +
.../riscv/riscv-vector-builtins-shapes.h | 3 +
.../riscv/riscv-vector-builtins-types.def | 120 +
gcc/config/riscv/riscv-vector-builtins.cc | 315 +-
gcc/config/riscv/riscv-vector-builtins.h | 5 +-
gcc/config/riscv/riscv-vector-switch.def | 150 +-
gcc/config/riscv/riscv.cc | 46 +-
gcc/config/riscv/riscv.h | 4 +
gcc/config/riscv/riscv.opt | 2 +
gcc/config/riscv/riscv_th_vector.h | 49 +
gcc/config/riscv/t-riscv | 16 +
.../riscv/thead-vector-builtins-functions.def | 659 ++++
gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++
gcc/config/riscv/thead-vector-builtins.h | 123 +
gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++
gcc/config/riscv/vector-iterators.md | 186 +-
gcc/config/riscv/vector.md | 44 +-
.../riscv/predef-__riscv_th_v_intrinsic.c | 11 +
.../gcc.target/riscv/rvv/base/abi-1.c | 2 +-
.../gcc.target/riscv/rvv/base/pragma-1.c | 2 +-
.../gcc.target/riscv/rvv/xtheadvector.c | 13 +
.../riscv/rvv/xtheadvector/prefix.c | 12 +
.../riscv/rvv/xtheadvector/vlb-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlh-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlw-vsw.c | 68 +
.../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 +
gcc/testsuite/lib/target-supports.exp | 12 +
39 files changed, 5931 insertions(+), 213 deletions(-)
create mode 100644 gcc/config/riscv/riscv_th_vector.h
create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def
create mode 100644 gcc/config/riscv/thead-vector-builtins.cc
create mode 100644 gcc/config/riscv/thead-vector-builtins.h
create mode 100644 gcc/config/riscv/thead-vector.md
create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c
Btw, rv32/rv64gc or rv32/rv64 gcv testing is not enough.
We need full coverage testing, since we always commit patch after no regression testing on full coverage testing:
with these following configurations:
-march=rv[32/64]gc_zve32f_zvfh_zfh
-march=rv[32/64]gc_zve64d_zvfh_zfh
-march=rv[32/64]gcv_zvfh_zfh
-march=rv[32/64]gcv_zvl256b_zvfh_zfh
-march=rv[32/64]gcv_zvl512b_zvfh_zfh
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-lmul=m2
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-lmul=m4
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-lmul=m8
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-lmul=dynamic
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-lmul=m2
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-lmul=m4
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-lmul=m8
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-lmul=dynamic
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-lmul=m2
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-lmul=m4
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-lmul=m8
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-lmul=dynamic
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-lmul=m2
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-lmul=m4
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-lmul=m8
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-lmul=dynamic
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-lmul=m2
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-lmul=m4
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-lmul=m8
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-lmul=dynamic
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-lmul=m2
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-lmul=m4
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-lmul=m8
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-lmul=dynamic
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-lmul=m2 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-lmul=m4 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-lmul=m8 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve32f_zvfh_zfh --param=riscv-autovec-lmul=dynamic --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-lmul=m2 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-lmul=m4 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-lmul=m8 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gc_zve64d_zvfh_zfh --param=riscv-autovec-lmul=dynamic --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-lmul=m2 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-lmul=m4 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-lmul=m8 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvfh_zfh --param=riscv-autovec-lmul=dynamic --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-lmul=m2 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-lmul=m4 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-lmul=m8 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl256b_zvfh_zfh --param=riscv-autovec-lmul=dynamic --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-lmul=m2 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-lmul=m4 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-lmul=m8 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl512b_zvfh_zfh --param=riscv-autovec-lmul=dynamic --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-lmul=m2 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-lmul=m4 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-lmul=m8 --param=riscv-autovec-preference=fixed-vlmax
-march=rv[32/64]gcv_zvl1024b_zvfh_zfh --param=riscv-autovec-lmul=dynamic --param=riscv-autovec-preference=fixed-vlmax
You can learn more how to run these testing with email to pan2.li@intel.com
juzhe.zhong@rivai.ai
From: Jun Sha (Joshua)
Date: 2023-12-20 20:20
To: gcc-patches
CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner; juzhe.zhong; Jun Sha (Joshua); Jin Ma; Xianmiao Qu
Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
This patch series presents gcc implementation of the XTheadVector
extension [1].
[1] https://github.com/T-head-Semi/thead-extension-spec/
For some vector patterns that cannot be avoided, we use
"!TARGET_XTHEADVECTOR" to disable them in order not to
generate instructions that xtheadvector does not support,
causing 36 changes in vector.md.
For the th. prefix issue, we use current_output_insn and
the ASM_OUTPUT_OPCODE hook instead of directly modifying
patterns in vector.md.
We have run the GCC test suite and can confirm that there
are no regressions.
All the test results can be found in the following links,
Run without xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html
Run with xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html
Furthermore, we have run the tests in
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples,
and all the tests passed.
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
RISC-V: Refactor riscv-vector-builtins-bases.cc
RISC-V: Split csr_operand in predicates.md for vector patterns
RISC-V: Introduce XTheadVector as a subset of V1.0.0
RISC-V: Adds the prefix "th." for the instructions of XTheadVector
RISC-V: Handle differences between XTheadvector and Vector
RISC-V: Add support for xtheadvector-specific intrinsics
---
gcc/common/config/riscv/riscv-common.cc | 23 +
gcc/config.gcc | 4 +-
gcc/config/riscv/autovec.md | 2 +-
gcc/config/riscv/predicates.md | 8 +-
gcc/config/riscv/riscv-c.cc | 8 +-
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv-string.cc | 3 +
gcc/config/riscv/riscv-v.cc | 13 +-
.../riscv/riscv-vector-builtins-bases.cc | 18 +-
.../riscv/riscv-vector-builtins-bases.h | 19 +
.../riscv/riscv-vector-builtins-shapes.cc | 149 +
.../riscv/riscv-vector-builtins-shapes.h | 3 +
.../riscv/riscv-vector-builtins-types.def | 120 +
gcc/config/riscv/riscv-vector-builtins.cc | 315 +-
gcc/config/riscv/riscv-vector-builtins.h | 5 +-
gcc/config/riscv/riscv-vector-switch.def | 150 +-
gcc/config/riscv/riscv.cc | 46 +-
gcc/config/riscv/riscv.h | 4 +
gcc/config/riscv/riscv.opt | 2 +
gcc/config/riscv/riscv_th_vector.h | 49 +
gcc/config/riscv/t-riscv | 16 +
.../riscv/thead-vector-builtins-functions.def | 659 ++++
gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++
gcc/config/riscv/thead-vector-builtins.h | 123 +
gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++
gcc/config/riscv/vector-iterators.md | 186 +-
gcc/config/riscv/vector.md | 44 +-
.../riscv/predef-__riscv_th_v_intrinsic.c | 11 +
.../gcc.target/riscv/rvv/base/abi-1.c | 2 +-
.../gcc.target/riscv/rvv/base/pragma-1.c | 2 +-
.../gcc.target/riscv/rvv/xtheadvector.c | 13 +
.../riscv/rvv/xtheadvector/prefix.c | 12 +
.../riscv/rvv/xtheadvector/vlb-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlh-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlw-vsw.c | 68 +
.../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 +
gcc/testsuite/lib/target-supports.exp | 12 +
39 files changed, 5931 insertions(+), 213 deletions(-)
create mode 100644 gcc/config/riscv/riscv_th_vector.h
create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def
create mode 100644 gcc/config/riscv/thead-vector-builtins.cc
create mode 100644 gcc/config/riscv/thead-vector-builtins.h
create mode 100644 gcc/config/riscv/thead-vector.md
create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c
On 12/20/23 16:08, 钟居哲 wrote: > Btw, rv32/rv64gc or rv32/rv64 gcv testing is not enough. > > We need full coverage testing, since we always commit patch after no > regression testing on full coverage testing: No. It is unreasonable to require this large of test matrix for the vast majority if contributions. thead should be able to pick a reasonable set that provides a degree of coverage, but they don't need to test all those configurations. jeff
OK. Sounds reasonable. But from my side, I used to commit patches after full coverage testing. juzhe.zhong@rivai.ai From: Jeff Law Date: 2023-12-21 11:28 To: 钟居哲; cooper.joshua; gcc-patches CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Christoph Müllner; jinma; Cooper Qu Subject: Re: [PATCH v3 0/6] RISC-V: Support XTheadVector extension On 12/20/23 16:08, 钟居哲 wrote: > Btw, rv32/rv64gc or rv32/rv64 gcv testing is not enough. > > We need full coverage testing, since we always commit patch after no > regression testing on full coverage testing: No. It is unreasonable to require this large of test matrix for the vast majority if contributions. thead should be able to pick a reasonable set that provides a degree of coverage, but they don't need to test all those configurations. jeff
On 12/20/23 20:30, juzhe.zhong@rivai.ai wrote: > OK. Sounds reasonable. > > But from my side, I used to commit patches after full coverage testing. Understood. And it's appreciated -- the code you're doing hits a wide variety of configurations, so the wider testing is probably applicable. Ideally the thead vector bits need reasonable testing to make sure they don't totally break the standard RVV support. So for something like the final scheme to add the "th." prefix I'd expect they can get away with just rv64gcv. WHile there is a chance that'll miss something, the odds are pretty low that a bug will be uncovered for each additional configuration tested beyond the first. In contrast if they needed to make a structural changes that are more than adding a path for thead's vector unit, then we might reasonably ask for a deeper test of that specific patch (perhaps even suggesting the configurations most likely affected and thus which need to be tested). The key being we want to use time wisely and testing dozens of multilibs for each change isn't really reasonable. It's always a delicate balance to articulate the right level of testing because the "right" level can vary based on each engineer's risk assessment of a particular change. Jeff
On 12/20/23 15:48, 钟居哲 wrote: > >> So rather than looking at the mode, would it make more sense to have an >>>attribute (or re-use an existing attribute) to identify which opcodes >>>are going to need prefixing? We've got access to the INSN via >>>current_output_insn. So we can lookup attributes trivially. > > Yes, I totally aggree with Jeff's idea. We have addes many attributes > for each RVV instructions. > For example, VSETVL PASS is highly depending on those attribute to do > the optimizations. Also note that with attributes, we can potentially even deal with cases where some alternatives need special handling while other alternatives simply aren't available with the thead extension. Not sure if that's going to be needed or not, but it's worth remembering. Jeff
Why not just check the prefix is 'v'? I don't think xtheadvector able to work with other vector stuffs like vector crypto or any other new vector stuffs, then we don't need extra attribute. On Thu, Dec 21, 2023 at 12:42 PM Jeff Law <jeffreyalaw@gmail.com> wrote: > > > > On 12/20/23 15:48, 钟居哲 wrote: > > >> So rather than looking at the mode, would it make more sense to have an > >>>attribute (or re-use an existing attribute) to identify which opcodes > >>>are going to need prefixing? We've got access to the INSN via > >>>current_output_insn. So we can lookup attributes trivially. > > > > Yes, I totally aggree with Jeff's idea. We have addes many attributes > > for each RVV instructions. > > For example, VSETVL PASS is highly depending on those attribute to do > > the optimizations. > Also note that with attributes, we can potentially even deal with cases > where some alternatives need special handling while other alternatives > simply aren't available with the thead extension. Not sure if that's > going to be needed or not, but it's worth remembering. > > Jeff
Hi Juzhe,
Thank you for your comprehensive comments.
Classifying theadvector intrinsics into 3 kinds is really important to make our patchset more organized.
For 1) and 3), I will split out the patches soon and hope they will be merged quickly.
For 2), according to the differences between vector and xtheadvector, it can be classfied into 3 kinds.
First is renamed load/store, renamed narrowing integer right shift, renamed narrowing fixed-point clip, and etc. I think we can use ASM targethook to rewrite the whole string of the instructions, although it will still be a heavy work.
Second is no pseudo instruction like vneg/vfneg. We will add these pseudo instructions in binutils to make xtheadvector more compatible with vector.
Third is that destination vector register cannot overlap source vector register group for vmadc/vmsbc/widen arithmetic/narrow arithmetic. Currently I cannot come up with any better way than pattern copy. Do you have any suggestions?
Joshua
------------------------------------------------------------------
发件人:钟居哲 <juzhe.zhong@rivai.ai>
发送时间:2023年12月21日(星期四) 07:04
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:"jim.wilson.gcc"<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; Jeff Law<jeffreyalaw@gmail.com>; "Christoph Müllner"<christoph.muellner@vrull.eu>; "cooper.joshua"<cooper.joshua@linux.alibaba.com>; jinma<jinma@linux.alibaba.com>; Cooper Qu<cooper.qu@linux.alibaba.com>
主 题:Re: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi, Joshua.
Thanks for working hard on clean up codes and support tons of work on theadvector.
After fully review this patch, I understand you have 3 kinds of theadvector intrinsics from the codebase of current RVV1.0 GCC.
1). instructions that can leverage all current codes of RVV1.0 intrinsic with simply adding "th." prefix directly.
2). instructions that leverage current MD patterns but with some tweak and patterns copy since they are not simply added "th.".
3). new instructions that current RVV1.0 doesn't have like vlb instructions.
Overal, 1) and 3) look reasonable to me. But 2) need me some time to figure out the better way to do that (Current this patch with copying patterns is not approach I like)
So, I hope you can break this big patch into 3 different series patches.
1. Support partial theadvector instructions which leverage directly from current RVV1.0 with simple adding "th." prefix.
2. Support totally different name theadvector instructions but share same patterns as RVV1.0 instructions.
3. Support new headvector instructions like vlib...etc.
I think 1 and 3 separate patches can be quickly merged after my more details reviewed and approved in the following patches you send like V4 ?.
For 2, it's a bit more complicate, but I think we can support like ARM and other targets, use ASM targethook to rewrite the whole string of the instructions.
For example, like strided load/store, you can know this instructions from attribute:
(set_attr "type" "vlds")
juzhe.zhong@rivai.ai
From: Jun Sha (Joshua) <mailto:cooper.joshua@linux.alibaba.com >
Date: 2023-12-20 20:20
To: gcc-patches <mailto:gcc-patches@gcc.gnu.org >
CC: jim.wilson.gcc <mailto:jim.wilson.gcc@gmail.com >; palmer <mailto:palmer@dabbelt.com >; andrew <mailto:andrew@sifive.com >; philipp.tomsich <mailto:philipp.tomsich@vrull.eu >; jeffreyalaw <mailto:jeffreyalaw@gmail.com >; christoph.muellner <mailto:christoph.muellner@vrull.eu >; juzhe.zhong <mailto:juzhe.zhong@rivai.ai >; Jun Sha (Joshua) <mailto:cooper.joshua@linux.alibaba.com >; Jin Ma <mailto:jinma@linux.alibaba.com >; Xianmiao Qu <mailto:cooper.qu@linux.alibaba.com >
Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
This patch series presents gcc implementation of the XTheadVector
extension [1].
[1] https://github.com/T-head-Semi/thead-extension-spec/ <https://github.com/T-head-Semi/thead-extension-spec/ >
For some vector patterns that cannot be avoided, we use
"!TARGET_XTHEADVECTOR" to disable them in order not to
generate instructions that xtheadvector does not support,
causing 36 changes in vector.md.
For the th. prefix issue, we use current_output_insn and
the ASM_OUTPUT_OPCODE hook instead of directly modifying
patterns in vector.md.
We have run the GCC test suite and can confirm that there
are no regressions.
All the test results can be found in the following links,
Run without xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html <https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html >
Run with xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html <https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html >
Furthermore, we have run the tests in
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples <https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples >,
and all the tests passed.
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
RISC-V: Refactor riscv-vector-builtins-bases.cc
RISC-V: Split csr_operand in predicates.md for vector patterns
RISC-V: Introduce XTheadVector as a subset of V1.0.0
RISC-V: Adds the prefix "th." for the instructions of XTheadVector
RISC-V: Handle differences between XTheadvector and Vector
RISC-V: Add support for xtheadvector-specific intrinsics
---
gcc/common/config/riscv/riscv-common.cc | 23 +
gcc/config.gcc | 4 +-
gcc/config/riscv/autovec.md | 2 +-
gcc/config/riscv/predicates.md | 8 +-
gcc/config/riscv/riscv-c.cc | 8 +-
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv-string.cc | 3 +
gcc/config/riscv/riscv-v.cc | 13 +-
.../riscv/riscv-vector-builtins-bases.cc | 18 +-
.../riscv/riscv-vector-builtins-bases.h | 19 +
.../riscv/riscv-vector-builtins-shapes.cc | 149 +
.../riscv/riscv-vector-builtins-shapes.h | 3 +
.../riscv/riscv-vector-builtins-types.def | 120 +
gcc/config/riscv/riscv-vector-builtins.cc | 315 +-
gcc/config/riscv/riscv-vector-builtins.h | 5 +-
gcc/config/riscv/riscv-vector-switch.def | 150 +-
gcc/config/riscv/riscv.cc | 46 +-
gcc/config/riscv/riscv.h | 4 +
gcc/config/riscv/riscv.opt | 2 +
gcc/config/riscv/riscv_th_vector.h | 49 +
gcc/config/riscv/t-riscv | 16 +
.../riscv/thead-vector-builtins-functions.def | 659 ++++
gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++
gcc/config/riscv/thead-vector-builtins.h | 123 +
gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++
gcc/config/riscv/vector-iterators.md | 186 +-
gcc/config/riscv/vector.md | 44 +-
.../riscv/predef-__riscv_th_v_intrinsic.c | 11 +
.../gcc.target/riscv/rvv/base/abi-1.c | 2 +-
.../gcc.target/riscv/rvv/base/pragma-1.c | 2 +-
.../gcc.target/riscv/rvv/xtheadvector.c | 13 +
.../riscv/rvv/xtheadvector/prefix.c | 12 +
.../riscv/rvv/xtheadvector/vlb-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlh-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlw-vsw.c | 68 +
.../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 +
gcc/testsuite/lib/target-supports.exp | 12 +
39 files changed, 5931 insertions(+), 213 deletions(-)
create mode 100644 gcc/config/riscv/riscv_th_vector.h
create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def
create mode 100644 gcc/config/riscv/thead-vector-builtins.cc
create mode 100644 gcc/config/riscv/thead-vector-builtins.h
create mode 100644 gcc/config/riscv/thead-vector.md
create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c
You mean theadvector doesn't want the current RVV1.0 register overlap magic as follows ?
The destination EEW is smaller than the source EEW and the overlap is in the lowest-numbered part of the source register group (e.g., when LMUL=1, vnsrl.wi v0, v0, 3 is legal, but a destination of v1 is not).
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
If yes, I suggest disable the overlap constraint using attribute, More details you can learn from
(set_attr "group_overlap"
juzhe.zhong@rivai.ai
发件人: joshua
发送时间: 2023-12-22 11:33
收件人: 钟居哲; gcc-patches
抄送: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Jeff Law; Christoph Müllner; jinma; Cooper Qu
主题: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
Thank you for your comprehensive comments.
Classifying theadvector intrinsics into 3 kinds is really important to make our patchset more organized.
For 1) and 3), I will split out the patches soon and hope they will be merged quickly.
For 2), according to the differences between vector and xtheadvector, it can be classfied into 3 kinds.
First is renamed load/store, renamed narrowing integer right shift, renamed narrowing fixed-point clip, and etc. I think we can use ASM targethook to rewrite the whole string of the instructions, although it will still be a heavy work.
Second is no pseudo instruction like vneg/vfneg. We will add these pseudo instructions in binutils to make xtheadvector more compatible with vector.
Third is that destination vector register cannot overlap source vector register group for vmadc/vmsbc/widen arithmetic/narrow arithmetic. Currently I cannot come up with any better way than pattern copy. Do you have any suggestions?
Joshua
------------------------------------------------------------------
发件人:钟居哲 <juzhe.zhong@rivai.ai>
发送时间:2023年12月21日(星期四) 07:04
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:"jim.wilson.gcc"<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; Jeff Law<jeffreyalaw@gmail.com>; "Christoph Müllner"<christoph.muellner@vrull.eu>; "cooper.joshua"<cooper.joshua@linux.alibaba.com>; jinma<jinma@linux.alibaba.com>; Cooper Qu<cooper.qu@linux.alibaba.com>
主 题:Re: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi, Joshua.
Thanks for working hard on clean up codes and support tons of work on theadvector.
After fully review this patch, I understand you have 3 kinds of theadvector intrinsics from the codebase of current RVV1.0 GCC.
1). instructions that can leverage all current codes of RVV1.0 intrinsic with simply adding "th." prefix directly.
2). instructions that leverage current MD patterns but with some tweak and patterns copy since they are not simply added "th.".
3). new instructions that current RVV1.0 doesn't have like vlb instructions.
Overal, 1) and 3) look reasonable to me. But 2) need me some time to figure out the better way to do that (Current this patch with copying patterns is not approach I like)
So, I hope you can break this big patch into 3 different series patches.
1. Support partial theadvector instructions which leverage directly from current RVV1.0 with simple adding "th." prefix.
2. Support totally different name theadvector instructions but share same patterns as RVV1.0 instructions.
3. Support new headvector instructions like vlib...etc.
I think 1 and 3 separate patches can be quickly merged after my more details reviewed and approved in the following patches you send like V4 ?.
For 2, it's a bit more complicate, but I think we can support like ARM and other targets, use ASM targethook to rewrite the whole string of the instructions.
For example, like strided load/store, you can know this instructions from attribute:
(set_attr "type" "vlds")
juzhe.zhong@rivai.ai
From: Jun Sha (Joshua)
Date: 2023-12-20 20:20
To: gcc-patches
CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner; juzhe.zhong; Jun Sha (Joshua); Jin Ma; Xianmiao Qu
Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
This patch series presents gcc implementation of the XTheadVector
extension [1].
[1] https://github.com/T-head-Semi/thead-extension-spec/
For some vector patterns that cannot be avoided, we use
"!TARGET_XTHEADVECTOR" to disable them in order not to
generate instructions that xtheadvector does not support,
causing 36 changes in vector.md.
For the th. prefix issue, we use current_output_insn and
the ASM_OUTPUT_OPCODE hook instead of directly modifying
patterns in vector.md.
We have run the GCC test suite and can confirm that there
are no regressions.
All the test results can be found in the following links,
Run without xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html
Run with xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html
Furthermore, we have run the tests in
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples,
and all the tests passed.
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
RISC-V: Refactor riscv-vector-builtins-bases.cc
RISC-V: Split csr_operand in predicates.md for vector patterns
RISC-V: Introduce XTheadVector as a subset of V1.0.0
RISC-V: Adds the prefix "th." for the instructions of XTheadVector
RISC-V: Handle differences between XTheadvector and Vector
RISC-V: Add support for xtheadvector-specific intrinsics
---
gcc/common/config/riscv/riscv-common.cc | 23 +
gcc/config.gcc | 4 +-
gcc/config/riscv/autovec.md | 2 +-
gcc/config/riscv/predicates.md | 8 +-
gcc/config/riscv/riscv-c.cc | 8 +-
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv-string.cc | 3 +
gcc/config/riscv/riscv-v.cc | 13 +-
.../riscv/riscv-vector-builtins-bases.cc | 18 +-
.../riscv/riscv-vector-builtins-bases.h | 19 +
.../riscv/riscv-vector-builtins-shapes.cc | 149 +
.../riscv/riscv-vector-builtins-shapes.h | 3 +
.../riscv/riscv-vector-builtins-types.def | 120 +
gcc/config/riscv/riscv-vector-builtins.cc | 315 +-
gcc/config/riscv/riscv-vector-builtins.h | 5 +-
gcc/config/riscv/riscv-vector-switch.def | 150 +-
gcc/config/riscv/riscv.cc | 46 +-
gcc/config/riscv/riscv.h | 4 +
gcc/config/riscv/riscv.opt | 2 +
gcc/config/riscv/riscv_th_vector.h | 49 +
gcc/config/riscv/t-riscv | 16 +
.../riscv/thead-vector-builtins-functions.def | 659 ++++
gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++
gcc/config/riscv/thead-vector-builtins.h | 123 +
gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++
gcc/config/riscv/vector-iterators.md | 186 +-
gcc/config/riscv/vector.md | 44 +-
.../riscv/predef-__riscv_th_v_intrinsic.c | 11 +
.../gcc.target/riscv/rvv/base/abi-1.c | 2 +-
.../gcc.target/riscv/rvv/base/pragma-1.c | 2 +-
.../gcc.target/riscv/rvv/xtheadvector.c | 13 +
.../riscv/rvv/xtheadvector/prefix.c | 12 +
.../riscv/rvv/xtheadvector/vlb-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlh-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlw-vsw.c | 68 +
.../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 +
gcc/testsuite/lib/target-supports.exp | 12 +
39 files changed, 5931 insertions(+), 213 deletions(-)
create mode 100644 gcc/config/riscv/riscv_th_vector.h
create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def
create mode 100644 gcc/config/riscv/thead-vector-builtins.cc
create mode 100644 gcc/config/riscv/thead-vector-builtins.h
create mode 100644 gcc/config/riscv/thead-vector.md
create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c
Hi Juzhe,
What xtheadvector needs to handle is just that destination vector register cannot overlap source vector register group for instructions like vmadc/vmsbc. That is not what group_overlap means. We nned to add "&" to the registers in the corresponding xtheadvector patterns while rvv 1.0 doesn't have this constraint.
(define_insn "@pred_th_msbc<mode>"
[(set (match_operand:<VM> 0 "register_operand" "=&vr")
(unspec:<VM>
[(minus:VI
(match_operand:VI 1 "register_operand" " vr")
(match_operand:VI 2 "register_operand" " vr"))
(match_operand:<VM> 3 "register_operand" " vm")
(unspec:<VM>
[(match_operand 4 "vector_length_operand" " rK")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
"TARGET_XTHEADVECTOR"
"vmsbc.vvm\t%0,%1,%2,%3"
[(set_attr "type" "vicalu")
(set_attr "mode" "<MODE>")
(set_attr "vl_op_idx" "4")
(set (attr "avl_type_idx") (const_int 5))])
Joshua
------------------------------------------------------------------
发件人:juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>
发送时间:2023年12月22日(星期五) 16:07
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:Jim Wilson<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; jeffreyalaw<jeffreyalaw@gmail.com>; "christoph.muellner"<christoph.muellner@vrull.eu>; jinma<jinma@linux.alibaba.com>; "cooper.qu"<cooper.qu@linux.alibaba.com>
主 题:Re: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
You mean theadvector doesn't want the current RVV1.0 register overlap magic as follows ?
*
The destination EEW is smaller than the source EEW and the overlap is in the lowest-numbered part of the source register group (e.g., when LMUL=1, vnsrl.wi v0, v0, 3 is legal, but a destination of v1 is not).
*
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
If yes, I suggest disable the overlap constraint using attribute, More details you can learn from
(set_attr "group_overlap"
juzhe.zhong@rivai.ai
发件人: joshua <mailto:cooper.joshua@linux.alibaba.com >
发送时间: 2023-12-22 11:33
收件人: 钟居哲 <mailto:juzhe.zhong@rivai.ai >; gcc-patches <mailto:gcc-patches@gcc.gnu.org >
抄送: jim.wilson.gcc <mailto:jim.wilson.gcc@gmail.com >; palmer <mailto:palmer@dabbelt.com >; andrew <mailto:andrew@sifive.com >; philipp.tomsich <mailto:philipp.tomsich@vrull.eu >; Jeff Law <mailto:jeffreyalaw@gmail.com >; Christoph Müllner <mailto:christoph.muellner@vrull.eu >; jinma <mailto:jinma@linux.alibaba.com >; Cooper Qu <mailto:cooper.qu@linux.alibaba.com >
主题: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
Thank you for your comprehensive comments.
Classifying theadvector intrinsics into 3 kinds is really important to make our patchset more organized.
For 1) and 3), I will split out the patches soon and hope they will be merged quickly.
For 2), according to the differences between vector and xtheadvector, it can be classfied into 3 kinds.
First is renamed load/store, renamed narrowing integer right shift, renamed narrowing fixed-point clip, and etc. I think we can use ASM targethook to rewrite the whole string of the instructions, although it will still be a heavy work.
Second is no pseudo instruction like vneg/vfneg. We will add these pseudo instructions in binutils to make xtheadvector more compatible with vector.
Third is that destination vector register cannot overlap source vector register group for vmadc/vmsbc/widen arithmetic/narrow arithmetic. Currently I cannot come up with any better way than pattern copy. Do you have any suggestions?
Joshua
------------------------------------------------------------------
发件人:钟居哲 <juzhe.zhong@rivai.ai>
发送时间:2023年12月21日(星期四) 07:04
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:"jim.wilson.gcc"<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; Jeff Law<jeffreyalaw@gmail.com>; "Christoph Müllner"<christoph.muellner@vrull.eu>; "cooper.joshua"<cooper.joshua@linux.alibaba.com>; jinma<jinma@linux.alibaba.com>; Cooper Qu<cooper.qu@linux.alibaba.com>
主 题:Re: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi, Joshua.
Thanks for working hard on clean up codes and support tons of work on theadvector.
After fully review this patch, I understand you have 3 kinds of theadvector intrinsics from the codebase of current RVV1.0 GCC.
1). instructions that can leverage all current codes of RVV1.0 intrinsic with simply adding "th." prefix directly.
2). instructions that leverage current MD patterns but with some tweak and patterns copy since they are not simply added "th.".
3). new instructions that current RVV1.0 doesn't have like vlb instructions.
Overal, 1) and 3) look reasonable to me. But 2) need me some time to figure out the better way to do that (Current this patch with copying patterns is not approach I like)
So, I hope you can break this big patch into 3 different series patches.
1. Support partial theadvector instructions which leverage directly from current RVV1.0 with simple adding "th." prefix.
2. Support totally different name theadvector instructions but share same patterns as RVV1.0 instructions.
3. Support new headvector instructions like vlib...etc.
I think 1 and 3 separate patches can be quickly merged after my more details reviewed and approved in the following patches you send like V4 ?.
For 2, it's a bit more complicate, but I think we can support like ARM and other targets, use ASM targethook to rewrite the whole string of the instructions.
For example, like strided load/store, you can know this instructions from attribute:
(set_attr "type" "vlds")
juzhe.zhong@rivai.ai
From: Jun Sha (Joshua) <mailto:cooper.joshua@linux.alibaba.com >
Date: 2023-12-20 20:20
To: gcc-patches <mailto:gcc-patches@gcc.gnu.org >
CC: jim.wilson.gcc <mailto:jim.wilson.gcc@gmail.com >; palmer <mailto:palmer@dabbelt.com >; andrew <mailto:andrew@sifive.com >; philipp.tomsich <mailto:philipp.tomsich@vrull.eu >; jeffreyalaw <mailto:jeffreyalaw@gmail.com >; christoph.muellner <mailto:christoph.muellner@vrull.eu >; juzhe.zhong <mailto:juzhe.zhong@rivai.ai >; Jun Sha (Joshua) <mailto:cooper.joshua@linux.alibaba.com >; Jin Ma <mailto:jinma@linux.alibaba.com >; Xianmiao Qu <mailto:cooper.qu@linux.alibaba.com >
Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
This patch series presents gcc implementation of the XTheadVector
extension [1].
[1] https://github.com/T-head-Semi/thead-extension-spec/ <https://github.com/T-head-Semi/thead-extension-spec/ >
For some vector patterns that cannot be avoided, we use
"!TARGET_XTHEADVECTOR" to disable them in order not to
generate instructions that xtheadvector does not support,
causing 36 changes in vector.md.
For the th. prefix issue, we use current_output_insn and
the ASM_OUTPUT_OPCODE hook instead of directly modifying
patterns in vector.md.
We have run the GCC test suite and can confirm that there
are no regressions.
All the test results can be found in the following links,
Run without xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html <https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html >
Run with xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html <https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html >
Furthermore, we have run the tests in
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples <https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples >,
and all the tests passed.
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
RISC-V: Refactor riscv-vector-builtins-bases.cc
RISC-V: Split csr_operand in predicates.md for vector patterns
RISC-V: Introduce XTheadVector as a subset of V1.0.0
RISC-V: Adds the prefix "th." for the instructions of XTheadVector
RISC-V: Handle differences between XTheadvector and Vector
RISC-V: Add support for xtheadvector-specific intrinsics
---
gcc/common/config/riscv/riscv-common.cc | 23 +
gcc/config.gcc | 4 +-
gcc/config/riscv/autovec.md | 2 +-
gcc/config/riscv/predicates.md | 8 +-
gcc/config/riscv/riscv-c.cc | 8 +-
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv-string.cc | 3 +
gcc/config/riscv/riscv-v.cc | 13 +-
.../riscv/riscv-vector-builtins-bases.cc | 18 +-
.../riscv/riscv-vector-builtins-bases.h | 19 +
.../riscv/riscv-vector-builtins-shapes.cc | 149 +
.../riscv/riscv-vector-builtins-shapes.h | 3 +
.../riscv/riscv-vector-builtins-types.def | 120 +
gcc/config/riscv/riscv-vector-builtins.cc | 315 +-
gcc/config/riscv/riscv-vector-builtins.h | 5 +-
gcc/config/riscv/riscv-vector-switch.def | 150 +-
gcc/config/riscv/riscv.cc | 46 +-
gcc/config/riscv/riscv.h | 4 +
gcc/config/riscv/riscv.opt | 2 +
gcc/config/riscv/riscv_th_vector.h | 49 +
gcc/config/riscv/t-riscv | 16 +
.../riscv/thead-vector-builtins-functions.def | 659 ++++
gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++
gcc/config/riscv/thead-vector-builtins.h | 123 +
gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++
gcc/config/riscv/vector-iterators.md | 186 +-
gcc/config/riscv/vector.md | 44 +-
.../riscv/predef-__riscv_th_v_intrinsic.c | 11 +
.../gcc.target/riscv/rvv/base/abi-1.c | 2 +-
.../gcc.target/riscv/rvv/base/pragma-1.c | 2 +-
.../gcc.target/riscv/rvv/xtheadvector.c | 13 +
.../riscv/rvv/xtheadvector/prefix.c | 12 +
.../riscv/rvv/xtheadvector/vlb-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlh-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlw-vsw.c | 68 +
.../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 +
gcc/testsuite/lib/target-supports.exp | 12 +
39 files changed, 5931 insertions(+), 213 deletions(-)
create mode 100644 gcc/config/riscv/riscv_th_vector.h
create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def
create mode 100644 gcc/config/riscv/thead-vector-builtins.cc
create mode 100644 gcc/config/riscv/thead-vector-builtins.h
create mode 100644 gcc/config/riscv/thead-vector.md
create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c
Yeah.
(define_insn "@pred_msbc<mode>"
[(set (match_operand:<VM> 0 "register_operand" "=vr, vr, &vr")
(unspec:<VM>
[(minus:VI
(match_operand:VI 1 "register_operand" " 0, vr, vr")
(match_operand:VI 2 "register_operand" " vr, 0, vr"))
(match_operand:<VM> 3 "register_operand" " vm, vm, vm")
(unspec:<VM>
[(match_operand 4 "vector_length_operand" " rK, rK, rK")
(match_operand 5 "const_int_operand" " i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
"TARGET_VECTOR"
"vmsbc.vvm\t%0,%1,%2,%3"
[(set_attr "type" "vicalu")
(set_attr "mode" "<MODE>")
(set_attr "vl_op_idx" "4")
(set (attr "avl_type_idx") (const_int 5))])
You should use an attribute to disable alternative 0 and alternative 1 constraint.
juzhe.zhong@rivai.ai
发件人: joshua
发送时间: 2023-12-22 18:29
收件人: juzhe.zhong@rivai.ai; gcc-patches
抄送: Jim Wilson; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner; jinma; cooper.qu
主题: 回复:回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
What xtheadvector needs to handle is just that destination vector register cannot overlap source vector register group for instructions like vmadc/vmsbc. That is not what group_overlap means. We nned to add "&" to the registers in the corresponding xtheadvector patterns while rvv 1.0 doesn't have this constraint.
(define_insn "@pred_th_msbc<mode>"
[(set (match_operand:<VM> 0 "register_operand" "=&vr")
(unspec:<VM>
[(minus:VI
(match_operand:VI 1 "register_operand" " vr")
(match_operand:VI 2 "register_operand" " vr"))
(match_operand:<VM> 3 "register_operand" " vm")
(unspec:<VM>
[(match_operand 4 "vector_length_operand" " rK")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
"TARGET_XTHEADVECTOR"
"vmsbc.vvm\t%0,%1,%2,%3"
[(set_attr "type" "vicalu")
(set_attr "mode" "<MODE>")
(set_attr "vl_op_idx" "4")
(set (attr "avl_type_idx") (const_int 5))])
Joshua
------------------------------------------------------------------
发件人:juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>
发送时间:2023年12月22日(星期五) 16:07
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:Jim Wilson<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; jeffreyalaw<jeffreyalaw@gmail.com>; "christoph.muellner"<christoph.muellner@vrull.eu>; jinma<jinma@linux.alibaba.com>; "cooper.qu"<cooper.qu@linux.alibaba.com>
主 题:Re: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
You mean theadvector doesn't want the current RVV1.0 register overlap magic as follows ?
The destination EEW is smaller than the source EEW and the overlap is in the lowest-numbered part of the source register group (e.g., when LMUL=1, vnsrl.wi v0, v0, 3 is legal, but a destination of v1 is not).
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
If yes, I suggest disable the overlap constraint using attribute, More details you can learn from
(set_attr "group_overlap"
juzhe.zhong@rivai.ai
发件人: joshua
发送时间: 2023-12-22 11:33
收件人: 钟居哲; gcc-patches
抄送: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Jeff Law; Christoph Müllner; jinma; Cooper Qu
主题: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
Thank you for your comprehensive comments.
Classifying theadvector intrinsics into 3 kinds is really important to make our patchset more organized.
For 1) and 3), I will split out the patches soon and hope they will be merged quickly.
For 2), according to the differences between vector and xtheadvector, it can be classfied into 3 kinds.
First is renamed load/store, renamed narrowing integer right shift, renamed narrowing fixed-point clip, and etc. I think we can use ASM targethook to rewrite the whole string of the instructions, although it will still be a heavy work.
Second is no pseudo instruction like vneg/vfneg. We will add these pseudo instructions in binutils to make xtheadvector more compatible with vector.
Third is that destination vector register cannot overlap source vector register group for vmadc/vmsbc/widen arithmetic/narrow arithmetic. Currently I cannot come up with any better way than pattern copy. Do you have any suggestions?
Joshua
------------------------------------------------------------------
发件人:钟居哲 <juzhe.zhong@rivai.ai>
发送时间:2023年12月21日(星期四) 07:04
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:"jim.wilson.gcc"<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; Jeff Law<jeffreyalaw@gmail.com>; "Christoph Müllner"<christoph.muellner@vrull.eu>; "cooper.joshua"<cooper.joshua@linux.alibaba.com>; jinma<jinma@linux.alibaba.com>; Cooper Qu<cooper.qu@linux.alibaba.com>
主 题:Re: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi, Joshua.
Thanks for working hard on clean up codes and support tons of work on theadvector.
After fully review this patch, I understand you have 3 kinds of theadvector intrinsics from the codebase of current RVV1.0 GCC.
1). instructions that can leverage all current codes of RVV1.0 intrinsic with simply adding "th." prefix directly.
2). instructions that leverage current MD patterns but with some tweak and patterns copy since they are not simply added "th.".
3). new instructions that current RVV1.0 doesn't have like vlb instructions.
Overal, 1) and 3) look reasonable to me. But 2) need me some time to figure out the better way to do that (Current this patch with copying patterns is not approach I like)
So, I hope you can break this big patch into 3 different series patches.
1. Support partial theadvector instructions which leverage directly from current RVV1.0 with simple adding "th." prefix.
2. Support totally different name theadvector instructions but share same patterns as RVV1.0 instructions.
3. Support new headvector instructions like vlib...etc.
I think 1 and 3 separate patches can be quickly merged after my more details reviewed and approved in the following patches you send like V4 ?.
For 2, it's a bit more complicate, but I think we can support like ARM and other targets, use ASM targethook to rewrite the whole string of the instructions.
For example, like strided load/store, you can know this instructions from attribute:
(set_attr "type" "vlds")
juzhe.zhong@rivai.ai
From: Jun Sha (Joshua)
Date: 2023-12-20 20:20
To: gcc-patches
CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner; juzhe.zhong; Jun Sha (Joshua); Jin Ma; Xianmiao Qu
Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
This patch series presents gcc implementation of the XTheadVector
extension [1].
[1] https://github.com/T-head-Semi/thead-extension-spec/
For some vector patterns that cannot be avoided, we use
"!TARGET_XTHEADVECTOR" to disable them in order not to
generate instructions that xtheadvector does not support,
causing 36 changes in vector.md.
For the th. prefix issue, we use current_output_insn and
the ASM_OUTPUT_OPCODE hook instead of directly modifying
patterns in vector.md.
We have run the GCC test suite and can confirm that there
are no regressions.
All the test results can be found in the following links,
Run without xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html
Run with xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html
Furthermore, we have run the tests in
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples,
and all the tests passed.
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
RISC-V: Refactor riscv-vector-builtins-bases.cc
RISC-V: Split csr_operand in predicates.md for vector patterns
RISC-V: Introduce XTheadVector as a subset of V1.0.0
RISC-V: Adds the prefix "th." for the instructions of XTheadVector
RISC-V: Handle differences between XTheadvector and Vector
RISC-V: Add support for xtheadvector-specific intrinsics
---
gcc/common/config/riscv/riscv-common.cc | 23 +
gcc/config.gcc | 4 +-
gcc/config/riscv/autovec.md | 2 +-
gcc/config/riscv/predicates.md | 8 +-
gcc/config/riscv/riscv-c.cc | 8 +-
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv-string.cc | 3 +
gcc/config/riscv/riscv-v.cc | 13 +-
.../riscv/riscv-vector-builtins-bases.cc | 18 +-
.../riscv/riscv-vector-builtins-bases.h | 19 +
.../riscv/riscv-vector-builtins-shapes.cc | 149 +
.../riscv/riscv-vector-builtins-shapes.h | 3 +
.../riscv/riscv-vector-builtins-types.def | 120 +
gcc/config/riscv/riscv-vector-builtins.cc | 315 +-
gcc/config/riscv/riscv-vector-builtins.h | 5 +-
gcc/config/riscv/riscv-vector-switch.def | 150 +-
gcc/config/riscv/riscv.cc | 46 +-
gcc/config/riscv/riscv.h | 4 +
gcc/config/riscv/riscv.opt | 2 +
gcc/config/riscv/riscv_th_vector.h | 49 +
gcc/config/riscv/t-riscv | 16 +
.../riscv/thead-vector-builtins-functions.def | 659 ++++
gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++
gcc/config/riscv/thead-vector-builtins.h | 123 +
gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++
gcc/config/riscv/vector-iterators.md | 186 +-
gcc/config/riscv/vector.md | 44 +-
.../riscv/predef-__riscv_th_v_intrinsic.c | 11 +
.../gcc.target/riscv/rvv/base/abi-1.c | 2 +-
.../gcc.target/riscv/rvv/base/pragma-1.c | 2 +-
.../gcc.target/riscv/rvv/xtheadvector.c | 13 +
.../riscv/rvv/xtheadvector/prefix.c | 12 +
.../riscv/rvv/xtheadvector/vlb-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlh-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlw-vsw.c | 68 +
.../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 +
gcc/testsuite/lib/target-supports.exp | 12 +
39 files changed, 5931 insertions(+), 213 deletions(-)
create mode 100644 gcc/config/riscv/riscv_th_vector.h
create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def
create mode 100644 gcc/config/riscv/thead-vector-builtins.cc
create mode 100644 gcc/config/riscv/thead-vector-builtins.h
create mode 100644 gcc/config/riscv/thead-vector.md
create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c
On 12/22/23 01:07, juzhe.zhong@rivai.ai wrote: > You mean theadvector doesn't want the current RVV1.0 register overlap > magic as follows ? > > * > > The destination EEW is smaller than the source EEW and the overlap > is in the lowest-numbered part of the source register group (e.g., > when LMUL=1, |vnsrl.wi v0, v0, 3| is legal, but a destination of > |v1| is not). > > * > > The destination EEW is greater than the source EEW, the source EMUL > is at least 1, and the overlap is in the highest-numbered part of > the destination register group (e.g., when LMUL=8, |vzext.vf4 v0, > v6| is legal, but a source of |v0|, |v2|, or |v4| is not). > > > If yes, I suggest disable the overlap constraint using attribute, More > details you can learn from Yea, if there's alternatives we want to allow for xthead, but not rvv or vice-versa, I would think the "enabled" attribute would be a reasonable option. Essentially it allows alternatives to be available or unavailable based on the subtarget. It sounds like this may be necessary because of differences in how overlap is handled across 0.7 vs 1.0. Jeff >
Hi Juzhe,
Sorry but I'm not quite familiar with the group_overlap framework. Could you take this pattern as an example to show how to disable an alternative in some target?
Joshua
------------------------------------------------------------------
发件人:juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>
发送时间:2023年12月22日(星期五) 18:32
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:Jim Wilson<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; jeffreyalaw<jeffreyalaw@gmail.com>; "christoph.muellner"<christoph.muellner@vrull.eu>; jinma<jinma@linux.alibaba.com>; "cooper.qu"<cooper.qu@linux.alibaba.com>
主 题:Re: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Yeah.
(define_insn "@pred_msbc<mode>"
[(set (match_operand:<VM> 0 "register_operand" "=vr, vr, &vr")
(unspec:<VM>
[(minus:VI
(match_operand:VI 1 "register_operand" " 0, vr, vr")
(match_operand:VI 2 "register_operand" " vr, 0, vr"))
(match_operand:<VM> 3 "register_operand" " vm, vm, vm")
(unspec:<VM>
[(match_operand 4 "vector_length_operand" " rK, rK, rK")
(match_operand 5 "const_int_operand" " i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
"TARGET_VECTOR"
"vmsbc.vvm\t%0,%1,%2,%3"
[(set_attr "type" "vicalu")
(set_attr "mode" "<MODE>")
(set_attr "vl_op_idx" "4")
(set (attr "avl_type_idx") (const_int 5))])
You should use an attribute to disable alternative 0 and alternative 1 constraint.
juzhe.zhong@rivai.ai
发件人: joshua <mailto:cooper.joshua@linux.alibaba.com >
发送时间: 2023-12-22 18:29
收件人: juzhe.zhong@rivai.ai <mailto:juzhe.zhong@rivai.ai >; gcc-patches <mailto:gcc-patches@gcc.gnu.org >
抄送: Jim Wilson <mailto:jim.wilson.gcc@gmail.com >; palmer <mailto:palmer@dabbelt.com >; andrew <mailto:andrew@sifive.com >; philipp.tomsich <mailto:philipp.tomsich@vrull.eu >; jeffreyalaw <mailto:jeffreyalaw@gmail.com >; christoph.muellner <mailto:christoph.muellner@vrull.eu >; jinma <mailto:jinma@linux.alibaba.com >; cooper.qu <mailto:cooper.qu@linux.alibaba.com >
主题: 回复:回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
What xtheadvector needs to handle is just that destination vector register cannot overlap source vector register group for instructions like vmadc/vmsbc. That is not what group_overlap means. We nned to add "&" to the registers in the corresponding xtheadvector patterns while rvv 1.0 doesn't have this constraint.
(define_insn "@pred_th_msbc<mode>"
[(set (match_operand:<VM> 0 "register_operand" "=&vr")
(unspec:<VM>
[(minus:VI
(match_operand:VI 1 "register_operand" " vr")
(match_operand:VI 2 "register_operand" " vr"))
(match_operand:<VM> 3 "register_operand" " vm")
(unspec:<VM>
[(match_operand 4 "vector_length_operand" " rK")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
"TARGET_XTHEADVECTOR"
"vmsbc.vvm\t%0,%1,%2,%3"
[(set_attr "type" "vicalu")
(set_attr "mode" "<MODE>")
(set_attr "vl_op_idx" "4")
(set (attr "avl_type_idx") (const_int 5))])
Joshua
------------------------------------------------------------------
发件人:juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>
发送时间:2023年12月22日(星期五) 16:07
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:Jim Wilson<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; jeffreyalaw<jeffreyalaw@gmail.com>; "christoph.muellner"<christoph.muellner@vrull.eu>; jinma<jinma@linux.alibaba.com>; "cooper.qu"<cooper.qu@linux.alibaba.com>
主 题:Re: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
You mean theadvector doesn't want the current RVV1.0 register overlap magic as follows ?
*
The destination EEW is smaller than the source EEW and the overlap is in the lowest-numbered part of the source register group (e.g., when LMUL=1, vnsrl.wi v0, v0, 3 is legal, but a destination of v1 is not).
*
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
If yes, I suggest disable the overlap constraint using attribute, More details you can learn from
(set_attr "group_overlap"
juzhe.zhong@rivai.ai
发件人: joshua <mailto:cooper.joshua@linux.alibaba.com >
发送时间: 2023-12-22 11:33
收件人: 钟居哲 <mailto:juzhe.zhong@rivai.ai >; gcc-patches <mailto:gcc-patches@gcc.gnu.org >
抄送: jim.wilson.gcc <mailto:jim.wilson.gcc@gmail.com >; palmer <mailto:palmer@dabbelt.com >; andrew <mailto:andrew@sifive.com >; philipp.tomsich <mailto:philipp.tomsich@vrull.eu >; Jeff Law <mailto:jeffreyalaw@gmail.com >; Christoph Müllner <mailto:christoph.muellner@vrull.eu >; jinma <mailto:jinma@linux.alibaba.com >; Cooper Qu <mailto:cooper.qu@linux.alibaba.com >
主题: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
Thank you for your comprehensive comments.
Classifying theadvector intrinsics into 3 kinds is really important to make our patchset more organized.
For 1) and 3), I will split out the patches soon and hope they will be merged quickly.
For 2), according to the differences between vector and xtheadvector, it can be classfied into 3 kinds.
First is renamed load/store, renamed narrowing integer right shift, renamed narrowing fixed-point clip, and etc. I think we can use ASM targethook to rewrite the whole string of the instructions, although it will still be a heavy work.
Second is no pseudo instruction like vneg/vfneg. We will add these pseudo instructions in binutils to make xtheadvector more compatible with vector.
Third is that destination vector register cannot overlap source vector register group for vmadc/vmsbc/widen arithmetic/narrow arithmetic. Currently I cannot come up with any better way than pattern copy. Do you have any suggestions?
Joshua
------------------------------------------------------------------
发件人:钟居哲 <juzhe.zhong@rivai.ai>
发送时间:2023年12月21日(星期四) 07:04
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:"jim.wilson.gcc"<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; Jeff Law<jeffreyalaw@gmail.com>; "Christoph Müllner"<christoph.muellner@vrull.eu>; "cooper.joshua"<cooper.joshua@linux.alibaba.com>; jinma<jinma@linux.alibaba.com>; Cooper Qu<cooper.qu@linux.alibaba.com>
主 题:Re: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi, Joshua.
Thanks for working hard on clean up codes and support tons of work on theadvector.
After fully review this patch, I understand you have 3 kinds of theadvector intrinsics from the codebase of current RVV1.0 GCC.
1). instructions that can leverage all current codes of RVV1.0 intrinsic with simply adding "th." prefix directly.
2). instructions that leverage current MD patterns but with some tweak and patterns copy since they are not simply added "th.".
3). new instructions that current RVV1.0 doesn't have like vlb instructions.
Overal, 1) and 3) look reasonable to me. But 2) need me some time to figure out the better way to do that (Current this patch with copying patterns is not approach I like)
So, I hope you can break this big patch into 3 different series patches.
1. Support partial theadvector instructions which leverage directly from current RVV1.0 with simple adding "th." prefix.
2. Support totally different name theadvector instructions but share same patterns as RVV1.0 instructions.
3. Support new headvector instructions like vlib...etc.
I think 1 and 3 separate patches can be quickly merged after my more details reviewed and approved in the following patches you send like V4 ?.
For 2, it's a bit more complicate, but I think we can support like ARM and other targets, use ASM targethook to rewrite the whole string of the instructions.
For example, like strided load/store, you can know this instructions from attribute:
(set_attr "type" "vlds")
juzhe.zhong@rivai.ai
From: Jun Sha (Joshua) <mailto:cooper.joshua@linux.alibaba.com >
Date: 2023-12-20 20:20
To: gcc-patches <mailto:gcc-patches@gcc.gnu.org >
CC: jim.wilson.gcc <mailto:jim.wilson.gcc@gmail.com >; palmer <mailto:palmer@dabbelt.com >; andrew <mailto:andrew@sifive.com >; philipp.tomsich <mailto:philipp.tomsich@vrull.eu >; jeffreyalaw <mailto:jeffreyalaw@gmail.com >; christoph.muellner <mailto:christoph.muellner@vrull.eu >; juzhe.zhong <mailto:juzhe.zhong@rivai.ai >; Jun Sha (Joshua) <mailto:cooper.joshua@linux.alibaba.com >; Jin Ma <mailto:jinma@linux.alibaba.com >; Xianmiao Qu <mailto:cooper.qu@linux.alibaba.com >
Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
This patch series presents gcc implementation of the XTheadVector
extension [1].
[1] https://github.com/T-head-Semi/thead-extension-spec/ <https://github.com/T-head-Semi/thead-extension-spec/ >
For some vector patterns that cannot be avoided, we use
"!TARGET_XTHEADVECTOR" to disable them in order not to
generate instructions that xtheadvector does not support,
causing 36 changes in vector.md.
For the th. prefix issue, we use current_output_insn and
the ASM_OUTPUT_OPCODE hook instead of directly modifying
patterns in vector.md.
We have run the GCC test suite and can confirm that there
are no regressions.
All the test results can be found in the following links,
Run without xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html <https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html >
Run with xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html <https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html >
Furthermore, we have run the tests in
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples <https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples >,
and all the tests passed.
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
RISC-V: Refactor riscv-vector-builtins-bases.cc
RISC-V: Split csr_operand in predicates.md for vector patterns
RISC-V: Introduce XTheadVector as a subset of V1.0.0
RISC-V: Adds the prefix "th." for the instructions of XTheadVector
RISC-V: Handle differences between XTheadvector and Vector
RISC-V: Add support for xtheadvector-specific intrinsics
---
gcc/common/config/riscv/riscv-common.cc | 23 +
gcc/config.gcc | 4 +-
gcc/config/riscv/autovec.md | 2 +-
gcc/config/riscv/predicates.md | 8 +-
gcc/config/riscv/riscv-c.cc | 8 +-
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv-string.cc | 3 +
gcc/config/riscv/riscv-v.cc | 13 +-
.../riscv/riscv-vector-builtins-bases.cc | 18 +-
.../riscv/riscv-vector-builtins-bases.h | 19 +
.../riscv/riscv-vector-builtins-shapes.cc | 149 +
.../riscv/riscv-vector-builtins-shapes.h | 3 +
.../riscv/riscv-vector-builtins-types.def | 120 +
gcc/config/riscv/riscv-vector-builtins.cc | 315 +-
gcc/config/riscv/riscv-vector-builtins.h | 5 +-
gcc/config/riscv/riscv-vector-switch.def | 150 +-
gcc/config/riscv/riscv.cc | 46 +-
gcc/config/riscv/riscv.h | 4 +
gcc/config/riscv/riscv.opt | 2 +
gcc/config/riscv/riscv_th_vector.h | 49 +
gcc/config/riscv/t-riscv | 16 +
.../riscv/thead-vector-builtins-functions.def | 659 ++++
gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++
gcc/config/riscv/thead-vector-builtins.h | 123 +
gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++
gcc/config/riscv/vector-iterators.md | 186 +-
gcc/config/riscv/vector.md | 44 +-
.../riscv/predef-__riscv_th_v_intrinsic.c | 11 +
.../gcc.target/riscv/rvv/base/abi-1.c | 2 +-
.../gcc.target/riscv/rvv/base/pragma-1.c | 2 +-
.../gcc.target/riscv/rvv/xtheadvector.c | 13 +
.../riscv/rvv/xtheadvector/prefix.c | 12 +
.../riscv/rvv/xtheadvector/vlb-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlh-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlw-vsw.c | 68 +
.../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 +
gcc/testsuite/lib/target-supports.exp | 12 +
39 files changed, 5931 insertions(+), 213 deletions(-)
create mode 100644 gcc/config/riscv/riscv_th_vector.h
create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def
create mode 100644 gcc/config/riscv/thead-vector-builtins.cc
create mode 100644 gcc/config/riscv/thead-vector-builtins.h
create mode 100644 gcc/config/riscv/thead-vector.md
create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c
I suggest you send the first patch which support theadvector with only adding "th.".
After it's done, then we can talk about it later.
juzhe.zhong@rivai.ai
发件人: joshua
发送时间: 2023-12-23 11:37
收件人: juzhe.zhong@rivai.ai; gcc-patches
抄送: Jim Wilson; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner
主题: 回复:回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
Sorry but I'm not quite familiar with the group_overlap framework. Could you take this pattern as an example to show how to disable an alternative in some target?
Joshua
------------------------------------------------------------------
发件人:juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>
发送时间:2023年12月22日(星期五) 18:32
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:Jim Wilson<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; jeffreyalaw<jeffreyalaw@gmail.com>; "christoph.muellner"<christoph.muellner@vrull.eu>; jinma<jinma@linux.alibaba.com>; "cooper.qu"<cooper.qu@linux.alibaba.com>
主 题:Re: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Yeah.
(define_insn "@pred_msbc<mode>"
[(set (match_operand:<VM> 0 "register_operand" "=vr, vr, &vr")
(unspec:<VM>
[(minus:VI
(match_operand:VI 1 "register_operand" " 0, vr, vr")
(match_operand:VI 2 "register_operand" " vr, 0, vr"))
(match_operand:<VM> 3 "register_operand" " vm, vm, vm")
(unspec:<VM>
[(match_operand 4 "vector_length_operand" " rK, rK, rK")
(match_operand 5 "const_int_operand" " i, i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
"TARGET_VECTOR"
"vmsbc.vvm\t%0,%1,%2,%3"
[(set_attr "type" "vicalu")
(set_attr "mode" "<MODE>")
(set_attr "vl_op_idx" "4")
(set (attr "avl_type_idx") (const_int 5))])
You should use an attribute to disable alternative 0 and alternative 1 constraint.
juzhe.zhong@rivai.ai
发件人: joshua
发送时间: 2023-12-22 18:29
收件人: juzhe.zhong@rivai.ai; gcc-patches
抄送: Jim Wilson; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner; jinma; cooper.qu
主题: 回复:回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
What xtheadvector needs to handle is just that destination vector register cannot overlap source vector register group for instructions like vmadc/vmsbc. That is not what group_overlap means. We nned to add "&" to the registers in the corresponding xtheadvector patterns while rvv 1.0 doesn't have this constraint.
(define_insn "@pred_th_msbc<mode>"
[(set (match_operand:<VM> 0 "register_operand" "=&vr")
(unspec:<VM>
[(minus:VI
(match_operand:VI 1 "register_operand" " vr")
(match_operand:VI 2 "register_operand" " vr"))
(match_operand:<VM> 3 "register_operand" " vm")
(unspec:<VM>
[(match_operand 4 "vector_length_operand" " rK")
(match_operand 5 "const_int_operand" " i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
"TARGET_XTHEADVECTOR"
"vmsbc.vvm\t%0,%1,%2,%3"
[(set_attr "type" "vicalu")
(set_attr "mode" "<MODE>")
(set_attr "vl_op_idx" "4")
(set (attr "avl_type_idx") (const_int 5))])
Joshua
------------------------------------------------------------------
发件人:juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai>
发送时间:2023年12月22日(星期五) 16:07
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:Jim Wilson<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; jeffreyalaw<jeffreyalaw@gmail.com>; "christoph.muellner"<christoph.muellner@vrull.eu>; jinma<jinma@linux.alibaba.com>; "cooper.qu"<cooper.qu@linux.alibaba.com>
主 题:Re: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
You mean theadvector doesn't want the current RVV1.0 register overlap magic as follows ?
The destination EEW is smaller than the source EEW and the overlap is in the lowest-numbered part of the source register group (e.g., when LMUL=1, vnsrl.wi v0, v0, 3 is legal, but a destination of v1 is not).
The destination EEW is greater than the source EEW, the source EMUL is at least 1, and the overlap is in the highest-numbered part of the destination register group (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
If yes, I suggest disable the overlap constraint using attribute, More details you can learn from
(set_attr "group_overlap"
juzhe.zhong@rivai.ai
发件人: joshua
发送时间: 2023-12-22 11:33
收件人: 钟居哲; gcc-patches
抄送: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Jeff Law; Christoph Müllner; jinma; Cooper Qu
主题: 回复:[PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi Juzhe,
Thank you for your comprehensive comments.
Classifying theadvector intrinsics into 3 kinds is really important to make our patchset more organized.
For 1) and 3), I will split out the patches soon and hope they will be merged quickly.
For 2), according to the differences between vector and xtheadvector, it can be classfied into 3 kinds.
First is renamed load/store, renamed narrowing integer right shift, renamed narrowing fixed-point clip, and etc. I think we can use ASM targethook to rewrite the whole string of the instructions, although it will still be a heavy work.
Second is no pseudo instruction like vneg/vfneg. We will add these pseudo instructions in binutils to make xtheadvector more compatible with vector.
Third is that destination vector register cannot overlap source vector register group for vmadc/vmsbc/widen arithmetic/narrow arithmetic. Currently I cannot come up with any better way than pattern copy. Do you have any suggestions?
Joshua
------------------------------------------------------------------
发件人:钟居哲 <juzhe.zhong@rivai.ai>
发送时间:2023年12月21日(星期四) 07:04
收件人:"cooper.joshua"<cooper.joshua@linux.alibaba.com>; "gcc-patches"<gcc-patches@gcc.gnu.org>
抄 送:"jim.wilson.gcc"<jim.wilson.gcc@gmail.com>; palmer<palmer@dabbelt.com>; andrew<andrew@sifive.com>; "philipp.tomsich"<philipp.tomsich@vrull.eu>; Jeff Law<jeffreyalaw@gmail.com>; "Christoph Müllner"<christoph.muellner@vrull.eu>; "cooper.joshua"<cooper.joshua@linux.alibaba.com>; jinma<jinma@linux.alibaba.com>; Cooper Qu<cooper.qu@linux.alibaba.com>
主 题:Re: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
Hi, Joshua.
Thanks for working hard on clean up codes and support tons of work on theadvector.
After fully review this patch, I understand you have 3 kinds of theadvector intrinsics from the codebase of current RVV1.0 GCC.
1). instructions that can leverage all current codes of RVV1.0 intrinsic with simply adding "th." prefix directly.
2). instructions that leverage current MD patterns but with some tweak and patterns copy since they are not simply added "th.".
3). new instructions that current RVV1.0 doesn't have like vlb instructions.
Overal, 1) and 3) look reasonable to me. But 2) need me some time to figure out the better way to do that (Current this patch with copying patterns is not approach I like)
So, I hope you can break this big patch into 3 different series patches.
1. Support partial theadvector instructions which leverage directly from current RVV1.0 with simple adding "th." prefix.
2. Support totally different name theadvector instructions but share same patterns as RVV1.0 instructions.
3. Support new headvector instructions like vlib...etc.
I think 1 and 3 separate patches can be quickly merged after my more details reviewed and approved in the following patches you send like V4 ?.
For 2, it's a bit more complicate, but I think we can support like ARM and other targets, use ASM targethook to rewrite the whole string of the instructions.
For example, like strided load/store, you can know this instructions from attribute:
(set_attr "type" "vlds")
juzhe.zhong@rivai.ai
From: Jun Sha (Joshua)
Date: 2023-12-20 20:20
To: gcc-patches
CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner; juzhe.zhong; Jun Sha (Joshua); Jin Ma; Xianmiao Qu
Subject: [PATCH v3 0/6] RISC-V: Support XTheadVector extension
This patch series presents gcc implementation of the XTheadVector
extension [1].
[1] https://github.com/T-head-Semi/thead-extension-spec/
For some vector patterns that cannot be avoided, we use
"!TARGET_XTHEADVECTOR" to disable them in order not to
generate instructions that xtheadvector does not support,
causing 36 changes in vector.md.
For the th. prefix issue, we use current_output_insn and
the ASM_OUTPUT_OPCODE hook instead of directly modifying
patterns in vector.md.
We have run the GCC test suite and can confirm that there
are no regressions.
All the test results can be found in the following links,
Run without xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803686.html
Run with xtheadvector:
https://gcc.gnu.org/pipermail/gcc-testresults/2023-December/803687.html
Furthermore, we have run the tests in
https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/main/examples,
and all the tests passed.
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
RISC-V: Refactor riscv-vector-builtins-bases.cc
RISC-V: Split csr_operand in predicates.md for vector patterns
RISC-V: Introduce XTheadVector as a subset of V1.0.0
RISC-V: Adds the prefix "th." for the instructions of XTheadVector
RISC-V: Handle differences between XTheadvector and Vector
RISC-V: Add support for xtheadvector-specific intrinsics
---
gcc/common/config/riscv/riscv-common.cc | 23 +
gcc/config.gcc | 4 +-
gcc/config/riscv/autovec.md | 2 +-
gcc/config/riscv/predicates.md | 8 +-
gcc/config/riscv/riscv-c.cc | 8 +-
gcc/config/riscv/riscv-protos.h | 1 +
gcc/config/riscv/riscv-string.cc | 3 +
gcc/config/riscv/riscv-v.cc | 13 +-
.../riscv/riscv-vector-builtins-bases.cc | 18 +-
.../riscv/riscv-vector-builtins-bases.h | 19 +
.../riscv/riscv-vector-builtins-shapes.cc | 149 +
.../riscv/riscv-vector-builtins-shapes.h | 3 +
.../riscv/riscv-vector-builtins-types.def | 120 +
gcc/config/riscv/riscv-vector-builtins.cc | 315 +-
gcc/config/riscv/riscv-vector-builtins.h | 5 +-
gcc/config/riscv/riscv-vector-switch.def | 150 +-
gcc/config/riscv/riscv.cc | 46 +-
gcc/config/riscv/riscv.h | 4 +
gcc/config/riscv/riscv.opt | 2 +
gcc/config/riscv/riscv_th_vector.h | 49 +
gcc/config/riscv/t-riscv | 16 +
.../riscv/thead-vector-builtins-functions.def | 659 ++++
gcc/config/riscv/thead-vector-builtins.cc | 887 ++++++
gcc/config/riscv/thead-vector-builtins.h | 123 +
gcc/config/riscv/thead-vector.md | 2827 +++++++++++++++++
gcc/config/riscv/vector-iterators.md | 186 +-
gcc/config/riscv/vector.md | 44 +-
.../riscv/predef-__riscv_th_v_intrinsic.c | 11 +
.../gcc.target/riscv/rvv/base/abi-1.c | 2 +-
.../gcc.target/riscv/rvv/base/pragma-1.c | 2 +-
.../gcc.target/riscv/rvv/xtheadvector.c | 13 +
.../riscv/rvv/xtheadvector/prefix.c | 12 +
.../riscv/rvv/xtheadvector/vlb-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlbu-vsb.c | 68 +
.../riscv/rvv/xtheadvector/vlh-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlhu-vsh.c | 68 +
.../riscv/rvv/xtheadvector/vlw-vsw.c | 68 +
.../riscv/rvv/xtheadvector/vlwu-vsw.c | 68 +
gcc/testsuite/lib/target-supports.exp | 12 +
39 files changed, 5931 insertions(+), 213 deletions(-)
create mode 100644 gcc/config/riscv/riscv_th_vector.h
create mode 100644 gcc/config/riscv/thead-vector-builtins-functions.def
create mode 100644 gcc/config/riscv/thead-vector-builtins.cc
create mode 100644 gcc/config/riscv/thead-vector-builtins.h
create mode 100644 gcc/config/riscv/thead-vector.md
create mode 100644 gcc/testsuite/gcc.target/riscv/predef-__riscv_th_v_intrinsic.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlb-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlbu-vsb.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlh-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlhu-vsh.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlw-vsw.c
create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vlwu-vsw.c