Hi Lehua, >> Would it hurt to allow any nonmemory operand here and just force the >> "unsupported" constants into a register? > > Are you talking about why operand 2 doesn't use nonmemory_operand > predicate? If so, I think this is because our vmerge.v[vxi]m insns > only supports that operand 1 is a scalar and operand 2 must be a > vector register.
My question was rather: Why doesn't something like (define_insn_and_split "vcond_mask_<mode><vm>" [(set (match_operand:V_VLS 0 "register_operand") (if_then_else:V_VLS (match_operand:<VM> 3 "register_operand") (match_operand:V_VLS 1 "nonmemory_operand") (match_operand:V_VLS 2 "nonmemory_operand")))] "TARGET_VECTOR && can_create_pseudo_p ()" "#" "&& 1" [(const_int 0)] { /* The order of vcond_mask is opposite to pred_merge. */ if (REG_P (operands[2])) operands[2] = force_reg (<MODE>mode, operands[2]); std::swap (operands[1], operands[2]); riscv_vector::emit_vlmax_insn (code_for_pred_merge (<MODE>mode), riscv_vector::MERGE_OP, operands); DONE; } [(set_attr "type" "vector")] ) suffice? You could disallow operands[2] != 0 if needed. Regards Robin