diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr94727.c | 24 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 7 |
4 files changed, 40 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 71c480a..041894e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-23 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/94727 + * tree-vect-stmts.c (vectorizable_comparison): Use mask_type when + comparing invariant scalar booleans. + 2020-04-23 Matthew Malcomson <matthew.malcomson@arm.com> Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e676f0..2b28272 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-04-23 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/94727 + * gcc.dg/vect/pr94727.c: New test. + 2020-04-23 Szabolcs Nagy <szabolcs.nagy@arm.com> PR target/94514 diff --git a/gcc/testsuite/gcc.dg/vect/pr94727.c b/gcc/testsuite/gcc.dg/vect/pr94727.c new file mode 100644 index 0000000..3840871 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr94727.c @@ -0,0 +1,24 @@ +/* { dg-additional-options "-O3" } */ + +unsigned char a[16][32]; +long b[16][32]; +unsigned long c; +_Bool d; + +void __attribute__((noipa)) +foo (void) +{ + for (int j = 0; j < 8; j++) + for (int i = 0; i < 17; ++i) + b[j][i] = (a[j][i] < c) > d; +} + +int +main (void) +{ + c = 1; + foo (); + if (!b[0][0]) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 7f3a9fb..88a1e2c 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -10566,8 +10566,11 @@ vectorizable_comparison (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, /* Invariant comparison. */ if (!vectype) { - vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1), - slp_node); + if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (rhs1))) + vectype = mask_type; + else + vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1), + slp_node); if (!vectype || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits)) return false; } |