gimple_match_op op;
if (!gimple_extract_op (stmt_info->stmt, &op))
gcc_unreachable ();
- gcc_assert (op.code.is_tree_code ());
- auto code = tree_code (op.code);
/* All uses but the last are expected to be defined in the loop.
The last use is the reduction variable. In case of nested cycle this
vec_num = 1;
}
- internal_fn cond_fn = get_conditional_internal_fn (code);
+ code_helper code = canonicalize_code (op.code, op.type);
+ internal_fn cond_fn = get_conditional_internal_fn (code, op.type);
vec_loop_masks *masks = &LOOP_VINFO_MASKS (loop_vinfo);
bool mask_by_cond_expr = use_mask_by_cond_expr_p (code, cond_fn, vectype_in);
if (reduction_type == FOLD_LEFT_REDUCTION)
{
internal_fn reduc_fn = STMT_VINFO_REDUC_FN (reduc_info);
+ gcc_assert (code.is_tree_code ());
return vectorize_fold_left_reduction
- (loop_vinfo, stmt_info, gsi, vec_stmt, slp_node, reduc_def_phi, code,
- reduc_fn, op.ops, vectype_in, reduc_index, masks);
+ (loop_vinfo, stmt_info, gsi, vec_stmt, slp_node, reduc_def_phi,
+ tree_code (code), reduc_fn, op.ops, vectype_in, reduc_index, masks);
}
bool single_defuse_cycle = STMT_VINFO_FORCE_SINGLE_CYCLE (reduc_info);
|| code == SAD_EXPR);
/* Create the destination vector */
- tree scalar_dest = gimple_assign_lhs (stmt_info->stmt);
+ tree scalar_dest = gimple_get_lhs (stmt_info->stmt);
tree vec_dest = vect_create_destination_var (scalar_dest, vectype_out);
vect_get_vec_defs (loop_vinfo, stmt_info, slp_node, ncopies,
/* Make sure that the reduction accumulator is vop[0]. */
if (reduc_index == 1)
{
- gcc_assert (commutative_tree_code (code));
+ gcc_assert (commutative_binary_op_p (code, op.type));
std::swap (vop[0], vop[1]);
}
tree mask = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
if (emulated_mixed_dot_prod)
new_stmt = vect_emulate_mixed_dot_prod (loop_vinfo, stmt_info, gsi,
vec_dest, vop);
+ else if (code.is_internal_fn ())
+ new_stmt = gimple_build_call_internal (internal_fn (code),
+ op.num_ops,
+ vop[0], vop[1], vop[2]);
else
- new_stmt = gimple_build_assign (vec_dest, code,
+ new_stmt = gimple_build_assign (vec_dest, tree_code (op.code),
vop[0], vop[1], vop[2]);
new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_assign_set_lhs (new_stmt, new_temp);
+ gimple_set_lhs (new_stmt, new_temp);
vect_finish_stmt_generation (loop_vinfo, stmt_info, new_stmt, gsi);
}