Index: include/clang/Basic/TokenKinds.def
===================================================================
--- include/clang/Basic/TokenKinds.def	(revision 91204)
+++ include/clang/Basic/TokenKinds.def	(working copy)
@@ -227,7 +227,7 @@
 
 // C++ 2.11p1: Keywords.
 KEYWORD(asm                         , KEYCXX|KEYGNU)
-KEYWORD(bool                        , BOOLSUPPORT)
+KEYWORD(bool                        , BOOLSUPPORT|KEYALTIVEC)
 KEYWORD(catch                       , KEYCXX)
 KEYWORD(class                       , KEYCXX)
 KEYWORD(const_cast                  , KEYCXX)
@@ -235,7 +235,7 @@
 KEYWORD(dynamic_cast                , KEYCXX)
 KEYWORD(explicit                    , KEYCXX)
 KEYWORD(export                      , KEYCXX)
-KEYWORD(false                       , BOOLSUPPORT)
+KEYWORD(false                       , BOOLSUPPORT|KEYALTIVEC)
 KEYWORD(friend                      , KEYCXX)
 KEYWORD(mutable                     , KEYCXX)
 KEYWORD(namespace                   , KEYCXX)
@@ -249,7 +249,7 @@
 KEYWORD(template                    , KEYCXX)
 KEYWORD(this                        , KEYCXX)
 KEYWORD(throw                       , KEYCXX)
-KEYWORD(true                        , BOOLSUPPORT)
+KEYWORD(true                        , BOOLSUPPORT|KEYALTIVEC)
 KEYWORD(try                         , KEYCXX)
 KEYWORD(typename                    , KEYCXX)
 KEYWORD(typeid                      , KEYCXX)
@@ -340,6 +340,10 @@
 KEYWORD(__w64                       , KEYALL)
 KEYWORD(__forceinline               , KEYALL)
 
+// Altivec Extension.
+KEYWORD(__vector                    , KEYALTIVEC)
+KEYWORD(__pixel                     , KEYALTIVEC)
+
 // Alternate spelling for various tokens.  There are GCC extensions in all
 // languages, but should not be disabled in strict conformance mode.
 ALIAS("__attribute__", __attribute, KEYALL)
Index: include/clang/Basic/DiagnosticParseKinds.td
===================================================================
--- include/clang/Basic/DiagnosticParseKinds.td	(revision 91204)
+++ include/clang/Basic/DiagnosticParseKinds.td	(working copy)
@@ -158,6 +158,10 @@
   "type name does not allow function specifier to be specified">;
 def err_invalid_decl_spec_combination : Error<
   "cannot combine with previous '%0' declaration specifier">;
+def err_invalid_vector_decl_spec_combination : Error<
+  "cannot combine with previous '%0' declaration specifier. \"__vector\" must be first">;
+def err_invalid_pixel_decl_spec_combination : Error<
+  "\"__pixel\" must be preceeded by \"__vector\".  '%0' declaration specifier not allowed here">;
 def err_friend_invalid_in_context : Error<
   "'friend' used outside of class">;
 def err_unknown_typename : Error<
Index: include/clang/AST/ASTContext.h
===================================================================
--- include/clang/AST/ASTContext.h	(revision 91204)
+++ include/clang/AST/ASTContext.h	(working copy)
@@ -498,7 +498,8 @@
 
   /// getVectorType - Return the unique reference to a vector type of
   /// the specified element type and size. VectorType must be a built-in type.
-  QualType getVectorType(QualType VectorType, unsigned NumElts);
+  QualType getVectorType(QualType VectorType, unsigned NumElts,
+                         bool AltiVec, bool IsPixel);
 
   /// getExtVectorType - Return the unique reference to an extended vector type
   /// of the specified element type and size.  VectorType must be a built-in
Index: include/clang/AST/Type.h
===================================================================
--- include/clang/AST/Type.h	(revision 91204)
+++ include/clang/AST/Type.h	(working copy)
@@ -1576,7 +1576,8 @@
 
 /// VectorType - GCC generic vector type. This type is created using
 /// __attribute__((vector_size(n)), where "n" specifies the vector size in
