Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td	(revision 122561)
+++ include/clang/Basic/DiagnosticSemaKinds.td	(working copy)
@@ -2060,6 +2060,8 @@
   "size of bit-field %0 (%1 bits) exceeds size of its type (%2 bits)">;
 def err_anon_bitfield_width_exceeds_type_size : Error<
   "size of anonymous bit-field (%0 bits) exceeds size of its type (%1 bits)">;
+def err_incorrect_number_of_vector_initializers : Error<
+  "number of elements must be either one or match the size of the vector">;
   
 // Used by C++ which allows bit-fields that are wider than the type.
 def warn_bitfield_width_exceeds_type_size: Warning<
Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp	(revision 122561)
+++ lib/Sema/SemaExpr.cpp	(working copy)
@@ -4862,9 +4862,9 @@
                                TypeSourceInfo *TInfo) {
   ParenListExpr *PE = cast<ParenListExpr>(Op);
   QualType Ty = TInfo->getType();
-  bool isAltiVecLiteral = false;
+  bool isVectorLiteral = false;
 
-  // Check for an altivec literal,
+  // Check for an altivec or OpenCL literal,
   // i.e. all the elements are integer constants.
   if (getLangOptions().AltiVec && Ty->isVectorType()) {
     if (PE->getNumExprs() == 0) {
@@ -4873,19 +4873,45 @@
     }
     if (PE->getNumExprs() == 1) {
       if (!PE->getExpr(0)->getType()->isVectorType())
-        isAltiVecLiteral = true;
+        isVectorLiteral = true;
     }
     else
-      isAltiVecLiteral = true;
+      isVectorLiteral = true;
   }
 
-  // If this is an altivec initializer, '(' type ')' '(' init, ..., init ')'
+  // If this is a vector initializer, '(' type ')' '(' init, ..., init ')'
   // then handle it as such.
-  if (isAltiVecLiteral) {
+  if (isVectorLiteral) {
     llvm::SmallVector<Expr *, 8> initExprs;
-    for (unsigned i = 0, e = PE->getNumExprs(); i != e; ++i)
-      initExprs.push_back(PE->getExpr(i));
 
+    // '(...)' form of vector initialization in AltiVec: the number of
+    // initializers must be one or must match the size of the vector.
+    // If a single value is specified in the initializer then it will be
+    // replicated to all the components of the vector
+    if (Ty->getAs<VectorType>()->getVectorKind() ==
+        VectorType::AltiVecVector) {
+      unsigned numElems = Ty->getAs<VectorType>()->getNumElements();
+      // The number of initializers must be one or must match the size of the
+      // vector. If a single value is specified in the initializer then it will
+      // be replicated to all the components of the vector
+      if (PE->getNumExprs() == 1) {
+        Expr* initExpr = PE->getExpr(0);
+        for (unsigned i = 0; i != numElems; ++i)
+          initExprs.push_back(initExpr);
+      }
+      else if (PE->getNumExprs() < numElems) {
+        Diag(PE->getExprLoc(),
+             diag::err_incorrect_number_of_vector_initializers);
+        return ExprError();
+      }
+      else
+        for (unsigned i = 0, e = PE->getNumExprs(); i != e; ++i)
+          initExprs.push_back(PE->getExpr(i));
+    }
+    else
+      for (unsigned i = 0, e = PE->getNumExprs(); i != e; ++i)
+        initExprs.push_back(PE->getExpr(i));
+
     // FIXME: This means that pretty-printing the final AST will produce curly
     // braces instead of the original commas.
     InitListExpr *E = new (Context) InitListExpr(Context, LParenLoc,
Index: test/CodeGen/builtins-ppc-altivec.c
===================================================================
--- test/CodeGen/builtins-ppc-altivec.c	(revision 122561)
+++ test/CodeGen/builtins-ppc-altivec.c	(working copy)
@@ -3113,3 +3113,9 @@
   res_i = (vf1 <= vf2);                    // CHECK: @llvm.ppc.altivec.vcmpgefp.p(i32 2
   res_i = (vf1 >= vf2);                    // CHECK: @llvm.ppc.altivec.vcmpgefp.p(i32 2
 }
+
+/* --------------------------------- initialization --------------------------------- */
+// CHECK: define void @test8
+void test8() {
+  vector int vi = (vector int)(1);         // CHECK: <i32 1, i32 1, i32 1, i32 1>
+}
Index: test/Sema/altivec-init.c
===================================================================
--- test/Sema/altivec-init.c	(revision 122561)
+++ test/Sema/altivec-init.c	(working copy)
@@ -6,9 +6,11 @@
 v8 foo(void) { 
   v8 a;
   v4 b;
+  vector int c;
   a = (v8){4, 2};
   b = (v4)(5, 6, 7, 8, 9); // expected-warning {{excess elements in vector initializer}}
   b = (v4)(5, 6, 8, 8.0f);
+  c = (vector int)(5, 6);  // expected-error {{number of elements must be either one or match the size of the vector}}
   return (v8){0, 1, 2, 3, 1, 2, 3, 4};
 
   // FIXME: test that (type)(fn)(args) still works with -faltivec
