This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [vec-cmp, patch 1/6] Add optabs for vector comparison

On 10/08/2015 08:52 AM, Ilya Enkovich wrote:

This series introduces autogeneration of vector comparison and its support on i386 target.  It lets comparison statements to be vectorized into vector comparison instead of VEC_COND_EXPR.  This allows to avoid some restrictions implied by boolean patterns.  This series applies on top of bolean vectors series [1].

This patch introduces optabs for vector comparison.



2015-10-08  Ilya Enkovich  <>

	* expr.c (do_store_flag): Use expand_vec_cmp_expr for mask results.
	* optabs-query.h (get_vec_cmp_icode): New.
	* optabs-tree.c (expand_vec_cmp_expr_p): New.
	* optabs-tree.h (expand_vec_cmp_expr_p): New.
	* optabs.c (vector_compare_rtx): Add OPNO arg.
	(expand_vec_cond_expr): Adjust to vector_compare_rtx change.
	(expand_vec_cmp_expr): New.
	* optabs.def (vec_cmp_optab): New.
	(vec_cmpu_optab): New.
	* optabs.h (expand_vec_cmp_expr): New.
	* tree-vect-generic.c (expand_vector_comparison): Add vector
	comparison optabs check.

diff --git a/gcc/optabs-tree.c b/gcc/optabs-tree.c
index 3b03338..aa863cf 100644
--- a/gcc/optabs-tree.c
+++ b/gcc/optabs-tree.c
@@ -320,6 +320,19 @@ supportable_convert_operation (enum tree_code code,
    return false;

+/* Return TRUE if appropriate vector insn is available
+   for vector comparison expr with vector type VALUE_TYPE
+   and resulting mask with MASK_TYPE.  */
+expand_vec_cmp_expr_p (tree value_type, tree mask_type)
+  enum insn_code icode = get_vec_cmp_icode (TYPE_MODE (value_type),
+					    TYPE_MODE (mask_type),
+					    TYPE_UNSIGNED (value_type));
+  return (icode != CODE_FOR_nothing);
Nothing inherently wrong with the code, but it seems like it's in the wrong place. Why optabs-tree rather than optabs-query?

I think with that fixed this patch will be ready to go onto the trunk.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]