diff options
author | Jin Ma <jinma@linux.alibaba.com> | 2025-01-13 11:15:55 -0700 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro.com> | 2025-01-13 11:17:23 -0700 |
commit | 8d577a01cdbe02a23724b710b579b7811c983c33 (patch) | |
tree | 84a1dae9bc580cd32228fadcbebe6f1e1e871c3f /gcc/config/riscv | |
parent | 7102620067eebfbfb895dccd5ddd26870178c83f (diff) | |
download | gcc-8d577a01cdbe02a23724b710b579b7811c983c33.zip gcc-8d577a01cdbe02a23724b710b579b7811c983c33.tar.gz gcc-8d577a01cdbe02a23724b710b579b7811c983c33.tar.bz2 |
RISC-V: Fix the result error caused by not updating ratio when using "use_max_sew" to merge vsetvl
When the vsetvl instructions of the two RVV instructions are merged
using "use_max_sew", it is possible to update the sew of prev if
prev.sew < next.sew, but keep the original ratio, which is obviously
wrong. when the subsequent instructions are equal to the wrong ratio,
it is possible to generate the wrong "vsetvli zero,zero" instruction,
which will lead to unknown avl.
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (demand_system::use_max_sew): Also
set the ratio for PREV.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/bug-10.c: New test.
Diffstat (limited to 'gcc/config/riscv')
-rw-r--r-- | gcc/config/riscv/riscv-vsetvl.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 851e52a..e9de217 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1722,6 +1722,7 @@ private: { int max_sew = MAX (prev.get_sew (), next.get_sew ()); prev.set_sew (max_sew); + prev.set_ratio (calculate_ratio (prev.get_sew (), prev.get_vlmul ())); use_min_of_max_sew (prev, next); } inline void use_next_sew_lmul (vsetvl_info &prev, const vsetvl_info &next) |