Convert the non-temporal store builtins to LLVM-native IR.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130830 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 7a0c8da..c2f1ebd1 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -2154,6 +2154,23 @@
     LI->setAlignment(1); // Unaligned load.
     return Builder.CreateBitCast(LI, VecTy, "loadu.cast");
   }
+  case X86::BI__builtin_ia32_movntps:
+  case X86::BI__builtin_ia32_movntpd:
+  case X86::BI__builtin_ia32_movntdq:
+  case X86::BI__builtin_ia32_movnti: {
+    llvm::SmallVector<Value *, 1> Elts;
+    Elts.push_back(llvm::ConstantInt::get(Int32Ty, 1));
+    llvm::MDNode *Node = llvm::MDNode::get(getLLVMContext(), Elts);
+
+    // Convert the type of the pointer to a pointer to the stored type.
+    Value *BC = Builder.CreateBitCast(Ops[0],
+                                llvm::PointerType::getUnqual(Ops[1]->getType()),
+                                      "cast");
+    StoreInst *SI = Builder.CreateStore(Ops[1], BC);
+    SI->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
+    SI->setAlignment(16);
+    return SI;
+  }
   // 3DNow!
   case X86::BI__builtin_ia32_pavgusb:
   case X86::BI__builtin_ia32_pf2id: