File gcc-power7-sles-11sp1.patch02e of Package gcc43

2009-10-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
	    Pat Haugen  <pthaugen@us.ibm.com>
	    Revital Eres <ERES@il.ibm.com>
	    Peter Bergner  <bergner@vnet.ibm.com>
	
	Backport rs6000 changes from GCC 4.5 mainline to 4.3 that fixes
	some problems that show up with vectorization.

	2009-06-05  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR tree-optimization/40219
	* tree.c (iterative_hash_expr): Make sure the builtin function is
	a normal builtin function and not a front end or back end builtin
	before indexing into the built_in_decls array.

	PR tree-optimization/40049
	* tree-vect-transform.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.

diff -rupN --exclude='*~' --exclude=autom4te.cache sles-11sp1-orig/gcc/tree.c sles-11sp1/gcc/tree.c
--- sles-11sp1-orig/gcc/tree.c	2009-10-09 17:07:59.000000000 -0400
+++ sles-11sp1/gcc/tree.c	2009-10-13 13:02:08.000000000 -0400
@@ -5348,11 +5348,13 @@ iterative_hash_expr (const_tree t, hashv
 	return val;
       }
     case FUNCTION_DECL:
-      /* When referring to a built-in FUNCTION_DECL, use the
-	 __builtin__ form.  Otherwise nodes that compare equal
-	 according to operand_equal_p might get different
-	 hash codes.  */
-      if (DECL_BUILT_IN (t))
+      /* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
+	 Otherwise nodes that compare equal according to operand_equal_p might
+	 get different hash codes.  However, don't do this for machine specific
+	 or front end builtins, since the function code is overloaded in those
+	 cases.  */
+      if (DECL_BUILT_IN_CLASS (t) == BUILT_IN_NORMAL
+	  && built_in_decls[DECL_FUNCTION_CODE (t)])
 	{
 	  val = iterative_hash_pointer (built_in_decls[DECL_FUNCTION_CODE (t)], 
 				      val);
diff -rupN --exclude='*~' --exclude=autom4te.cache sles-11sp1-orig/gcc/tree-vect-transform.c sles-11sp1/gcc/tree-vect-transform.c
--- sles-11sp1-orig/gcc/tree-vect-transform.c	2009-10-09 17:11:06.000000000 -0400
+++ sles-11sp1/gcc/tree-vect-transform.c	2009-10-13 13:02:38.000000000 -0400
@@ -3961,6 +3961,13 @@ vectorizable_operation (tree stmt, block
 		  && (optab_handler (optab, TYPE_MODE (vectype))->insn_code
 		      != CODE_FOR_nothing))
 		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);
 	    }
 	}