[llvm-commits] [llvm] r41013 - in /llvm/trunk: CREDITS.TXT lib/Target/X86/README.txt lib/Target/X86/X86ISelDAGToDAG.cpp

Christopher Lamb christopher.lamb at gmail.com
Fri Aug 10 15:22:42 PDT 2007


Author: clamb
Date: Fri Aug 10 17:22:41 2007
New Revision: 41013

URL: http://llvm.org/viewvc/llvm-project?rev=41013&view=rev
Log:
Use subregs to improve any_extend code generation when feasible.

Modified:
    llvm/trunk/CREDITS.TXT
    llvm/trunk/lib/Target/X86/README.txt
    llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp

Modified: llvm/trunk/CREDITS.TXT
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=41013&r1=41012&r2=41013&view=diff

==============================================================================
--- llvm/trunk/CREDITS.TXT (original)
+++ llvm/trunk/CREDITS.TXT Fri Aug 10 17:22:41 2007
@@ -135,7 +135,8 @@
 
 N: Christopher Lamb
 E: christopher.lamb at gmail.com
-D: aligned load/store support
+D: aligned load/store support, parts of noalias and restrict support
+D: vreg subreg infrastructure, X86 codegen improvements based on subregs
 
 N: Jim Laskey
 E: jlaskey at apple.com

Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=41013&r1=41012&r2=41013&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Fri Aug 10 17:22:41 2007
@@ -532,22 +532,6 @@
 
 //===---------------------------------------------------------------------===//
 
-Don't forget to find a way to squash noop truncates in the JIT environment.
-
-//===---------------------------------------------------------------------===//
-
-Implement anyext in the same manner as truncate that would allow them to be
-eliminated.
-
-//===---------------------------------------------------------------------===//
-
-How about implementing truncate / anyext as a property of machine instruction
-operand? i.e. Print as 32-bit super-class register / 16-bit sub-class register.
-Do this for the cases where a truncate / anyext is guaranteed to be eliminated.
-For IA32 that is truncate from 32 to 16 and anyext from 16 to 32.
-
-//===---------------------------------------------------------------------===//
-
 For this:
 
 int test(int a)

Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=41013&r1=41012&r2=41013&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Aug 10 17:22:41 2007
@@ -1372,6 +1372,39 @@
 
       return NULL;
     }
+
+    case ISD::ANY_EXTEND: {
+      SDOperand N0 = Node->getOperand(0);
+      AddToISelQueue(N0);
+      if (NVT == MVT::i64 || NVT == MVT::i32 || NVT == MVT::i16) {
+        SDOperand SRIdx;
+        switch(N0.getValueType()) {
+        case MVT::i32:
+          SRIdx = CurDAG->getTargetConstant(3, MVT::i32); // SubRegSet 3
+          break;
+        case MVT::i16:
+          SRIdx = CurDAG->getTargetConstant(2, MVT::i32); // SubRegSet 2
+          break;
+        case MVT::i8:
+          if (Subtarget->is64Bit())
+            SRIdx = CurDAG->getTargetConstant(1, MVT::i32); // SubRegSet 1
+          break;
+        default: assert(0 && "Unknown any_extend!");
+        }
+        if (SRIdx.Val) {
+          SDNode *ResNode = CurDAG->getTargetNode(X86::INSERT_SUBREG, NVT, N0, SRIdx);
+
+#ifndef NDEBUG
+          DOUT << std::string(Indent-2, ' ') << "=> ";
+          DEBUG(ResNode->dump(CurDAG));
+          DOUT << "\n";
+          Indent -= 2;
+#endif
+          return ResNode;
+        } // Otherwise let generated ISel handle it.
+      }
+      break;
+    }
     
     case ISD::SIGN_EXTEND_INREG: {
       SDOperand N0 = Node->getOperand(0);





More information about the llvm-commits mailing list