[PATCH] D19569: [Mips] Add support for llvm.thread.pointer intrinsic.
Marcin KoĆcielnicki via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 16:31:56 PDT 2016
koriakin created this revision.
koriakin added reviewers: dsanders, vkalintiris.
koriakin added a subscriber: llvm-commits.
koriakin set the repository for this revision to rL LLVM.
Herald added subscribers: sdardis, dsanders.
This will be used to implement __builtin_thread_pointer in clang.
Repository:
rL LLVM
http://reviews.llvm.org/D19569
Files:
lib/Target/Mips/MipsSEISelLowering.cpp
test/CodeGen/Mips/thread-pointer.ll
Index: test/CodeGen/Mips/thread-pointer.ll
===================================================================
--- /dev/null
+++ 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
+ %1 = tail call i8* @llvm.thread.pointer()
+ ret i8* %1
+}
Index: lib/Target/Mips/MipsSEISelLowering.cpp
===================================================================
--- lib/Target/Mips/MipsSEISelLowering.cpp
+++ lib/Target/Mips/MipsSEISelLowering.cpp
@@ -2166,6 +2166,10 @@
case Intrinsic::mips_xori_b:
return DAG.getNode(ISD::XOR, DL, Op->getValueType(0),
Op->getOperand(1), lowerMSASplatImm(Op, 2, DAG));
+ case Intrinsic::thread_pointer: {
+ EVT PtrVT = getPointerTy(DAG.getDataLayout());
+ return DAG.getNode(MipsISD::ThreadPointer, DL, PtrVT);
+ }
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19569.55120.patch
Type: text/x-patch
Size: 1086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160426/78d4af7a/attachment.bin>
More information about the llvm-commits
mailing list