-/// bytes. Since the constructor takes the number of vector elements, the
+/// bytes; or from an Altivec __vector or vector declaration.
+/// Since the constructor takes the number of vector elements, the
 /// client is responsible for converting the size into the number of elements.
 class VectorType : public Type, public llvm::FoldingSetNode {
 protected:
@@ -1586,13 +1587,21 @@
   /// NumElements - The number of elements in the vector.
   unsigned NumElements;
 
-  VectorType(QualType vecType, unsigned nElements, QualType canonType) :
+  /// AltiVec - True if this is for an Altivec vector.
+  bool AltiVec;
+
+  /// Pixel - True if this is for an Altivec vector pixel.
+  bool Pixel;
+
+  VectorType(QualType vecType, unsigned nElements, QualType canonType,
+      bool isAltiVec, bool isPixel) :
     Type(Vector, canonType, vecType->isDependentType()),
-    ElementType(vecType), NumElements(nElements) {}
+    ElementType(vecType), NumElements(nElements),
+    AltiVec(isAltiVec), Pixel(isPixel) {}
   VectorType(TypeClass tc, QualType vecType, unsigned nElements,
-             QualType canonType)
+             QualType canonType, bool isAltiVec, bool isPixel)
     : Type(tc, canonType, vecType->isDependentType()), ElementType(vecType),
-      NumElements(nElements) {}
+      NumElements(nElements), AltiVec(isAltiVec), Pixel(isPixel) {}
   friend class ASTContext;  // ASTContext creates these.
 public:
 
@@ -1602,14 +1611,25 @@
   bool isSugared() const { return false; }
   QualType desugar() const { return QualType(this, 0); }
 
+  bool isAltiVec() const { return AltiVec; }
+  void setAltiVec(bool isAltiVec) { AltiVec = isAltiVec; }
+  
+  bool isPixel() const { return Pixel; }
+  void setPixel(bool isPixel) { Pixel = isPixel; }
+  
+
   void Profile(llvm::FoldingSetNodeID &ID) {
-    Profile(ID, getElementType(), getNumElements(), getTypeClass());
+    Profile(ID, getElementType(), getNumElements(), getTypeClass(),
+      AltiVec, Pixel);
   }
   static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType,
