RISC-V: Fix VTYPE fuse rule bug
Checks
Commit Message
This bug is exposed after refactor patch.
Separate it and commited.
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (ge_sew_ratio_unavailable_p): Fix fuse rule bug.
* config/riscv/riscv-vsetvl.def (DEF_SEW_LMUL_FUSE_RULE): Ditto.
---
gcc/config/riscv/riscv-vsetvl.cc | 10 ++++++++--
gcc/config/riscv/riscv-vsetvl.def | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
@@ -1423,8 +1423,14 @@ static bool
ge_sew_ratio_unavailable_p (const vector_insn_info &info1,
const vector_insn_info &info2)
{
- if (!info2.demand_p (DEMAND_LMUL) && info2.demand_p (DEMAND_GE_SEW))
- return info1.get_sew () < info2.get_sew ();
+ if (!info2.demand_p (DEMAND_LMUL))
+ {
+ if (info2.demand_p (DEMAND_GE_SEW))
+ return info1.get_sew () < info2.get_sew ();
+ /* Demand GE_SEW should be available for non-demand SEW. */
+ else if (!info2.demand_p (DEMAND_SEW))
+ return false;
+ }
return true;
}
@@ -319,7 +319,7 @@ DEF_SEW_LMUL_FUSE_RULE (/*SEW*/ DEMAND_TRUE, /*LMUL*/ DEMAND_FALSE,
/*RATIO*/ DEMAND_TRUE, /*GE_SEW*/ DEMAND_FALSE,
/*NEW_DEMAND_SEW*/ true,
/*NEW_DEMAND_LMUL*/ false,
- /*NEW_DEMAND_RATIO*/ false,
+ /*NEW_DEMAND_RATIO*/ true,
/*NEW_DEMAND_GE_SEW*/ true, first_sew,
vlmul_for_first_sew_second_ratio, second_ratio)
DEF_SEW_LMUL_FUSE_RULE (/*SEW*/ DEMAND_TRUE, /*LMUL*/ DEMAND_FALSE,