@@ -2876,6 +2876,23 @@ pre_vsetvl::fuse_local_vsetvl_info ()
curr_info.dump (dump_file, " ");
fprintf (dump_file, "\n");
}
+ /* Even though prev_info is available with curr_info,
+ we need to update the MAX_SEW of prev_info since
+ we don't check MAX_SEW in available_p check.
+
+ prev_info:
+ Demand fields: demand_ratio_and_ge_sew demand_avl
+ SEW=16, VLMUL=mf4, RATIO=64, MAX_SEW=64
+
+ curr_info:
+ Demand fields: demand_ge_sew demand_non_zero_avl
+ SEW=16, VLMUL=m1, RATIO=16, MAX_SEW=32
+
+ In the example above, prev_info is available with
+ curr_info, we need to update prev_info MAX_SEW from
+ 64 into 32. */
+ prev_info.set_max_sew (
+ MIN (prev_info.get_max_sew (), curr_info.get_max_sew ()));
if (!curr_info.vl_used_by_non_rvv_insn_p ()
&& vsetvl_insn_p (curr_info.get_insn ()->rtl ()))
m_delete_list.safe_push (curr_info);
new file mode 100644
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=generic-ooo --param=riscv-autovec-preference=scalable -march=rv32gc_zve64f_zvfh -mabi=ilp32d -O3" } */
+
+#include "riscv_vector.h"
+
+void foo(_Float16 y, int64_t *i64p)
+{
+ vint64m1_t vx =__riscv_vle64_v_i64m1 (i64p, 1);
+ vx = __riscv_vadd_vv_i64m1 (vx, vx, 1);
+ vfloat16m1_t vy =__riscv_vfmv_s_f_f16m1 (y, 1);
+ asm volatile ("# use %0 %1" : : "vr"(vx), "vr" (vy));
+}
+
+/* { dg-final { scan-assembler-times {vsetivli\s+zero,\s*1,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 1 } } */
+/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e64,\s*m1,\s*t[au],\s*m[au]} 1 } } */