[llvm-commits] [llvm] r70992 - in /llvm/trunk: docs/CodeGenerator.html lib/Target/X86/X86Instr64bit.td lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/movfs.ll
Chris Lattner
sabre at nondot.org
Tue May 5 11:52:36 PDT 2009
Author: lattner
Date: Tue May 5 13:52:19 2009
New Revision: 70992
URL: http://llvm.org/viewvc/llvm-project?rev=70992&view=rev
Log:
Add basic support for code generation of
addrspace(257) -> FS relative on x86. Patch by Zoltan Varga!
Added:
llvm/trunk/test/CodeGen/X86/movfs.ll
Modified:
llvm/trunk/docs/CodeGenerator.html
llvm/trunk/lib/Target/X86/X86Instr64bit.td
llvm/trunk/lib/Target/X86/X86InstrInfo.td
Modified: llvm/trunk/docs/CodeGenerator.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodeGenerator.html?rev=70992&r1=70991&r2=70992&view=diff
==============================================================================
--- llvm/trunk/docs/CodeGenerator.html (original)
+++ llvm/trunk/docs/CodeGenerator.html Tue May 5 13:52:19 2009
@@ -1844,11 +1844,13 @@
segment. LLVM address space 0 is the default address space, which includes
the stack, and any unqualified memory accesses in a program. Address spaces
1-255 are currently reserved for user-defined code. The GS-segment is
- represented by address space 256. Other x86 segments have yet to be
- allocated address space numbers.</p>
-
-<p>Some operating systems use the GS-segment to implement TLS, so care should be
- taken when reading and writing to address space 256 on these platforms.</p>
+ represented by address space 256, while the FS-segment is represented by
+ address space 257. Other x86 segments have yet to be allocated address space
+ numbers.</p>
+
+<p>Some operating systems use the FS/GS-segment to implement TLS, so care
+ should be taken when reading and writing to address space 256/257 on these
+ platforms.</p>
</div>
Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=70992&r1=70991&r2=70992&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original)
+++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue May 5 13:52:19 2009
@@ -1326,6 +1326,11 @@
"movq\t%gs:$src, $dst",
[(set GR64:$dst, (gsload addr:$src))]>, SegGS;
+let AddedComplexity = 5 in
+def MOV64FSrm : RI<0x8B, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
+ "movq\t%fs:$src, $dst",
+ [(set GR64:$dst, (fsload addr:$src))]>, SegFS;
+
//===----------------------------------------------------------------------===//
// Atomic Instructions
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=70992&r1=70991&r2=70992&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue May 5 13:52:19 2009
@@ -345,6 +345,13 @@
return false;
}]>;
+def fsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
+ if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
+ if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
+ return PT->getAddressSpace() == 257;
+ return false;
+}]>;
+
def loadi8 : PatFrag<(ops node:$ptr), (i8 (load node:$ptr)), [{
if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
@@ -3004,6 +3011,11 @@
"movl\t%gs:$src, $dst",
[(set GR32:$dst, (gsload addr:$src))]>, SegGS;
+let AddedComplexity = 5 in
+def FS_MOV32rm : I<0x8B, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
+ "movl\t%fs:$src, $dst",
+ [(set GR32:$dst, (fsload addr:$src))]>, SegFS;
+
//===----------------------------------------------------------------------===//
// DWARF Pseudo Instructions
//
Added: llvm/trunk/test/CodeGen/X86/movfs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/movfs.ll?rev=70992&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/movfs.ll (added)
+++ llvm/trunk/test/CodeGen/X86/movfs.ll Tue May 5 13:52:19 2009
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep fs
+
+define i32 @foo() nounwind readonly {
+entry:
+ %tmp = load i32* addrspace(257)* getelementptr (i32* addrspace(257)* inttoptr (i32 72 to i32* addrspace(257)*), i32 31) ; <i32*> [#uses=1]
+ %tmp1 = load i32* %tmp ; <i32> [#uses=1]
+ ret i32 %tmp1
+}
More information about the llvm-commits
mailing list