]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Support VSETVL PASS for RVV support
authorJu-Zhe Zhong <juzhe.zhong@rivai.ai>
Wed, 14 Dec 2022 07:31:11 +0000 (15:31 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Mon, 19 Dec 2022 14:21:37 +0000 (22:21 +0800)
commit9243c3d1b63b9092a82178392145f9e9d62423d9
treefccb9fd45b62ada34cd0ab9d9a48e51f718d9cd5
parent22dc669e109de9a76c74535cdf30e7922e0ef5c1
RISC-V: Support VSETVL PASS for RVV support

This patch is to support VSETVL PASS for RVV support.
1.The optimization and performance is guaranteed LCM (Lazy code motion).
2.Base on RTL_SSA framework to gain better optimization chances.
3.Also we do VL/VTYPE, demand information backward propagation across
  blocks by RTL_SSA reverse order in CFG.
4.It has been well and fully tested by about 200+ testcases for VLMAX
  AVL situation (Only for VLMAX since we don't have an intrinsics to
  test non-VLMAX).
5.Will support AVL model in the next patch.

gcc/ChangeLog:

* config.gcc: Add riscv-vsetvl.o.
* config/riscv/riscv-passes.def (INSERT_PASS_BEFORE): Add VSETVL PASS
location.
* config/riscv/riscv-protos.h (make_pass_vsetvl): New function.
(enum avl_type): New enum.
(get_ta): New function.
(get_ma): Ditto.
(get_avl_type): Ditto.
(calculate_ratio): Ditto.
(enum tail_policy): New enum.
(enum mask_policy): Ditto.
* config/riscv/riscv-v.cc (calculate_ratio): New function.
(emit_pred_op): change the VLMAX mov codgen.
(get_ta): New function.
(get_ma): Ditto.
(enum tail_policy): Change enum.
(get_prefer_tail_policy): New function.
(enum mask_policy): Change enum.
(get_prefer_mask_policy): New function.
* config/riscv/t-riscv: Add riscv-vsetvl.o
* config/riscv/vector.md: Adjust attribute and pattern for VSETVL
PASS.
(@vlmax_avl<mode>): Ditto.
(@vsetvl<mode>_no_side_effects): Delete.
(vsetvl_vtype_change_only): New MD pattern.
(@vsetvl_discard_result<mode>): Ditto.
* config/riscv/riscv-vsetvl.cc: New file.
* config/riscv/riscv-vsetvl.h: New file.
gcc/config.gcc
gcc/config/riscv/riscv-passes.def
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv-v.cc
gcc/config/riscv/riscv-vsetvl.cc [new file with mode: 0644]
gcc/config/riscv/riscv-vsetvl.h [new file with mode: 0644]
gcc/config/riscv/t-riscv
gcc/config/riscv/vector.md