]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Add auto-vectorization compile option for RVV
authorJu-Zhe Zhong <juzhe.zhong@rivai.ai>
Wed, 26 Apr 2023 03:05:54 +0000 (21:05 -0600)
committerJeff Law <jlaw@ventanamicro>
Wed, 26 Apr 2023 03:06:42 +0000 (21:06 -0600)
commit2fb7df82b8edd64ea31417592619c4cee00b05bc
treec94d1d6e0d685ee2e1a07157300ec44087583433
parent392200f807fe2ee377ecc451ff75894b89335c33
RISC-V: Add auto-vectorization compile option for RVV

This patch is adding 2 compile option for RVV auto-vectorization.
1. -param=riscv-autovec-preference=
   This option is to specify the auto-vectorization approach for RVV.
   Currently, we only support scalable and fixed-vlmax.

    - scalable means VLA auto-vectorization. The vector-length to compiler is
      unknown and runtime invariant. Such approach can allow us compile the code
      run on any vector-length RVV CPU.

    - fixed-vlmax means the compile known the RVV CPU vector-length, compile option
      in fixed-length VLS auto-vectorization. Meaning if we specify vector-length=512.
      The execution file can only run on vector-length = 512 RVV CPU.

    - TODO: we may need to support min-length VLS auto-vectorization, means the execution
      file can run on larger length RVV CPU.
2. -param=riscv-autovec-lmul=
   Specify LMUL choosing for RVV auto-vectorization.

gcc/ChangeLog:

* config/riscv/riscv-opts.h (enum riscv_autovec_preference_enum): Add enum for
auto-vectorization preference.
(enum riscv_autovec_lmul_enum): Add enum for choosing LMUL of RVV
auto-vectorization.
* config/riscv/riscv.opt: Add compile option for RVV auto-vectorization.
gcc/config/riscv/riscv-opts.h
gcc/config/riscv/riscv.opt