From: Juzhe-Zhong Date: Wed, 23 Aug 2023 02:32:30 +0000 (+0800) Subject: RISC-V: Fix VTYPE fuse rule bug X-Git-Tag: basepoints/gcc-15~6740 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29487eb237b893c673e9ecc6409b175e22792f13;p=thirdparty%2Fgcc.git RISC-V: Fix VTYPE fuse rule bug 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. --- diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 819a3918b3ec..ec1aaa4b442d 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -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; } diff --git a/gcc/config/riscv/riscv-vsetvl.def b/gcc/config/riscv/riscv-vsetvl.def index 7a73149f1dac..7289c01efcfe 100644 --- a/gcc/config/riscv/riscv-vsetvl.def +++ b/gcc/config/riscv/riscv-vsetvl.def @@ -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,