diff options
author | xuli <xuli1@eswincomputing.com> | 2024-11-12 02:31:28 +0000 |
---|---|---|
committer | xuli <xuli1@eswincomputing.com> | 2024-11-13 04:12:18 +0000 |
commit | 445d8bb6a89eb2275c4930ec87a98d5123e5abdd (patch) | |
tree | 5476901adaed04ee46f0eb7ab11801352746381c /gcc/config/riscv | |
parent | eeb5c6acf7198f057419b4d4bce34b58b12c2287 (diff) | |
download | gcc-445d8bb6a89eb2275c4930ec87a98d5123e5abdd.zip gcc-445d8bb6a89eb2275c4930ec87a98d5123e5abdd.tar.gz gcc-445d8bb6a89eb2275c4930ec87a98d5123e5abdd.tar.bz2 |
RISC-V: Bugfix for max_sew_overlap_and_next_ratio_valid_for_prev_sew_p[pr117483]
This patch fixs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117483
If prev and next satisfy the following rules, we should forbid the case
(next.get_sew() < prev.get_sew() && (!next.get_ta() || !next.get_ma()))
in the compatible function max_sew_overlap_and_next_ratio_valid_for_prev_sew_p.
Otherwise, the tail elements of next will be polluted.
DEF_SEW_LMUL_RULE (ge_sew, ratio_and_ge_sew, ratio_and_ge_sew,
max_sew_overlap_and_next_ratio_valid_for_prev_sew_p,
always_false, use_max_sew_and_lmul_with_next_ratio)
Passed the rv64gcv full regression test.
Signed-off-by: Li Xu <xuli1@eswincomputing.com>
PR target/117483
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc: Fix bug.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/pr117483.c: New test.
Diffstat (limited to 'gcc/config/riscv')
-rw-r--r-- | gcc/config/riscv/riscv-vsetvl.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 0b53b20..35c69a9 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1480,8 +1480,15 @@ private: max_sew_overlap_and_next_ratio_valid_for_prev_sew_p (const vsetvl_info &prev, const vsetvl_info &next) { - return next_ratio_valid_for_prev_sew_p (prev, next) - && max_sew_overlap_p (prev, next); + if (next_ratio_valid_for_prev_sew_p (prev, next) + && max_sew_overlap_p (prev, next)) + { + if (next.get_sew () < prev.get_sew () + && (!next.get_ta () || !next.get_ma ())) + return false; + return true; + } + return false; } inline bool sew_le_and_next_sew_le_prev_max_sew_and_ratio_eq_p (const vsetvl_info &prev, |