diff options
author | Chad Rosier <mcrosier@apple.com> | 2011-11-03 02:04:59 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2011-11-03 02:04:59 +0000 |
commit | 463fe24f1dd5132607abb3548a2acb1849e9aa99 (patch) | |
tree | 6565bfb57123cab8f563a4a3d82d94c28d5c476d /lib/Target/ARM/ARMFastISel.cpp | |
parent | d1ffc739c1f88352c79a63ff17b828b3a529777e (diff) | |
download | llvm-463fe24f1dd5132607abb3548a2acb1849e9aa99.tar.gz llvm-463fe24f1dd5132607abb3548a2acb1849e9aa99.tar.bz2 llvm-463fe24f1dd5132607abb3548a2acb1849e9aa99.tar.xz |
Add support for sign-extending non-legal types in SelectSIToFP().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143603 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMFastISel.cpp')
-rw-r--r-- | lib/Target/ARM/ARMFastISel.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp index 78bda6c0d3..d1f2c7fcdd 100644 --- a/lib/Target/ARM/ARMFastISel.cpp +++ b/lib/Target/ARM/ARMFastISel.cpp @@ -1329,16 +1329,25 @@ bool ARMFastISel::SelectSIToFP(const Instruction *I) { if (!isTypeLegal(Ty, DstVT)) return false; - // FIXME: Handle sign-extension where necessary. - if (!I->getOperand(0)->getType()->isIntegerTy(32)) + Value *Src = I->getOperand(0); + EVT SrcVT = TLI.getValueType(Src->getType(), true); + if (SrcVT != MVT::i32 && SrcVT != MVT::i16 && SrcVT != MVT::i8) return false; - unsigned Op = getRegForValue(I->getOperand(0)); - if (Op == 0) return false; + unsigned SrcReg = getRegForValue(Src); + if (SrcReg == 0) return false; + + // Handle sign-extension. + if (SrcVT == MVT::i16 || SrcVT == MVT::i8) { + EVT DestVT = MVT::i32; + unsigned ResultReg = ARMEmitIntExt(SrcVT, SrcReg, DestVT, /*isZExt*/ false); + if (ResultReg == 0) return false; + SrcReg = ResultReg; + } // The conversion routine works on fp-reg to fp-reg and the operand above // was an integer, move it to the fp registers if possible. - unsigned FP = ARMMoveToFPReg(MVT::f32, Op); + unsigned FP = ARMMoveToFPReg(MVT::f32, SrcReg); if (FP == 0) return false; unsigned Opc; |