[llvm-commits] [llvm] r67097 - in /llvm/branches/Apple/Dib: lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp test/CodeGen/X86/rip-rel-address.ll

Bill Wendling isanbard at gmail.com
Tue Mar 17 12:56:39 PDT 2009


Author: void
Date: Tue Mar 17 14:56:39 2009
New Revision: 67097

URL: http://llvm.org/viewvc/llvm-project?rev=67097&view=rev
Log:
--- Merging (from foreign repository) r67002 into '.':
A    test/CodeGen/X86/rip-rel-address.ll
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp

Don't forego folding of loads into 64-bit adds when the other
operand is a signed 32-bit immediate. Unlike with the 8-bit
signed immediate case, it isn't actually smaller to fold a
32-bit signed immediate instead of a load. In fact, it's
larger in the case of 32-bit unsigned immediates, because
they can be materialized with movl instead of movq.

Added:
    llvm/branches/Apple/Dib/test/CodeGen/X86/rip-rel-address.ll
Modified:
    llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp

Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=67097&r1=67096&r2=67097&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Mar 17 14:56:39 2009
@@ -453,14 +453,15 @@
           O << "@GOT";
         else
           O << "@GOTOFF";
-      } else if (Subtarget->isPICStyleRIPRel() && !NotRIPRel &&
-                 TM.getRelocationModel() != Reloc::Static) {
-        if (Subtarget->GVRequiresExtraLoad(GV, TM, false))
-          O << "@GOTPCREL";
-
-        if (needCloseParen) {
-          needCloseParen = false;
-          O << ')';
+      } else if (Subtarget->isPICStyleRIPRel() && !NotRIPRel) {
+        if (TM.getRelocationModel() != Reloc::Static) {
+          if (Subtarget->GVRequiresExtraLoad(GV, TM, false))
+            O << "@GOTPCREL";
+
+          if (needCloseParen) {
+            needCloseParen = false;
+            O << ')';
+          }
         }
 
         // Use rip when possible to reduce code size, except when
@@ -674,7 +675,7 @@
     switch (ExtraCode[0]) {
     default: return true;  // Unknown modifier.
     case 'c': // Don't print "$" before a global var name or constant.
-      printOperand(MI, OpNo, "mem");
+      printOperand(MI, OpNo, "mem", /*NotRIPRel=*/true);
       return false;
     case 'b': // Print QImode register
     case 'h': // Print QImode high register

Added: llvm/branches/Apple/Dib/test/CodeGen/X86/rip-rel-address.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/rip-rel-address.ll?rev=67097&view=auto

==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/rip-rel-address.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/rip-rel-address.ll Tue Mar 17 14:56:39 2009
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | llc -march=x86-64 -relocation-model=static | grep {a(%rip)}
+
+ at a = internal global double 3.4
+define double @foo() nounwind {
+  %a = load double* @a
+  ret double %a
+}





More information about the llvm-commits mailing list