summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-10-03 01:28:47 +0000
committerDan Gohman <gohman@apple.com>2008-10-03 01:28:47 +0000
commit4e072a75cc94abdac9b1468555cb40aad810de2d (patch)
tree7630e2d65bdbfe6c0c3d5478f501d785ec113100 /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
parentb01a9c94d4a8264f26aad8a0e3783bdf083a0558 (diff)
downloadbcm5719-llvm-4e072a75cc94abdac9b1468555cb40aad810de2d.tar.gz
bcm5719-llvm-4e072a75cc94abdac9b1468555cb40aad810de2d.zip
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. llvm-svn: 56990
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index c0e8418c4c5..17b37a34452 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -386,10 +386,21 @@ bool FastISel::SelectCast(User *I, ISD::NodeType Opcode) {
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.
OpenPOWER on IntegriCloud