[llvm-commits] [llvm] r56990 - /llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp

Dan Gohman gohman at apple.com
Thu Oct 2 18:28:47 PDT 2008


Author: djg
Date: Thu Oct  2 20:28:47 2008
New Revision: 56990

URL: http://llvm.org/viewvc/llvm-project?rev=56990&view=rev
Log:
Implement fast-isel support for zero-extending from i1.
It turns out that this is a fairly common operation,
and it's easy enough to handle.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=56990&r1=56989&r2=56990&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Oct  2 20:28:47 2008
@@ -386,10 +386,21 @@
     
   if (SrcVT == MVT::Other || !SrcVT.isSimple() ||
       DstVT == MVT::Other || !DstVT.isSimple() ||
-      !TLI.isTypeLegal(SrcVT) || !TLI.isTypeLegal(DstVT))
+      !TLI.isTypeLegal(DstVT))
     // Unhandled type. Halt "fast" selection and bail.
     return false;
     
+  // Check if the source operand is legal. Or as a special case,
+  // it may be i1 if we're doing zero-extension because that's
+  // trivially easy and somewhat common.
+  if (!TLI.isTypeLegal(SrcVT)) {
+    if (SrcVT == MVT::i1 && Opcode == ISD::ZERO_EXTEND)
+      SrcVT = TLI.getTypeToTransformTo(SrcVT);
+    else
+      // Unhandled type. Halt "fast" selection and bail.
+      return false;
+  }
+    
   unsigned InputReg = getRegForValue(I->getOperand(0));
   if (!InputReg)
     // Unhandled operand.  Halt "fast" selection and bail.





More information about the llvm-commits mailing list