[(match_operand:V 0 "register_operand")
(match_operand:V 1 "memory_operand")
(match_operand:<VM> 2 "vector_mask_operand")
- (match_operand 3 "autovec_length_operand")
- (match_operand 4 "const_0_operand")]
+ (match_operand:V 3 "maskload_else_operand")
+ (match_operand 4 "autovec_length_operand")
+ (match_operand 5 "const_0_operand")]
"TARGET_VECTOR"
{
riscv_vector::expand_load_store (operands, true);
(match_operand 3 "<RATIO64:gs_extension>")
(match_operand 4 "<RATIO64:gs_scale>")
(match_operand:<RATIO64:VM> 5 "vector_mask_operand")
- (match_operand 6 "autovec_length_operand")
- (match_operand 7 "const_0_operand")]
+ (match_operand 6 "maskload_else_operand")
+ (match_operand 7 "autovec_length_operand")
+ (match_operand 8 "const_0_operand")]
"TARGET_VECTOR && riscv_vector::gather_scatter_valid_offset_p (<RATIO64I:MODE>mode)"
{
riscv_vector::expand_gather_scatter (operands, true);
(match_operand 3 "<RATIO32:gs_extension>")
(match_operand 4 "<RATIO32:gs_scale>")
(match_operand:<RATIO32:VM> 5 "vector_mask_operand")
- (match_operand 6 "autovec_length_operand")
- (match_operand 7 "const_0_operand")]
+ (match_operand 6 "maskload_else_operand")
+ (match_operand 7 "autovec_length_operand")
+ (match_operand 8 "const_0_operand")]
"TARGET_VECTOR && riscv_vector::gather_scatter_valid_offset_p (<RATIO32I:MODE>mode)"
{
riscv_vector::expand_gather_scatter (operands, true);
(match_operand 3 "<RATIO16:gs_extension>")
(match_operand 4 "<RATIO16:gs_scale>")
(match_operand:<RATIO16:VM> 5 "vector_mask_operand")
- (match_operand 6 "autovec_length_operand")
- (match_operand 7 "const_0_operand")]
+ (match_operand 6 "maskload_else_operand")
+ (match_operand 7 "autovec_length_operand")
+ (match_operand 8 "const_0_operand")]
"TARGET_VECTOR && riscv_vector::gather_scatter_valid_offset_p (<RATIO16I:MODE>mode)"
{
riscv_vector::expand_gather_scatter (operands, true);
(match_operand 3 "<RATIO8:gs_extension>")
(match_operand 4 "<RATIO8:gs_scale>")
(match_operand:<RATIO8:VM> 5 "vector_mask_operand")
- (match_operand 6 "autovec_length_operand")
- (match_operand 7 "const_0_operand")]
+ (match_operand 6 "maskload_else_operand")
+ (match_operand 7 "autovec_length_operand")
+ (match_operand 8 "const_0_operand")]
"TARGET_VECTOR && riscv_vector::gather_scatter_valid_offset_p (<RATIO8I:MODE>mode)"
{
riscv_vector::expand_gather_scatter (operands, true);
(match_operand 3 "<RATIO4:gs_extension>")
(match_operand 4 "<RATIO4:gs_scale>")
(match_operand:<RATIO4:VM> 5 "vector_mask_operand")
- (match_operand 6 "autovec_length_operand")
- (match_operand 7 "const_0_operand")]
+ (match_operand 6 "maskload_else_operand")
+ (match_operand 7 "autovec_length_operand")
+ (match_operand 8 "const_0_operand")]
"TARGET_VECTOR && riscv_vector::gather_scatter_valid_offset_p (<RATIO4I:MODE>mode)"
{
riscv_vector::expand_gather_scatter (operands, true);
(match_operand 3 "<RATIO2:gs_extension>")
(match_operand 4 "<RATIO2:gs_scale>")
(match_operand:<RATIO2:VM> 5 "vector_mask_operand")
- (match_operand 6 "autovec_length_operand")
- (match_operand 7 "const_0_operand")]
+ (match_operand 6 "maskload_else_operand")
+ (match_operand 7 "autovec_length_operand")
+ (match_operand 8 "const_0_operand")]
"TARGET_VECTOR && riscv_vector::gather_scatter_valid_offset_p (<RATIO2I:MODE>mode)"
{
riscv_vector::expand_gather_scatter (operands, true);
(match_operand 3 "<gs_extension>")
(match_operand 4 "<gs_scale>")
(match_operand:<VM> 5 "vector_mask_operand")
- (match_operand 6 "autovec_length_operand")
- (match_operand 7 "const_0_operand")]
+ (match_operand 6 "maskload_else_operand")
+ (match_operand 7 "autovec_length_operand")
+ (match_operand 8 "const_0_operand")]
"TARGET_VECTOR"
{
riscv_vector::expand_gather_scatter (operands, true);
[(match_operand:VT 0 "register_operand")
(match_operand:VT 1 "memory_operand")
(match_operand:<VM> 2 "vector_mask_operand")
- (match_operand 3 "autovec_length_operand")
- (match_operand 4 "const_0_operand")]
+ (match_operand 3 "maskload_else_operand")
+ (match_operand 4 "autovec_length_operand")
+ (match_operand 5 "const_0_operand")]
"TARGET_VECTOR_AUTOVEC_SEGMENT"
{
riscv_vector::expand_lanes_load_store (operands, true);
(match_operand 1 "pmode_reg_or_0_operand")
(match_operand 2 "pmode_reg_or_0_operand")
(match_operand:<VM> 3 "vector_mask_operand")
- (match_operand 4 "autovec_length_operand")
- (match_operand 5 "const_0_operand")]
+ (match_operand 4 "maskload_else_operand")
+ (match_operand 5 "autovec_length_operand")
+ (match_operand 6 "const_0_operand")]
"TARGET_VECTOR"
{
riscv_vector::expand_strided_load (<MODE>mode, operands);
emit_insn (gen_no_side_effects_vsetvl_rtx (rvv_mode, ops[0], ops[1]));
}
+/* Return RVV_VUNDEF if the ELSE value is scratch rtx. */
+static rtx
+get_else_operand (rtx op)
+{
+ return GET_CODE (op) == SCRATCH ? RVV_VUNDEF (GET_MODE (op)) : op;
+}
+
/* Expand MASK_LEN_{LOAD,STORE}. */
void
expand_load_store (rtx *ops, bool is_load)
{
- rtx mask = ops[2];
- rtx len = ops[3];
+ int idx = 2;
+ rtx mask = ops[idx++];
+ /* A masked load has a merge/else operand. */
+ if (is_load)
+ get_else_operand (ops[idx++]);
+ rtx len = ops[idx];
machine_mode mode = GET_MODE (ops[0]);
if (is_vlmax_len_p (mode, len))
rtx base = ops[1];
rtx stride = ops[2];
rtx mask = ops[3];
- rtx len = ops[4];
+ int idx = 4;
+ get_else_operand (ops[idx++]);
+ rtx len = ops[idx];
poly_int64 len_val;
insn_code icode = code_for_pred_strided_load (mode);
emit_nonvlmax_insn (icode, insn_flags, ops, len);
}
-/* Return RVV_VUNDEF if the ELSE value is scratch rtx. */
-static rtx
-get_else_operand (rtx op)
-{
- return GET_CODE (op) == SCRATCH ? RVV_VUNDEF (GET_MODE (op)) : op;
-}
-
/* Expand unary ops COND_LEN_*. */
void
expand_cond_len_unop (unsigned icode, rtx *ops)
int shift;
rtx mask = ops[5];
rtx len = ops[6];
+ if (is_load)
+ len = ops[7];
if (is_load)
{
vec_reg = ops[0];
{
rtx mask = ops[2];
rtx len = ops[3];
+ if (is_load)
+ len = ops[4];
rtx addr = is_load ? XEXP (ops[1], 0) : XEXP (ops[0], 0);
rtx reg = is_load ? ops[0] : ops[1];
machine_mode mode = GET_MODE (ops[0]);