From dd25e724a475caffa4372f911d15536d09c342c8 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 18 Sep 2017 15:26:03 +0000 Subject: Fix vectorizable_live_operation handling of vector booleans vectorizable_live_operation needs to use BIT_FIELD_REF to extract one element of a vector. For a packed vector boolean type, the number of bits to extract should be taken from TYPE_PRECISION rather than TYPE_SIZE. This is shown by existing tests once SVE is added. 2017-09-18 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-vect-loop.c (vectorizable_live_operation): Fix element size calculation for vector booleans. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r252930 --- gcc/ChangeLog | 7 +++++++ gcc/tree-vect-loop.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9292748..4c052cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -2,6 +2,13 @@ Alan Hayward David Sherwood + * tree-vect-loop.c (vectorizable_live_operation): Fix element size + calculation for vector booleans. + +2017-09-18 Richard Sandiford + Alan Hayward + David Sherwood + * tree-vect-stmts.c (can_vectorize_live_stmts): New function, split out from... (vect_transform_stmt): ...here. diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 82b6629..5d29ef5 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -7066,7 +7066,9 @@ vectorizable_live_operation (gimple *stmt, : gimple_get_lhs (stmt); lhs_type = TREE_TYPE (lhs); - bitsize = TYPE_SIZE (TREE_TYPE (vectype)); + bitsize = (VECTOR_BOOLEAN_TYPE_P (vectype) + ? bitsize_int (TYPE_PRECISION (TREE_TYPE (vectype))) + : TYPE_SIZE (TREE_TYPE (vectype))); vec_bitsize = TYPE_SIZE (vectype); /* Get the vectorized lhs of STMT and the lane to use (counted in bits). */ -- cgit v1.1