This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix c-c++-common/torture/vector-compare-1.c on powerpc
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 5 Nov 2015 15:21:29 +0300
- Subject: Re: [PATCH] Fix c-c++-common/torture/vector-compare-1.c on powerpc
- Authentication-results: sourceware.org; auth=none
- References: <20151029134205 dot GA18424 at msticlxl57 dot ims dot intel dot com> <CAFiYyc1esq4bB66d8ttVX7hE_5_pe7hy8-2FybhLERqSqWz9pA at mail dot gmail dot com>
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 --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