diff options
author | Kito Cheng <kito.cheng@sifive.com> | 2023-10-03 10:27:24 +0800 |
---|---|---|
committer | Kito Cheng <kito.cheng@sifive.com> | 2023-10-12 20:53:09 -0700 |
commit | 0f40e59f193f96f1bb0fa3e1c2d160567ed29b32 (patch) | |
tree | ff55af329f6f14a8043869cd7ea84f9969cd51b9 /gcc/config | |
parent | f0b05073bd3f0e5c8e55ef5a6fd16aa4518956a4 (diff) | |
download | gcc-0f40e59f193f96f1bb0fa3e1c2d160567ed29b32.zip gcc-0f40e59f193f96f1bb0fa3e1c2d160567ed29b32.tar.gz gcc-0f40e59f193f96f1bb0fa3e1c2d160567ed29b32.tar.bz2 |
RISC-V: Fix the riscv_legitimize_poly_move issue on targets where the minimal VLEN exceeds 512.
riscv_legitimize_poly_move was expected to ensure the poly value is at most 32
times smaller than the minimal VLEN (32 being derived from '4096 / 128').
This assumption held when our mode modeling was not so precisely defined.
However, now that we have modeled the mode size according to the correct minimal
VLEN info, the size difference between different RVV modes can be up to 64
times. For instance, comparing RVVMF64BI and RVVMF1BI, the sizes are [1, 1]
versus [64, 64] respectively.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_legitimize_poly_move): Bump
max_power to 64.
* config/riscv/riscv.h (MAX_POLY_VARIANT): New.
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/autovec/bug-01.C: New.
* g++.target/riscv/rvv/rvv.exp: Add autovec folder.
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/riscv/riscv.cc | 5 | ||||
-rw-r--r-- | gcc/config/riscv/riscv.h | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 66a55a7..4474625 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -2404,9 +2404,8 @@ riscv_legitimize_poly_move (machine_mode mode, rtx dest, rtx tmp, rtx src) } else { - /* FIXME: We currently DON'T support TARGET_MIN_VLEN > 4096. */ - int max_power = exact_log2 (4096 / 128); - for (int i = 0; i < max_power; i++) + int max_power = exact_log2 (MAX_POLY_VARIANT); + for (int i = 0; i <= max_power; i++) { int possible_div_factor = 1 << i; if (factor % (vlenb / possible_div_factor) == 0) diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index f43ff10..0164514 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -1191,4 +1191,9 @@ extern void riscv_remove_unneeded_save_restore_calls (void); #define OPTIMIZE_MODE_SWITCHING(ENTITY) (TARGET_VECTOR) #define NUM_MODES_FOR_MODE_SWITCHING {VXRM_MODE_NONE, riscv_vector::FRM_NONE} + +/* The size difference between different RVV modes can be up to 64 times. + e.g. RVVMF64BI vs RVVMF1BI on zvl512b, which is [1, 1] vs [64, 64]. */ +#define MAX_POLY_VARIANT 64 + #endif /* ! GCC_RISCV_H */ |