diff options
author | Dan Gohman <gohman@apple.com> | 2009-03-13 23:53:06 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-03-13 23:53:06 +0000 |
commit | 474d3b3f40e117a66946e9fb9d2016b4c05caef0 (patch) | |
tree | e4fe73f5281c4cbfdea7165412bf7d617eff8c60 /lib/Target/X86/X86FastISel.cpp | |
parent | 4425240dbcb6e0da24f4a9f72cfb24f529f5b7af (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66988 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86FastISel.cpp')
-rw-r--r-- | lib/Target/X86/X86FastISel.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp index 50f1935dcd..7a10b123bc 100644 --- a/lib/Target/X86/X86FastISel.cpp +++ b/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; |