public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Boolean Vector, patch 4/5] Use boolean vectors in VEC_COND_EXPR
@ 2015-10-02 14:07 Ilya Enkovich
  2015-10-09 20:53 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Enkovich @ 2015-10-02 14:07 UTC (permalink / raw)
  To: gcc-patches

Hi,

This patch forces boolean vector usage in VEC_COND_EXPR generated by vectorizer.  VEC_COND_EXPR expand is fixed appropriately.

Thanks,
Ilya
--
gcc/

2015-10-02  Ilya Enkovich  <enkovich.gnu@gmail.com>

	* optabs.c (expand_vec_cond_expr): Accept boolean vector as
	condition operand.
	* tree-vect-stmts.c (vectorizable_condition): Use boolean
	vector type for vector comparison.


diff --git a/gcc/optabs.c b/gcc/optabs.c
index c49d66b..8d9d742 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -5365,16 +5365,17 @@ expand_vec_cond_expr (tree vec_cond_type, tree op0, tree op1, tree op2,
       op0a = TREE_OPERAND (op0, 0);
       op0b = TREE_OPERAND (op0, 1);
       tcode = TREE_CODE (op0);
+      unsignedp = TYPE_UNSIGNED (TREE_TYPE (op0a));
     }
   else
     {
       /* Fake op0 < 0.  */
-      gcc_assert (!TYPE_UNSIGNED (TREE_TYPE (op0)));
+      gcc_assert (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (op0)));
       op0a = op0;
       op0b = build_zero_cst (TREE_TYPE (op0));
       tcode = LT_EXPR;
+      unsignedp = false;
     }
-  unsignedp = TYPE_UNSIGNED (TREE_TYPE (op0a));
   cmp_op_mode = TYPE_MODE (TREE_TYPE (op0a));
 
 
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 2ff2827..e93f5ef 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -7384,10 +7384,7 @@ vectorizable_condition (gimple *stmt, gimple_stmt_iterator *gsi,
 	   && TREE_CODE (else_clause) != FIXED_CST)
     return false;
 
-  unsigned int prec = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vectype)));
-  /* The result of a vector comparison should be signed type.  */
-  tree cmp_type = build_nonstandard_integer_type (prec, 0);
-  vec_cmp_type = get_same_sized_vectype (cmp_type, vectype);
+  vec_cmp_type = build_same_sized_truth_vector_type (comp_vectype);
   if (vec_cmp_type == NULL_TREE)
     return false;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Boolean Vector, patch 4/5] Use boolean vectors in VEC_COND_EXPR
  2015-10-02 14:07 [Boolean Vector, patch 4/5] Use boolean vectors in VEC_COND_EXPR Ilya Enkovich
@ 2015-10-09 20:53 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-10-09 20:53 UTC (permalink / raw)
  To: Ilya Enkovich, gcc-patches

On 10/02/2015 08:07 AM, Ilya Enkovich wrote:
> Hi,
>
> This patch forces boolean vector usage in VEC_COND_EXPR generated by vectorizer.  VEC_COND_EXPR expand is fixed appropriately.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2015-10-02  Ilya Enkovich  <enkovich.gnu@gmail.com>
>
> 	* optabs.c (expand_vec_cond_expr): Accept boolean vector as
> 	condition operand.
> 	* tree-vect-stmts.c (vectorizable_condition): Use boolean
> 	vector type for vector comparison.
OK.

Jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-09 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02 14:07 [Boolean Vector, patch 4/5] Use boolean vectors in VEC_COND_EXPR Ilya Enkovich
2015-10-09 20:53 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).