return loop_len;
}
+/* Generate the tree for the loop len mask and return it. Given the lens,
+ nvectors, vectype, index and factor to gen the len mask as below.
+
+ tree len_mask = VCOND_MASK_LEN (compare_mask, ones, zero, len, bias)
+*/
+tree
+vect_gen_loop_len_mask (loop_vec_info loop_vinfo, gimple_stmt_iterator *gsi,
+ gimple_stmt_iterator *cond_gsi, vec_loop_lens *lens,
+ unsigned int nvectors, tree vectype, tree stmt,
+ unsigned int index, unsigned int factor)
+{
+ tree all_one_mask = build_all_ones_cst (vectype);
+ tree all_zero_mask = build_zero_cst (vectype);
+ tree len = vect_get_loop_len (loop_vinfo, gsi, lens, nvectors, vectype, index,
+ factor);
+ tree bias = build_int_cst (intQI_type_node,
+ LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo));
+ tree len_mask = make_temp_ssa_name (TREE_TYPE (stmt), NULL, "vec_len_mask");
+ gcall *call = gimple_build_call_internal (IFN_VCOND_MASK_LEN, 5, stmt,
+ all_one_mask, all_zero_mask, len,
+ bias);
+ gimple_call_set_lhs (call, len_mask);
+ gsi_insert_before (cond_gsi, call, GSI_SAME_STMT);
+
+ return len_mask;
+}
+
/* Scale profiling counters by estimation for LOOP which is vectorized
by factor VF.
If FLAT is true, the loop we started with had unrealistically flat
ncopies = vect_get_num_copies (loop_vinfo, vectype);
vec_loop_masks *masks = &LOOP_VINFO_MASKS (loop_vinfo);
+ vec_loop_lens *lens = &LOOP_VINFO_LENS (loop_vinfo);
bool masked_loop_p = LOOP_VINFO_FULLY_MASKED_P (loop_vinfo);
+ bool len_loop_p = LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo);
/* Now build the new conditional. Pattern gimple_conds get dropped during
codegen so we must replace the original insn. */
{
if (direct_internal_fn_supported_p (IFN_VCOND_MASK_LEN, vectype,
OPTIMIZE_FOR_SPEED))
- return false;
+ vect_record_loop_len (loop_vinfo, lens, ncopies, vectype, 1);
else
vect_record_loop_mask (loop_vinfo, masks, ncopies, vectype, NULL);
}
-
return true;
}
stmts[i], &cond_gsi);
workset.quick_push (stmt_mask);
}
+ else if (len_loop_p)
+ for (unsigned i = 0; i < stmts.length (); i++)
+ {
+ tree len_mask = vect_gen_loop_len_mask (loop_vinfo, gsi, &cond_gsi,
+ lens, ncopies, vectype,
+ stmts[i], i, 1);
+
+ workset.quick_push (len_mask);
+ }
else
workset.splice (stmts);
new_temp = prepare_vec_mask (loop_vinfo, TREE_TYPE (mask), mask,
new_temp, &cond_gsi);
}
+ else if (len_loop_p)
+ new_temp = vect_gen_loop_len_mask (loop_vinfo, gsi, &cond_gsi, lens,
+ ncopies, vectype, new_temp, 0, 1);
}
gcc_assert (new_temp);
extern tree vect_get_loop_len (loop_vec_info, gimple_stmt_iterator *,
vec_loop_lens *, unsigned int, tree,
unsigned int, unsigned int);
+extern tree vect_gen_loop_len_mask (loop_vec_info, gimple_stmt_iterator *,
+ gimple_stmt_iterator *, vec_loop_lens *,
+ unsigned int, tree, tree, unsigned int,
+ unsigned int);
extern gimple_seq vect_gen_len (tree, tree, tree, tree);
extern stmt_vec_info info_for_reduction (vec_info *, stmt_vec_info);
extern bool reduction_fn_for_scalar_code (code_helper, internal_fn *);