]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Fix VTYPE fuse rule bug
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Wed, 23 Aug 2023 02:32:30 +0000 (10:32 +0800)
committerPan Li <pan2.li@intel.com>
Wed, 23 Aug 2023 02:37:39 +0000 (10:37 +0800)
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
gcc/config/riscv/riscv-vsetvl.def

index 819a3918b3ece3608ad411a8cbd4ada622f1d119..ec1aaa4b442dec7fbdea01b69a6440baf2a314e8 100644 (file)
@@ -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;
 }
 
index 7a73149f1dacba2c54295088cce69691d4e936df..7289c01efcfe4d9dcd718a6da072053f3564eb78 100644 (file)
@@ -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,