diff mbox

Fix c-c++-common/torture/vector-compare-1.c on powerpc

Message ID 20151105122129.GA25378@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich Nov. 5, 2015, 12:21 p.m. UTC
On 29 Oct 15:29, Richard Biener wrote:
> 
> I think this should unconditionally produce the COND_EXPR and
> build cst_true using build_all_ones_cst (stype).
> 
> Ok with that change.
> 
> Thanks,
> Richard.
> 

Here is an updated patch version.  Bootstrapped and regtested on powerpc64le-unknown-linux-gnu and x86_64-unknown-linux-gnu.  Applied to trunk.

Thanks,
Ilya
--
gcc/

2015-11-05  Ilya Enkovich  <enkovich.gnu@gmail.com>

	* tree-vect-generic.c (do_compare): Use -1 for true
	result instead of 1.
diff mbox

Patch

diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index d0a4e0f..b59f699 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -161,10 +161,16 @@  static tree
 do_compare (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b,
 	    tree bitpos, tree bitsize, enum tree_code code, tree type)
 {
+  tree stype = TREE_TYPE (type);
+  tree cst_false = build_zero_cst (stype);
+  tree cst_true = build_all_ones_cst (stype);
+  tree cmp;
+
   a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos);
   b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos);
 
-  return gimplify_build2 (gsi, code, TREE_TYPE (type), a, b);
+  cmp = build2 (code, boolean_type_node, a, b);
+  return gimplify_build3 (gsi, COND_EXPR, stype, cmp, cst_true, cst_false);
 }
 
 /* Expand vector addition to scalars.  This does bit twiddling