diff mbox series

Fix vectorizable_live_operation handling of vector booleans

Message ID 87efr8nsui.fsf@linaro.org
State New
Headers show
Series Fix vectorizable_live_operation handling of vector booleans | expand

Commit Message

Richard Sandiford Sept. 15, 2017, 10:45 a.m. UTC
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.

Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
OK to install?

Richard


2017-09-15  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* tree-vect-loop.c (vectorizable_live_operation): Fix element size
	calculation for vector booleans.

Comments

Jeff Law Sept. 15, 2017, 3:38 p.m. UTC | #1
On 09/15/2017 04:45 AM, Richard Sandiford wrote:
> 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.
> 
> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
> OK to install?
> 
> Richard
> 
> 
> 2017-09-15  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* tree-vect-loop.c (vectorizable_live_operation): Fix element size
> 	calculation for vector booleans.
OK.
jeff
diff mbox series

Patch

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	2017-09-15 11:35:46.832592132 +0100
+++ gcc/tree-vect-loop.c	2017-09-15 11:37:45.639244036 +0100
@@ -7065,7 +7065,9 @@  vectorizable_live_operation (gimple *stm
 	: 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).  */