This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix vector reduction on little-endian


We wound up with two offsetting little-endian adjustments, resulting
in extracting the wrong value.  Tested on amd64-linux.


r~


	* tree-vect-transform.c (vect_create_epilog_for_reduction): Remove
	duplicate little-endian adjustment.

Index: tree-vect-transform.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-transform.c,v
retrieving revision 2.31
diff -u -p -d -r2.31 tree-vect-transform.c
--- tree-vect-transform.c	26 Jun 2005 21:21:33 -0000	2.31
+++ tree-vect-transform.c	28 Jun 2005 05:09:29 -0000
@@ -926,17 +926,12 @@ vect_create_epilog_for_reduction (tree v
       int vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
       tree vec_temp;
 
-      /* The result of the reduction is expected to be at the LSB bits
-	 of the vector. For big-endian targets this means at the right
-	 end of the vector. For little-endian targets this means at the
-	 left end of the vector.  */
-
-      if (BITS_BIG_ENDIAN
-	  && vec_shr_optab->handlers[mode].insn_code != CODE_FOR_nothing)
+      /* The result of the reduction is expected to be at the least
+	 significant bits of the vector.  This is merely convention,
+	 as it's the extraction later that really matters, and that
+	 is also under our control.  */
+      if (vec_shr_optab->handlers[mode].insn_code != CODE_FOR_nothing)
 	shift_code = VEC_RSHIFT_EXPR;
-      else if (!BITS_BIG_ENDIAN
-	       && vec_shl_optab->handlers[mode].insn_code != CODE_FOR_nothing)
-	shift_code = VEC_LSHIFT_EXPR;
       else
 	have_whole_vector_shift = false;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]