[llvm] r267743 - [Mips] Add support for llvm.thread.pointer intrinsic.
Marcin Koscielnicki via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 27 10:21:49 PDT 2016
Author: koriakin
Date: Wed Apr 27 12:21:49 2016
New Revision: 267743
URL: http://llvm.org/viewvc/llvm-project?rev=267743&view=rev
Log:
[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
Added:
llvm/trunk/test/CodeGen/Mips/thread-pointer.ll
Modified:
llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp
Modified: llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp?rev=267743&r1=267742&r2=267743&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSEISelLowering.cpp Wed Apr 27 12:21:49 2016
@@ -2166,6 +2166,10 @@ SDValue MipsSETargetLowering::lowerINTRI
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);
+ }
}
}
Added: llvm/trunk/test/CodeGen/Mips/thread-pointer.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/thread-pointer.ll?rev=267743&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/thread-pointer.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/thread-pointer.ll Wed Apr 27 12:21:49 2016
@@ -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
+}
More information about the llvm-commits
mailing list