This is the mail archive of the 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]

Re: [PATCH] PR 40049, prevent garbage collect errors on machines with vector/vector shift

The patch was a quick patch from the existing code.  The following patch
eliminates the unused variable.

2009-05-07  Michael Meissner  <>

	PR tree-optimization/40049
	* tree-vect-stmts.c (vectorizable_operation): If the machine has
	only vector/vector shifts, convert the type of the constant to the
	appropriate type to avoid building incorrect trees, which
	eventually have problems with garbage collection.

Index: gcc/tree-vect-stmts.c
--- gcc/tree-vect-stmts.c	(revision 147246)
+++ gcc/tree-vect-stmts.c	(working copy)
@@ -1974,11 +1974,20 @@ vectorizable_operation (gimple stmt, gim
 	      optab = optab_for_tree_code (code, vectype, optab_vector);
-	      if (vect_print_dump_info (REPORT_DETAILS)
-		  && optab
+	      if (optab
 		  && (optab_handler (optab, TYPE_MODE (vectype))->insn_code
 		      != CODE_FOR_nothing))
-		fprintf (vect_dump, "vector/vector shift/rotate found.");
+		{
+		  if (vect_print_dump_info (REPORT_DETAILS))
+		    fprintf (vect_dump, "vector/vector shift/rotate found.");
+		  /* Unlike the other binary operators, shifts/rotates have
+		     the rhs being int, instead of the same type as the lhs,
+		     so make sure the scalar is the right type if we are
+		     dealing with vectors of short/char.  */
+		  if (dt[1] == vect_constant_def)
+		    op1 = fold_convert (TREE_TYPE (vectype), op1);
+		}

Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA

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