This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR middle-end/71279] Avoid folding vec_cond_expr into comparison
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 27 May 2016 12:04:27 +0200
- Subject: Re: [PATCH, PR middle-end/71279] Avoid folding vec_cond_expr into comparison
- Authentication-results: sourceware.org; auth=none
- References: <20160527090230 dot GA38654 at msticlxl57 dot ims dot intel dot com>
On Fri, May 27, 2016 at 11:02 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> Hi,
>
> This patch disable transformation of VEC_COND_EXPR into comparison
> which became invalid after boolean vectors introduciton.
>
> Bootstrapped and regtested for x86_64-pc-linux-gnu. OK for trunk
> and gcc-6?
Ok.
Thanks,
Richard.
> Thanks,
> Ilya
> --
> gcc/
>
> 2016-05-27 Ilya Enkovich <ilya.enkovich@intel.com>
>
> PR middle-end/71279
> * fold-const.c (fold_ternary_loc): Don't fold VEC_COND_EXPR
> into comparison.
>
> gcc/testsuite/
>
> 2016-05-27 Ilya Enkovich <ilya.enkovich@intel.com>
>
> PR middle-end/71279
> * gcc.dg/pr71279.c: New test.
>
>
> diff --git a/gcc/fold-const.c b/gcc/fold-const.c
> index 556fc73..5058746 100644
> --- a/gcc/fold-const.c
> +++ b/gcc/fold-const.c
> @@ -11515,9 +11515,9 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
> /* Convert A ? 0 : 1 to !A. This prefers the use of NOT_EXPR
> over COND_EXPR in cases such as floating point comparisons. */
> if (integer_zerop (op1)
> - && (code == VEC_COND_EXPR ? integer_all_onesp (op2)
> - : (integer_onep (op2)
> - && !VECTOR_TYPE_P (type)))
> + && code == COND_EXPR
> + && integer_onep (op2)
> + && !VECTOR_TYPE_P (type)
> && truth_value_p (TREE_CODE (arg0)))
> return pedantic_non_lvalue_loc (loc,
> fold_convert_loc (loc, type,
> diff --git a/gcc/testsuite/gcc.dg/pr71279.c b/gcc/testsuite/gcc.dg/pr71279.c
> new file mode 100644
> index 0000000..4ecc84b
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr71279.c
> @@ -0,0 +1,14 @@
> +/* PR middle-end/71279 */
> +/* { dg-do compile } */
> +/* { dg-options "-O3" } */
> +/* { dg-additional-options "-march=knl" { target { i?86-*-* x86_64-*-* } } } */
> +
> +extern int a, b;
> +long c[1][1][1];
> +long d[1][1];
> +
> +void fn1 ()
> +{
> + for (int e = 0; e < b; e = e + 1)
> + *(e + **c) = (a && *d[1]) - 1;
> +}