57942a
--- gcc/fold-const.c
57942a
+++ gcc/fold-const.c
57942a
@@ -12461,6 +12461,7 @@ fold_binary_loc (location_t loc,
57942a
 
57942a
       /* Turn (a OP c1) OP c2 into a OP (c1+c2).  */
57942a
       if (TREE_CODE (op0) == code && host_integerp (arg1, false)
57942a
+	  && TREE_CODE (type) != VECTOR_TYPE
57942a
 	  && TREE_INT_CST_LOW (arg1) < TYPE_PRECISION (type)
57942a
 	  && host_integerp (TREE_OPERAND (arg0, 1), false)
57942a
 	  && TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) < TYPE_PRECISION (type))
57942a
@@ -12491,6 +12492,7 @@ fold_binary_loc (location_t loc,
57942a
            || (TYPE_UNSIGNED (type)
57942a
 	       && code == RSHIFT_EXPR && TREE_CODE (arg0) == LSHIFT_EXPR))
57942a
 	  && host_integerp (arg1, false)
57942a
+	  && TREE_CODE (type) != VECTOR_TYPE
57942a
 	  && TREE_INT_CST_LOW (arg1) < TYPE_PRECISION (type)
57942a
 	  && host_integerp (TREE_OPERAND (arg0, 1), false)
57942a
 	  && TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) < TYPE_PRECISION (type))
57942a
@@ -12513,7 +12515,8 @@ fold_binary_loc (location_t loc,
57942a
 
57942a
       /* Rewrite an LROTATE_EXPR by a constant into an
57942a
 	 RROTATE_EXPR by a new constant.  */
57942a
-      if (code == LROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST)
57942a
+      if (code == LROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST
57942a
+	  && TREE_CODE (type) != VECTOR_TYPE)
57942a
 	{
57942a
 	  tree tem = build_int_cst (TREE_TYPE (arg1),
57942a
 				    TYPE_PRECISION (type));
57942a
@@ -12538,6 +12541,7 @@ fold_binary_loc (location_t loc,
57942a
       /* Two consecutive rotates adding up to the precision of the
57942a
 	 type can be ignored.  */
57942a
       if (code == RROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST
57942a
+	  && TREE_CODE (type) != VECTOR_TYPE
57942a
 	  && TREE_CODE (arg0) == RROTATE_EXPR
57942a
 	  && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
57942a
 	  && TREE_INT_CST_HIGH (arg1) == 0