This is the mail archive of the gcc-patches@gcc.gnu.org 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: [PATCH, PR middle-end/71279] Avoid folding vec_cond_expr into comparison


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;
> +}


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