Index: include/clang/Basic/BuiltinsPPC.def
===================================================================
--- include/clang/Basic/BuiltinsPPC.def	(revision 114249)
+++ include/clang/Basic/BuiltinsPPC.def	(working copy)
@@ -204,6 +204,15 @@
 BUILTIN(__builtin_altivec_vcmpgtuw_p, "iiV4UiV4Ui", "")
 BUILTIN(__builtin_altivec_vcmpgtfp_p, "iiV4fV4f", "")
 
+// extensions
+BUILTIN(__builtin_altivec_extractb, "cV16ci", "")
+BUILTIN(__builtin_altivec_extracth, "sV8si", "")
+BUILTIN(__builtin_altivec_extractw, "iV4ii", "")
+
+BUILTIN(__builtin_altivec_insertb, "V16ccV16ci", "")
+BUILTIN(__builtin_altivec_inserth, "V8ssV8si", "")
+BUILTIN(__builtin_altivec_insertw, "V4iiV4ii", "")
+
 // FIXME: Obviously incomplete.
 
 #undef BUILTIN
Index: lib/CodeGen/CGBuiltin.cpp
===================================================================
--- lib/CodeGen/CGBuiltin.cpp	(revision 114249)
+++ lib/CodeGen/CGBuiltin.cpp	(working copy)
@@ -2177,6 +2177,22 @@
     llvm::Function *F = CGM.getIntrinsic(ID);
     return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "");
   }
+
+  // vec_extract
+  case PPC::BI__builtin_altivec_extractb:
+  case PPC::BI__builtin_altivec_extracth:
+  case PPC::BI__builtin_altivec_extractw:
+  {
+    return Builder.CreateExtractElement(Ops[0], Ops[1], "");
   }
+
+  // vec_insert
+  case PPC::BI__builtin_altivec_insertb:
+  case PPC::BI__builtin_altivec_inserth:
+  case PPC::BI__builtin_altivec_insertw:
+  {
+    return Builder.CreateInsertElement(Ops[1], Ops[0], Ops[2], "");
+  }
+  }
   return 0;
 }
