* [PATCH, PR middle-end/71279] Avoid folding vec_cond_expr into comparison
@ 2016-05-27 11:11 Ilya Enkovich
2016-05-27 12:02 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Ilya Enkovich @ 2016-05-27 11:11 UTC (permalink / raw)
To: gcc-patches
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?
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;
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH, PR middle-end/71279] Avoid folding vec_cond_expr into comparison
2016-05-27 11:11 [PATCH, PR middle-end/71279] Avoid folding vec_cond_expr into comparison Ilya Enkovich
@ 2016-05-27 12:02 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-05-27 12:02 UTC (permalink / raw)
To: Ilya Enkovich; +Cc: GCC Patches
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;
> +}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-27 10:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27 11:11 [PATCH, PR middle-end/71279] Avoid folding vec_cond_expr into comparison Ilya Enkovich
2016-05-27 12:02 ` Richard Biener
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).