-                      unsigned NumElements, TypeClass TypeClass) {
+                      unsigned NumElements, TypeClass TypeClass,
+                      bool isAltiVec, bool isPixel) {
     ID.AddPointer(ElementType.getAsOpaquePtr());
     ID.AddInteger(NumElements);
     ID.AddInteger(TypeClass);
+    ID.AddBoolean(isAltiVec);
+    ID.AddBoolean(isPixel);
   }
   static bool classof(const Type *T) {
     return T->getTypeClass() == Vector || T->getTypeClass() == ExtVector;
@@ -1624,7 +1644,7 @@
 /// points, colors, and textures (modeled after OpenGL Shading Language).
 class ExtVectorType : public VectorType {
   ExtVectorType(QualType vecType, unsigned nElements, QualType canonType) :
-    VectorType(ExtVector, vecType, nElements, canonType) {}
+    VectorType(ExtVector, vecType, nElements, canonType, false, false) {}
   friend class ASTContext;  // ASTContext creates these.
 public:
   static int getPointAccessorIdx(char c) {
Index: include/clang/Parse/Parser.h
===================================================================
--- include/clang/Parse/Parser.h	(revision 91204)
+++ include/clang/Parse/Parser.h	(working copy)
@@ -320,6 +320,80 @@
   /// annotated.
   bool TryAnnotateCXXScopeToken(bool EnteringContext = false);
 
+  /// TryAltiVecToken - Check for context-sensitive AltiVec identifier tokens,
+  /// replacing them with the non-context-sensitive keywords.  This returns
+  /// true if the token was replaced.
+  bool TryAltiVecToken(DeclSpec &DS) {
+    if (getLang().AltiVec) {
+      if (Tok.getIdentifierInfo()->isStr<7>("vector")) {
+        const Token &nextToken = NextToken();
+        switch (nextToken.getKind()) {
+          case tok::kw_short:
+          case tok::kw_long:
+          case tok::kw_signed:
+          case tok::kw_unsigned:
+          case tok::kw_void:
+          case tok::kw_char:
+          case tok::kw_int:
+          case tok::kw_float:
+          case tok::kw_double:
+          case tok::kw_bool:
+          case tok::kw___pixel:
+            Tok.setKind(tok::kw___vector);
+            return true;
+          case tok::identifier:
+            if (nextToken.getIdentifierInfo()->isStr<6>("pixel")) {
+              Tok.setKind(tok::kw___vector);
+              return true;
+            }
+            break;
+          default:
+            break;
+        }
+      } else if (Tok.getIdentifierInfo()->isStr<6>("pixel") &&
+          DS.isTypeAltiVecVector()) {
+        Tok.setKind(tok::kw___pixel);
+          return true;
+      }
+    }
+    return false;
+  }
+
+  /// TryAltiVecVectorToken - Check for context-sensitive AltiVec vector
+  /// identifier token, replacing it with the non-context-sensitive __vector.
+  /// This returns true if the token was replaced.
+  bool TryAltiVecVectorToken() {
+    if (getLang().AltiVec) {
+      if (Tok.getIdentifierInfo()->isStr<7>("vector")) {
+        const Token &nextToken = NextToken();
+        switch (nextToken.getKind()) {
+          case tok::kw_short:
+          case tok::kw_long:
+          case tok::kw_signed:
+          case tok::kw_unsigned:
+          case tok::kw_void:
+          case tok::kw_char:
+          case tok::kw_int:
+          case tok::kw_float:
+          case tok::kw_double:
+          case tok::kw_bool:
+          case tok::kw___pixel:
+            Tok.setKind(tok::kw___vector);
+            return true;
+          case tok::identifier:
+            if (nextToken.getIdentifierInfo()->isStr<6>("pixel")) {
+              Tok.setKind(tok::kw___vector);
+              return true;
+            }
+            break;
+          default:
+            break;
+        }
+      }
+    }
+    return false;
+  }
+
   /// TentativeParsingAction - An object that is used as a kind of "tentative
   /// parsing transaction". It gets instantiated to mark the token position and
   /// after the token consumption is done, Commit() or Revert() is called to
Index: include/clang/Parse/DeclSpec.h
===================================================================
--- include/clang/Parse/DeclSpec.h	(revision 91204)
+++ include/clang/Parse/DeclSpec.h	(working copy)
@@ -78,6 +78,7 @@
     TST_decimal32,    // _Decimal32
     TST_decimal64,    // _Decimal64
     TST_decimal128,   // _Decimal128
+    TST_pixel,        // AltiVec pixel
     TST_enum,
     TST_union,
     TST_struct,
@@ -119,6 +120,8 @@
   /*TSC*/unsigned TypeSpecComplex : 2;
   /*TSS*/unsigned TypeSpecSign : 2;
   /*TST*/unsigned TypeSpecType : 5;
+  bool TypeAltiVecVector : 1; // At present, these two flags
+  bool TypeAltiVecPixel : 1;  // only affect display output.
   bool TypeSpecOwned : 1;
 
   // type-qualifiers
@@ -156,7 +159,7 @@
   SourceRange Range;
 
   SourceLocation StorageClassSpecLoc, SCS_threadLoc;
-  SourceLocation TSWLoc, TSCLoc, TSSLoc, TSTLoc;
+  SourceLocation TSWLoc, TSCLoc, TSSLoc, TSTLoc, AltiVecLoc;
   SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc;
   SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc;
   SourceLocation FriendLoc, ConstexprLoc;
@@ -172,6 +175,8 @@
       TypeSpecComplex(TSC_unspecified),
       TypeSpecSign(TSS_unspecified),
       TypeSpecType(TST_unspecified),
+      TypeAltiVecVector(false),
+      TypeAltiVecPixel(false),
       TypeSpecOwned(false),
       TypeQualifiers(TSS_unspecified),
       FS_inline_specified(false),
@@ -209,6 +214,8 @@
   TSC getTypeSpecComplex() const { return (TSC)TypeSpecComplex; }
   TSS getTypeSpecSign() const { return (TSS)TypeSpecSign; }
   TST getTypeSpecType() const { return (TST)TypeSpecType; }
+  bool isTypeAltiVecVector() const { return TypeAltiVecVector; }
+  bool isTypeAltiVecPixel() const { return TypeAltiVecPixel; }
   bool isTypeSpecOwned() const { return TypeSpecOwned; }
   void *getTypeRep() const { return TypeRep; }
 
@@ -217,6 +224,7 @@
   SourceLocation getTypeSpecComplexLoc() const { return TSCLoc; }
   SourceLocation getTypeSpecSignLoc() const { return TSSLoc; }
   SourceLocation getTypeSpecTypeLoc() const { return TSTLoc; }
+  SourceLocation getAltiVecLoc() const { return AltiVecLoc; }
 
   /// getSpecifierName - Turn a type-specifier-type into a string like "_Bool"
   /// or "union".
@@ -298,6 +306,10 @@
                        unsigned &DiagID);
   bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec,
                        unsigned &DiagID, void *Rep = 0, bool Owned = false);
+  bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc,
+                       const char *&PrevSpec, unsigned &DiagID);
+  bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc,
+                       const char *&PrevSpec, unsigned &DiagID);
   bool SetTypeSpecError();
   void UpdateTypeRep(void *Rep) { TypeRep = Rep; }
 
