summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FastISel.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-03-13 23:53:06 +0000
committerDan Gohman <gohman@apple.com>2009-03-13 23:53:06 +0000
commita62e4ab69063fa3c049a3a86704ca96ec291de59 (patch)
tree269e2554f24e0f3cbafec43912adfb612b0a3bc1 /llvm/lib/Target/X86/X86FastISel.cpp
parent084d855a17f2755c995be4393eb3e1dbb018deb5 (diff)
downloadbcm5719-llvm-a62e4ab69063fa3c049a3a86704ca96ec291de59.tar.gz
bcm5719-llvm-a62e4ab69063fa3c049a3a86704ca96ec291de59.zip
Improve FastISel's handling of truncates to i1, and implement
ptrtoint and inttoptr in X86FastISel. These casts aren't always handled in the generic FastISel code because X86 sometimes needs custom code to do truncation and zero-extension. llvm-svn: 66988
Diffstat (limited to 'llvm/lib/Target/X86/X86FastISel.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FastISel.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp
index 50f1935dcdb..7a10b123bc4 100644
--- a/llvm/lib/Target/X86/X86FastISel.cpp
+++ b/llvm/lib/Target/X86/X86FastISel.cpp
@@ -1413,6 +1413,19 @@ X86FastISel::TargetSelectInstruction(Instruction *I) {
return X86SelectFPTrunc(I);
case Instruction::ExtractValue:
return X86SelectExtractValue(I);
+ case Instruction::IntToPtr: // Deliberate fall-through.
+ case Instruction::PtrToInt: {
+ MVT SrcVT = TLI.getValueType(I->getOperand(0)->getType());
+ MVT DstVT = TLI.getValueType(I->getType());
+ if (DstVT.bitsGT(SrcVT))
+ return X86SelectZExt(I);
+ if (DstVT.bitsLT(SrcVT))
+ return X86SelectTrunc(I);
+ unsigned Reg = getRegForValue(I->getOperand(0));
+ if (Reg == 0) return false;
+ UpdateValueMap(I, Reg);
+ return true;
+ }
}
return false;
OpenPOWER on IntegriCloud