Commit e6f5c25d by Ilya Enkovich Committed by Ilya Enkovich

optabs.c (expand_binop_directly): Allow scalar mode for vec_pack_trunc_optab.

gcc/

	* optabs.c (expand_binop_directly): Allow scalar mode for
	vec_pack_trunc_optab.
	* tree-vect-loop.c (vect_determine_vectorization_factor): Skip
	boolean vector producers from pattern sequence when computing VF.
	* tree-vect-patterns.c (vect_vect_recog_func_ptrs) Add
	vect_recog_mask_conversion_pattern.
	(search_type_for_mask): Choose the smallest
	type if different size types are mixed.
	(build_mask_conversion): New.
	(vect_recog_mask_conversion_pattern): New.
	(vect_pattern_recog_1): Allow scalar mode for boolean vectype.
	* tree-vect-stmts.c (vectorizable_mask_load_store): Support masked
	load with pattern.
	(vectorizable_conversion): Support boolean vectors.
	(free_stmt_vec_info): Allow patterns for statements with no lhs.
	* tree-vectorizer.h (NUM_PATTERNS): Increase to 14.

From-SVN: r230103
parent f79fe06f
2015-11-10 Ilya Enkovich <enkovich.gnu@gmail.com>
* optabs.c (expand_binop_directly): Allow scalar mode for
vec_pack_trunc_optab.
* tree-vect-loop.c (vect_determine_vectorization_factor): Skip
boolean vector producers from pattern sequence when computing VF.
* tree-vect-patterns.c (vect_vect_recog_func_ptrs) Add
vect_recog_mask_conversion_pattern.
(search_type_for_mask): Choose the smallest
type if different size types are mixed.
(build_mask_conversion): New.
(vect_recog_mask_conversion_pattern): New.
(vect_pattern_recog_1): Allow scalar mode for boolean vectype.
* tree-vect-stmts.c (vectorizable_mask_load_store): Support masked
load with pattern.
(vectorizable_conversion): Support boolean vectors.
(free_stmt_vec_info): Allow patterns for statements with no lhs.
* tree-vectorizer.h (NUM_PATTERNS): Increase to 14.
2015-11-10 Ilya Enkovich <enkovich.gnu@gmail.com>
* config/i386/i386-protos.h (ix86_expand_sse_movcc): New.
* config/i386/i386.c (ix86_expand_sse_movcc): Make public.
Cast mask to FP mode if required.
......@@ -1047,7 +1047,8 @@ expand_binop_directly (machine_mode mode, optab binoptab,
/* The mode of the result is different then the mode of the
arguments. */
tmp_mode = insn_data[(int) icode].operand[0].mode;
if (GET_MODE_NUNITS (tmp_mode) != 2 * GET_MODE_NUNITS (mode))
if (VECTOR_MODE_P (mode)
&& GET_MODE_NUNITS (tmp_mode) != 2 * GET_MODE_NUNITS (mode))
{
delete_insns_since (last);
return NULL_RTX;
......
......@@ -492,20 +492,27 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
}
}
/* The vectorization factor is according to the smallest
scalar type (or the largest vector size, but we only
support one vector size per loop). */
if (!bool_result)
scalar_type = vect_get_smallest_scalar_type (stmt, &dummy,
&dummy);
if (dump_enabled_p ())
/* Don't try to compute VF out scalar types if we stmt
produces boolean vector. Use result vectype instead. */
if (VECTOR_BOOLEAN_TYPE_P (vectype))
vf_vectype = vectype;
else
{
dump_printf_loc (MSG_NOTE, vect_location,
"get vectype for scalar type: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type);
dump_printf (MSG_NOTE, "\n");
/* The vectorization factor is according to the smallest
scalar type (or the largest vector size, but we only
support one vector size per loop). */
if (!bool_result)
scalar_type = vect_get_smallest_scalar_type (stmt, &dummy,
&dummy);
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
"get vectype for scalar type: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type);
dump_printf (MSG_NOTE, "\n");
}
vf_vectype = get_vectype_for_scalar_type (scalar_type);
}
vf_vectype = get_vectype_for_scalar_type (scalar_type);
if (!vf_vectype)
{
if (dump_enabled_p ())
......
......@@ -1974,6 +1974,11 @@ vectorizable_mask_load_store (gimple *stmt, gimple_stmt_iterator *gsi,
/* Ensure that even with -fno-tree-dce the scalar MASK_LOAD is removed
from the IL. */
if (STMT_VINFO_RELATED_STMT (stmt_info))
{
stmt = STMT_VINFO_RELATED_STMT (stmt_info);
stmt_info = vinfo_for_stmt (stmt);
}
tree lhs = gimple_call_lhs (stmt);
new_stmt = gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
set_vinfo_for_stmt (new_stmt, stmt_info);
......@@ -2092,6 +2097,11 @@ vectorizable_mask_load_store (gimple *stmt, gimple_stmt_iterator *gsi,
{
/* Ensure that even with -fno-tree-dce the scalar MASK_LOAD is removed
from the IL. */
if (STMT_VINFO_RELATED_STMT (stmt_info))
{
stmt = STMT_VINFO_RELATED_STMT (stmt_info);
stmt_info = vinfo_for_stmt (stmt);
}
tree lhs = gimple_call_lhs (stmt);
new_stmt = gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
set_vinfo_for_stmt (new_stmt, stmt_info);
......@@ -3565,12 +3575,13 @@ vectorizable_conversion (gimple *stmt, gimple_stmt_iterator *gsi,
&& SCALAR_FLOAT_TYPE_P (rhs_type))))
return false;
if ((INTEGRAL_TYPE_P (lhs_type)
&& (TYPE_PRECISION (lhs_type)
!= GET_MODE_PRECISION (TYPE_MODE (lhs_type))))
|| (INTEGRAL_TYPE_P (rhs_type)
&& (TYPE_PRECISION (rhs_type)
!= GET_MODE_PRECISION (TYPE_MODE (rhs_type)))))
if (!VECTOR_BOOLEAN_TYPE_P (vectype_out)
&& ((INTEGRAL_TYPE_P (lhs_type)
&& (TYPE_PRECISION (lhs_type)
!= GET_MODE_PRECISION (TYPE_MODE (lhs_type))))
|| (INTEGRAL_TYPE_P (rhs_type)
&& (TYPE_PRECISION (rhs_type)
!= GET_MODE_PRECISION (TYPE_MODE (rhs_type))))))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
......@@ -3628,6 +3639,21 @@ vectorizable_conversion (gimple *stmt, gimple_stmt_iterator *gsi,
return false;
}
if (VECTOR_BOOLEAN_TYPE_P (vectype_out)
&& !VECTOR_BOOLEAN_TYPE_P (vectype_in))
{
if (dump_enabled_p ())
{
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"can't convert between boolean and non "
"boolean vectors");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, rhs_type);
dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
if (nunits_in < nunits_out)
......@@ -8217,7 +8243,7 @@ free_stmt_vec_info (gimple *stmt)
gimple *patt_stmt = STMT_VINFO_STMT (patt_info);
gimple_set_bb (patt_stmt, NULL);
tree lhs = gimple_get_lhs (patt_stmt);
if (TREE_CODE (lhs) == SSA_NAME)
if (lhs && TREE_CODE (lhs) == SSA_NAME)
release_ssa_name (lhs);
if (seq)
{
......@@ -8227,7 +8253,7 @@ free_stmt_vec_info (gimple *stmt)
gimple *seq_stmt = gsi_stmt (si);
gimple_set_bb (seq_stmt, NULL);
lhs = gimple_get_lhs (seq_stmt);
if (TREE_CODE (lhs) == SSA_NAME)
if (lhs && TREE_CODE (lhs) == SSA_NAME)
release_ssa_name (lhs);
free_stmt_vec_info (seq_stmt);
}
......
......@@ -1087,7 +1087,7 @@ extern gimple *vect_find_last_scalar_stmt_in_slp (slp_tree);
Additional pattern recognition functions can (and will) be added
in the future. */
typedef gimple *(* vect_recog_func_ptr) (vec<gimple *> *, tree *, tree *);
#define NUM_PATTERNS 13
#define NUM_PATTERNS 14
void vect_pattern_recog (vec_info *);
/* In tree-vectorizer.c. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment