[Mips] Add support for llvm.thread.pointer intrinsic.

This will be used to implement __builtin_thread_pointer in clang.

Differential Revision: http://reviews.llvm.org/D19569

llvm-svn: 267743
diff --git a/llvm/test/CodeGen/Mips/thread-pointer.ll b/llvm/test/CodeGen/Mips/thread-pointer.ll
new file mode 100644
index 0000000..60bee3d
--- /dev/null
+++ b/llvm/test/CodeGen/Mips/thread-pointer.ll
@@ -0,0 +1,12 @@
+; RUN: llc -march=mips < %s | FileCheck %s
+; RUN: llc -march=mips64 < %s | FileCheck %s
+; RUN: llc -march=mipsel < %s | FileCheck %s
+; RUN: llc -march=mips64el < %s | FileCheck %s
+
+declare i8* @llvm.thread.pointer() nounwind readnone
+
+define i8* @thread_pointer() {
+; CHECK: rdhwr $3, $29
+  %1 = tail call i8* @llvm.thread.pointer()
+  ret i8* %1
+}