Index: lib/Frontend/PCHWriter.cpp
===================================================================
--- lib/Frontend/PCHWriter.cpp	(revision 91204)
+++ lib/Frontend/PCHWriter.cpp	(working copy)
@@ -134,6 +134,8 @@
 void PCHTypeWriter::VisitVectorType(const VectorType *T) {
   Writer.AddTypeRef(T->getElementType(), Record);
   Record.push_back(T->getNumElements());
+  Record.push_back(T->isAltiVec());
+  Record.push_back(T->isPixel());
   Code = pch::TYPE_VECTOR;
 }
 
Index: lib/Frontend/PCHReader.cpp
===================================================================
--- lib/Frontend/PCHReader.cpp	(revision 91204)
+++ lib/Frontend/PCHReader.cpp	(working copy)
@@ -1832,18 +1832,20 @@
   }
 
   case pch::TYPE_VECTOR: {
-    if (Record.size() != 2) {
+    if (Record.size() != 4) {
       Error("incorrect encoding of vector type in PCH file");
       return QualType();
     }
 
     QualType ElementType = GetType(Record[0]);
     unsigned NumElements = Record[1];
-    return Context->getVectorType(ElementType, NumElements);
+    bool AltiVec = Record[2];
+    bool Pixel = Record[3];
+    return Context->getVectorType(ElementType, NumElements, AltiVec, Pixel);
   }
 
   case pch::TYPE_EXT_VECTOR: {
-    if (Record.size() != 2) {
+    if (Record.size() != 4) {
       Error("incorrect encoding of extended vector type in PCH file");
       return QualType();
     }
Index: lib/Basic/IdentifierTable.cpp
===================================================================
--- lib/Basic/IdentifierTable.cpp	(revision 91204)
+++ lib/Basic/IdentifierTable.cpp	(working copy)
@@ -68,7 +68,8 @@
     KEYCXX0X = 8,
     KEYGNU = 16,
     KEYMS = 32,
-    BOOLSUPPORT = 64
+    BOOLSUPPORT = 64,
+    KEYALTIVEC = 128
   };
 }
 
@@ -91,6 +92,7 @@
   else if (LangOpts.GNUMode && (Flags & KEYGNU)) AddResult = 1;
   else if (LangOpts.Microsoft && (Flags & KEYMS)) AddResult = 1;
   else if (LangOpts.Bool && (Flags & BOOLSUPPORT)) AddResult = 2;
+  else if (LangOpts.AltiVec && (Flags & KEYALTIVEC)) AddResult = 2;
 
   // Don't add this keyword if disabled in this language.
   if (AddResult == 0) return;
Index: lib/Sema/TreeTransform.h
===================================================================
--- lib/Sema/TreeTransform.h	(revision 91204)
+++ lib/Sema/TreeTransform.h	(working copy)
@@ -418,7 +418,8 @@
   ///
   /// By default, performs semantic analysis when building the vector type.
   /// Subclasses may override this routine to provide different behavior.
-  QualType RebuildVectorType(QualType ElementType, unsigned NumElements);
+  QualType RebuildVectorType(QualType ElementType, unsigned NumElements,
+    bool IsAltiVec, bool IsPixel);
 
   /// \brief Build a new extended vector type given the element type and
   /// number of elements.
@@ -2436,7 +2437,8 @@
   QualType Result = TL.getType();
   if (getDerived().AlwaysRebuild() ||
       ElementType != T->getElementType()) {
-    Result = getDerived().RebuildVectorType(ElementType, T->getNumElements());
+    Result = getDerived().RebuildVectorType(ElementType, T->getNumElements(),
+      T->isAltiVec(), T->isPixel());
     if (Result.isNull())
       return QualType();
   }
@@ -5231,9 +5233,11 @@
 
 template<typename Derived>
 QualType TreeTransform<Derived>::RebuildVectorType(QualType ElementType,
-                                                   unsigned NumElements) {
+                                       unsigned NumElements,
+                                       bool IsAltiVec, bool IsPixel) {
   // FIXME: semantic checking!
-  return SemaRef.Context.getVectorType(ElementType, NumElements);
+  return SemaRef.Context.getVectorType(ElementType, NumElements,
+                                       IsAltiVec, IsPixel);
 }
 
 template<typename Derived>
Index: lib/Sema/SemaType.cpp
===================================================================
--- lib/Sema/SemaType.cpp	(revision 91204)
+++ lib/Sema/SemaType.cpp	(working copy)
@@ -339,6 +339,11 @@
     if (TheSema.getLangOptions().Freestanding)
       TheSema.Diag(DS.getTypeSpecComplexLoc(), diag::ext_freestanding_complex);
     Result = Context.getComplexType(Result);
+  } else if (DS.isTypeAltiVecVector()) {
+    unsigned typeSize = static_cast<unsigned>(Context.getTypeSize(Result));
+    assert(typeSize > 0 && "type size for vector must be greater than 0 bits");
+    Result = Context.getVectorType(Result, 128/typeSize, true,
+      DS.isTypeAltiVecPixel());
   }
 
   assert(DS.getTypeSpecComplex() != DeclSpec::TSC_imaginary &&
@@ -1691,7 +1696,7 @@
 
   // Success! Instantiate the vector type, the number of elements is > 0, and
   // not required to be a power of 2, unlike GCC.
-  CurType = S.Context.getVectorType(CurType, vectorSize/typeSize);
+  CurType = S.Context.getVectorType(CurType, vectorSize/typeSize, false, false);
 }
 
 void Sema::ProcessTypeAttributeList(QualType &Result, const AttributeList *AL) {
Index: lib/AST/TypePrinter.cpp
===================================================================
--- lib/AST/TypePrinter.cpp	(revision 91204)
+++ lib/AST/TypePrinter.cpp	(working copy)
@@ -240,15 +240,24 @@
 }
 
 void TypePrinter::PrintVector(const VectorType *T, std::string &S) { 
-  // FIXME: We prefer to print the size directly here, but have no way
-  // to get the size of the type.
-  Print(T->getElementType(), S);
-  std::string V = "__attribute__((__vector_size__(";
-  V += llvm::utostr_32(T->getNumElements()); // convert back to bytes.
-  std::string ET;
-  Print(T->getElementType(), ET);
-  V += " * sizeof(" + ET + ")))) ";
-  S = V + S;
+  if (T->isAltiVec()) {
+    if (T->isPixel())
+      S = "vector pixel " + S;
+    else {
+      Print(T->getElementType(), S);
+      S = "vector " + S;
+    }
+  } else {
+    // FIXME: We prefer to print the size directly here, but have no way
+    // to get the size of the type.
+    Print(T->getElementType(), S);
+    std::string V = "__attribute__((__vector_size__(";
+    V += llvm::utostr_32(T->getNumElements()); // convert back to bytes.
+    std::string ET;
+    Print(T->getElementType(), ET);
+    V += " * sizeof(" + ET + ")))) ";
+    S = V + S;
+  }
 }
 
 void TypePrinter::PrintExtVector(const ExtVectorType *T, std::string &S) { 
Index: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp	(revision 91204)
+++ lib/AST/ASTContext.cpp	(working copy)
@@ -1590,7 +1590,8 @@
 
 /// getVectorType - Return the unique reference to a vector type of
 /// the specified element type and size. VectorType must be a built-in type.
-QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts) {
+QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts,
+                                   bool IsAltiVec, bool IsPixel) {
   BuiltinType *baseType;
 
   baseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
@@ -1598,7 +1599,8 @@
 
   // Check if we've already instantiated a vector of this type.
   llvm::FoldingSetNodeID ID;
-  VectorType::Profile(ID, vecType, NumElts, Type::Vector);
+  VectorType::Profile(ID, vecType, NumElts, Type::Vector,
+    IsAltiVec, IsPixel);
   void *InsertPos = 0;
   if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(VTP, 0);
@@ -1607,14 +1609,15 @@
   // so fill in the canonical type field.
   QualType Canonical;
   if (!vecType.isCanonical()) {
-    Canonical = getVectorType(getCanonicalType(vecType), NumElts);
+    Canonical = getVectorType(getCanonicalType(vecType),
+      NumElts, IsAltiVec, IsPixel);
 
     // Get the new insert position for the node we care about.
     VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
     assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
   }
   VectorType *New = new (*this, TypeAlignment)
-    VectorType(vecType, NumElts, Canonical);
+    VectorType(vecType, NumElts, Canonical, IsAltiVec, IsPixel);
   VectorTypes.InsertNode(New, InsertPos);
   Types.push_back(New);
   return QualType(New, 0);
@@ -1630,7 +1633,7 @@
 
   // Check if we've already instantiated a vector of this type.
   llvm::FoldingSetNodeID ID;
-  VectorType::Profile(ID, vecType, NumElts, Type::ExtVector);
+  VectorType::Profile(ID, vecType, NumElts, Type::ExtVector, false, false);
   void *InsertPos = 0;
   if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
     return QualType(VTP, 0);
@@ -4533,7 +4536,7 @@
   // Turn <4 x signed int> -> <4 x unsigned int>
   if (const VectorType *VTy = T->getAs<VectorType>())
     return getVectorType(getCorrespondingUnsignedType(VTy->getElementType()),
-                         VTy->getNumElements());
+             VTy->getNumElements(), VTy->isAltiVec(), VTy->isPixel());
 
   // For enums, we return the unsigned version of the base type.
   if (const EnumType *ETy = T->getAs<EnumType>())
@@ -4690,7 +4693,8 @@
     Str = End;
 
     QualType ElementType = DecodeTypeFromStr(Str, Context, Error, false);
-    Type = Context.getVectorType(ElementType, NumElements);
+    // FIXME: Don't know what to do about AltiVec.
+    Type = Context.getVectorType(ElementType, NumElements, false, false);
     break;
   }
   case 'X': {
Index: lib/Parse/ParseTentative.cpp
===================================================================
--- lib/Parse/ParseTentative.cpp	(revision 91204)
+++ lib/Parse/ParseTentative.cpp	(working copy)
@@ -672,6 +672,11 @@
 Parser::TPResult Parser::isCXXDeclarationSpecifier() {
   switch (Tok.getKind()) {
   case tok::identifier:   // foo::bar
+    // Check for need to substitute AltiVec __vector keyword
+    // for "vector" identifier.
+    if (TryAltiVecVectorToken())
+      return isCXXDeclarationSpecifier();
+    // Fall through.
   case tok::kw_typename:  // typename T::type
     // Annotate typenames and C++ scope specifiers.  If we get one, just
     // recurse to handle whatever we get.
@@ -749,6 +754,10 @@
   case tok::kw___ptr64:
   case tok::kw___forceinline:
     return TPResult::True();
+  
+    // AltiVec
+  case tok::kw___vector:
+    return TPResult::True();
 
     // The ambiguity resides in a simple-type-specifier/typename-specifier
     // followed by a '('. The '(' could either be the start of:
Index: lib/Parse/ParseDecl.cpp
===================================================================
--- lib/Parse/ParseDecl.cpp	(revision 91204)
+++ lib/Parse/ParseDecl.cpp	(working copy)
@@ -393,6 +393,12 @@
   }
 
   if (AllowFunctionDefinitions && D.isFunctionDeclarator()) {
+    // If attributes are present, parse them now.
+    if (Tok.is(tok::kw___attribute)) {
+      SourceLocation Loc;
+      AttributeList *AttrList = ParseGNUAttributes(&Loc);
+      D.AddAttributes(AttrList, Loc);
+    }
     if (isDeclarationAfterDeclarator()) {
       // Fall though.  We have to check this first, though, because
       // __attribute__ might be the start of a function definition in
@@ -933,6 +939,10 @@
       if (DS.hasTypeSpecifier())
         goto DoneWithDeclSpec;
 
+      // Check for need to substitute AltiVec keyword tokens.
+      if (TryAltiVecToken(DS))
+        continue;
+
       // It has to be available as a typedef too!
       TypeTy *TypeRep = Actions.getTypeName(*Tok.getIdentifierInfo(),
                                             Tok.getLocation(), CurScope);
@@ -1171,6 +1181,12 @@
       isInvalid = DS.SetTypeSpecType(DeclSpec::TST_decimal128, Loc, PrevSpec,
                                      DiagID);
       break;
+    case tok::kw___vector:
+      isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID);
+      break;
+    case tok::kw___pixel:
+      isInvalid = DS.SetTypeAltiVecPixel(true, Loc, PrevSpec, DiagID);
+      break;
 
     // class-specifier:
     case tok::kw_class:
@@ -1296,6 +1312,7 @@
 /// [OBJC]  class-name objc-protocol-refs[opt]    [TODO]
 /// [OBJC]  typedef-name objc-protocol-refs[opt]  [TODO]
 /// [C++0x] 'decltype' ( expression )
+/// [AltiVec] '__vector'
 bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid,
                                         const char *&PrevSpec,
                                         unsigned &DiagID,
@@ -1304,6 +1321,11 @@
 
   switch (Tok.getKind()) {
   case tok::identifier:   // foo::bar
+    // Check for need to substitute AltiVec keyword tokens.
+    if (TryAltiVecToken(DS))
+      return ParseOptionalTypeSpecifier(DS, isInvalid, PrevSpec, DiagID,
+                                        TemplateInfo);
+    // Fall through.
   case tok::kw_typename:  // typename foo::bar
     // Annotate typenames and C++ scope specifiers.  If we get one, just
     // recurse to handle whatever we get.
@@ -1420,7 +1442,13 @@
     isInvalid = DS.SetTypeSpecType(DeclSpec::TST_decimal128, Loc, PrevSpec,
                                    DiagID);
     break;
-
+  case tok::kw___vector:
+    isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID);
+    break;
+  case tok::kw___pixel:
+    isInvalid = DS.SetTypeAltiVecPixel(true, Loc, PrevSpec, DiagID);
+    break;
+  
   // class-specifier:
   case tok::kw_class:
   case tok::kw_struct:
@@ -1882,6 +1910,9 @@
   default: return false;
 
   case tok::identifier:   // foo::bar
+    if (TryAltiVecVectorToken())
+      return true;
+    // Fall through.
   case tok::kw_typename:  // typename T::type
     // Annotate typenames and C++ scope specifiers.  If we get one, just
     // recurse to handle whatever we get.
@@ -1927,6 +1958,7 @@
   case tok::kw__Decimal32:
   case tok::kw__Decimal64:
   case tok::kw__Decimal128:
+  case tok::kw___vector:
 
     // struct-or-union-specifier (C99) or class-specifier (C++)
   case tok::kw_class:
@@ -1967,7 +1999,9 @@
     // Unfortunate hack to support "Class.factoryMethod" notation.
     if (getLang().ObjC1 && NextToken().is(tok::period))
       return false;
-    // Fall through
+    if (TryAltiVecVectorToken())
+      return true;
+    // Fall through.
 
   case tok::kw_typename: // typename T::type
     // Annotate typenames and C++ scope specifiers.  If we get one, just
@@ -2018,6 +2052,7 @@
   case tok::kw__Decimal32:
   case tok::kw__Decimal64:
   case tok::kw__Decimal128:
+  case tok::kw___vector:
 
     // struct-or-union-specifier (C99) or class-specifier (C++)
   case tok::kw_class:
@@ -2605,7 +2640,8 @@
 
   // Alternatively, this parameter list may be an identifier list form for a
   // K&R-style function:  void foo(a,b,c)
-  if (!getLang().CPlusPlus && Tok.is(tok::identifier)) {
+  if (!getLang().CPlusPlus && Tok.is(tok::identifier)
+      && !TryAltiVecVectorToken()) {
     if (!TryAnnotateTypeOrScopeToken()) {
       // K&R identifier lists can't have typedefs as identifiers, per
       // C99 6.7.5.3p11.
Index: lib/Parse/ParseExpr.cpp
===================================================================
--- lib/Parse/ParseExpr.cpp	(revision 91204)
+++ lib/Parse/ParseExpr.cpp	(working copy)
@@ -772,6 +772,7 @@
   case tok::kw_void:
   case tok::kw_typename:
   case tok::kw_typeof:
+  case tok::kw___vector:
   case tok::annot_typename: {
     if (!getLang().CPlusPlus) {
       Diag(Tok, diag::err_expected_expression);
Index: lib/Parse/DeclSpec.cpp
===================================================================
--- lib/Parse/DeclSpec.cpp	(revision 91204)
+++ lib/Parse/DeclSpec.cpp	(working copy)
@@ -184,6 +184,7 @@
   case DeclSpec::TST_decimal32:   return "_Decimal32";
   case DeclSpec::TST_decimal64:   return "_Decimal64";
   case DeclSpec::TST_decimal128:  return "_Decimal128";
+  case DeclSpec::TST_pixel:       return "__pixel";
   case DeclSpec::TST_enum:        return "enum";
   case DeclSpec::TST_class:       return "class";
   case DeclSpec::TST_union:       return "union";
@@ -284,6 +285,33 @@
   return false;
 }
 
+bool DeclSpec::SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc,
+                          const char *&PrevSpec, unsigned &DiagID) {
+  if (TypeSpecType != TST_unspecified) {
+    PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType);
+    DiagID = diag::err_invalid_vector_decl_spec_combination;
+    return true;
+  }
+  TypeAltiVecVector = isAltiVecVector;
+  AltiVecLoc = Loc;
+  return false;
+}
+
+bool DeclSpec::SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc,
+                          const char *&PrevSpec, unsigned &DiagID) {
+  if (!TypeAltiVecVector || (TypeSpecType != TST_unspecified)) {
+    PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType);
+    DiagID = diag::err_invalid_pixel_decl_spec_combination;
+    return true;
+  }
+  TypeSpecType = TST_int;
+  TypeSpecSign = TSS_unsigned;
+  TypeSpecWidth = TSW_short;
+  TypeAltiVecPixel = isAltiVecPixel;
+  TSTLoc = Loc;
+  return false;
+}
+
 bool DeclSpec::SetTypeSpecError() {
   TypeSpecType = TST_error;
   TypeRep = 0;
