diff options
author | Marek Polacek <polacek@redhat.com> | 2013-03-28 11:14:44 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2013-03-28 11:14:44 +0000 |
commit | 749469789ffb525395b9e1a7b26cc5f78de59411 (patch) | |
tree | 48cd0e9b1cfc8507af1e2d88888853578ccd960d | |
parent | 129677c1cf80e2fe333d21dbcfec8ca4e0a39d4e (diff) | |
download | gcc-749469789ffb525395b9e1a7b26cc5f78de59411.zip gcc-749469789ffb525395b9e1a7b26cc5f78de59411.tar.gz gcc-749469789ffb525395b9e1a7b26cc5f78de59411.tar.bz2 |
re PR tree-optimization/56695 (ICE in expand_vec_cond_expr, at optabs.c:6751)
PR tree-optimization/56695
* tree-vect-stmts.c (vectorizable_condition): Unconditionally
build signed result of a vector comparison.
* tree-cfg.c (verify_gimple_comparison): Check that a result
of a vector comparison has signed type.
Co-Authored-By: Richard Biener <rguenther@suse.de>
From-SVN: r197192
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr56695.c | 14 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 5 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 16 |
5 files changed, 39 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a96fcb..327a71c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-03-28 Marek Polacek <polacek@redhat.com> + Richard Biener <rguenther@suse.de> + + PR tree-optimization/56695 + * tree-vect-stmts.c (vectorizable_condition): Unconditionally + build signed result of a vector comparison. + * tree-cfg.c (verify_gimple_comparison): Check that a result + of a vector comparison has signed type. + 2013-03-28 Richard Biener <rguenther@suse.de> PR tree-optimization/37021 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca73236..08b9e59 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-03-28 Marek Polacek <polacek@redhat.com> + + PR tree-optimization/56695 + * gcc.dg/vect/pr56695.c: New test. + 2013-03-28 Richard Biener <rguenther@suse.de> PR tree-optimization/37021 diff --git a/gcc/testsuite/gcc.dg/vect/pr56695.c b/gcc/testsuite/gcc.dg/vect/pr56695.c new file mode 100644 index 0000000..8b997c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr56695.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/56695 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize" } */ + +int a, b, i; + +void +f (void) +{ + for (i = 0; i < 8; ++i) + a |= !(i |= b %= 1); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index c3771e5..3843b13 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3191,7 +3191,10 @@ verify_gimple_comparison (tree type, tree op0, tree op1) if (TYPE_VECTOR_SUBPARTS (type) != TYPE_VECTOR_SUBPARTS (op0_type) || (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (type))) - != GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0_type))))) + != GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0_type)))) + /* The result of a vector comparison is of signed + integral type. */ + || TYPE_UNSIGNED (TREE_TYPE (type))) { error ("invalid vector comparison resulting type"); debug_generic_expr (type); diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 4bd8415..9cadc50 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -5279,7 +5279,7 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi, vec<tree> vec_oprnds1 = vNULL; vec<tree> vec_oprnds2 = vNULL; vec<tree> vec_oprnds3 = vNULL; - tree vec_cmp_type = vectype; + tree vec_cmp_type; if (slp_node || PURE_SLP_STMT (stmt_info)) ncopies = 1; @@ -5352,14 +5352,12 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi, && TREE_CODE (else_clause) != FIXED_CST) return false; - if (!INTEGRAL_TYPE_P (TREE_TYPE (vectype))) - { - unsigned int prec = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vectype))); - tree cmp_type = build_nonstandard_integer_type (prec, 1); - vec_cmp_type = get_same_sized_vectype (cmp_type, vectype); - if (vec_cmp_type == NULL_TREE) - return false; - } + unsigned int prec = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (vectype))); + /* The result of a vector comparison should be signed type. */ + tree cmp_type = build_nonstandard_integer_type (prec, 0); + vec_cmp_type = get_same_sized_vectype (cmp_type, vectype); + if (vec_cmp_type == NULL_TREE) + return false; if (!vec_stmt) { |