From: Ilya Enkovich Date: Tue, 22 Mar 2016 12:31:12 +0000 (+0000) Subject: re PR target/70290 (-mavx512vl breaks parsing of C++ vector condition) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6cedf92249d5a183471723129c3d436fde95b0a0;p=gcc.git re PR target/70290 (-mavx512vl breaks parsing of C++ vector condition) gcc/cp/ PR target/70290 * call.c (build_conditional_expr_1): Always use original condition type for vector type checks and build. gcc/testsuite/ PR target/70290 * g++.dg/ext/pr70290.C: New test. From-SVN: r234399 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index adf0ddaa72f..6557f909635 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-03-22 Ilya Enkovich + + * call.c (build_conditional_expr_1): Always use original + condition type for vector type checks and build. + 2016-03-22 Patrick Palka PR c++/70096 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 65739e4ea7f..ed234904a63 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4634,6 +4634,8 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg1))) { + tree arg1_type = TREE_TYPE (arg1); + /* If arg1 is another cond_expr choosing between -1 and 0, then we can use its comparison. It may help to avoid additional comparison, produce more accurate diagnostics @@ -4653,7 +4655,6 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, || error_operand_p (arg3)) return error_mark_node; - tree arg1_type = TREE_TYPE (arg1); arg2_type = TREE_TYPE (arg2); arg3_type = TREE_TYPE (arg3); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ecfbd03cae..49f9e080c84 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-03-22 Ilya Enkovich + + * g++.dg/ext/pr70290.C: New test. + 2016-03-22 Kirill Yukhin PR target/70325 diff --git a/gcc/testsuite/g++.dg/ext/pr70290.C b/gcc/testsuite/g++.dg/ext/pr70290.C new file mode 100644 index 00000000000..6de13ce8390 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr70290.C @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-mavx512vl" { target { i?86-*-* x86_64-*-* } } } */ + +typedef int vec __attribute__((vector_size(32))); + +vec +test1 (vec x,vec y) +{ + return (x < y) ? 1 : 0; +} + +vec +test2 (vec x,vec y) +{ + vec zero = { }; + vec one = zero + 1; + return (x < y) ? one : zero; +}