<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
This is missing documentation. It *looks* like you're trying to get
the thread local storage pointer. Is that correct? This can't be
reviewed without context and documented intent.<br>
<br>
Philip<br>
<br>
<div class="moz-cite-prefix">On 04/27/2016 01:27 AM, Marcin
Kościelnicki via llvm-commits wrote:<br>
</div>
<blockquote
cite="mid:differential-rev-PHID-DREV-ff5ttqwlfjn7saumis5e-req@reviews.llvm.org"
type="cite">
<pre wrap="">koriakin created this revision.
koriakin added reviewers: nadav, bruno.
koriakin added a subscriber: llvm-commits.
koriakin set the repository for this revision to rL LLVM.
This will be used for __builtin_thread_pointer in clang.
Repository:
rL LLVM
<a class="moz-txt-link-freetext" href="http://reviews.llvm.org/D19582">http://reviews.llvm.org/D19582</a>
Files:
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/thread-pointer.ll
Index: test/CodeGen/X86/thread-pointer.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/thread-pointer.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -mtriple=i386-unknown-linux | FileCheck %s --check-prefix=CHECK-32
+; RUN: llc < %s -mtriple=x86_64-unknown-linux | FileCheck %s --check-prefix=CHECK-64
+
+; Function Attrs: nounwind readnone
+declare i8* @llvm.thread.pointer() #1
+
+define i8* @thread_pointer() {
+; CHECK-32: movl %gs:0, %eax
+; CHECK-64: movq %fs:0, %rax
+ %1 = tail call i8* @llvm.thread.pointer()
+ ret i8* %1
+}
Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -17818,6 +17818,17 @@
Reg = RegInfo->getPtrSizedFrameRegister(MF);
return DAG.getCopyFromReg(DAG.getEntryNode(), dl, Reg, VT);
}
+
+ case Intrinsic::thread_pointer: {
+ const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+ EVT PtrVT = TLI.getPointerTy(DAG.getDataLayout());
+ // Get the Thread Pointer, which is %gs:0 (32-bit) or %fs:0 (64-bit).
+ Value *Ptr = Constant::getNullValue(
+ Type::getInt8PtrTy(*DAG.getContext(), Subtarget.is64Bit() ? 257 : 256));
+ return DAG.getLoad(PtrVT, dl, DAG.getEntryNode(),
+ DAG.getIntPtrConstant(0, dl),
+ MachinePointerInfo(Ptr), false, false, false, 0);
+ }
}
}
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a>
</pre>
</blockquote>
<br>
</body>
</html>